Fixed crash when going into android app settings and going back to linphone

This commit is contained in:
Sylvain Berfini 2019-03-21 17:30:11 +01:00
parent 9d1cfe2ea5
commit 49b45cab09
2 changed files with 10 additions and 3 deletions

View file

@ -123,6 +123,8 @@ import org.linphone.xmlrpc.XmlRpcListenerBase;
public class LinphoneActivity extends LinphoneGenericActivity
implements OnClickListener, ActivityCompat.OnRequestPermissionsResultCallback {
public static final int ANDROID_APP_SETTINGS_ACTIVITY = 300;
private static final int SETTINGS_ACTIVITY = 123;
private static final int CALL_ACTIVITY = 19;
private static final int PERMISSIONS_REQUEST_OVERLAY = 206;
@ -1118,7 +1120,9 @@ public class LinphoneActivity extends LinphoneGenericActivity
mNewProxyConfig = getIntent().getExtras().getBoolean("isNewProxyConfig");
}
if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
if (requestCode == ANDROID_APP_SETTINGS_ACTIVITY) {
LinphoneActivity.instance().goToDialerFragment();
} else if (resultCode == Activity.RESULT_FIRST_USER && requestCode == SETTINGS_ACTIVITY) {
if (data.getExtras().getBoolean("Exit", false)) {
quit();
} else {

View file

@ -1761,7 +1761,7 @@ public class SettingsFragment extends PreferenceFragment {
@Override
public boolean onPreferenceClick(Preference preference) {
synchronized (SettingsFragment.this) {
Context context = SettingsFragment.this.getActivity();
Context context = LinphoneActivity.instance();
Intent i = new Intent();
i.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
i.addCategory(Intent.CATEGORY_DEFAULT);
@ -1769,7 +1769,10 @@ public class SettingsFragment extends PreferenceFragment {
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
i.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
i.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
context.startActivity(i);
LinphoneActivity.instance()
.startActivityForResult(
i,
LinphoneActivity.ANDROID_APP_SETTINGS_ACTIVITY);
}
return true;
}