Don't start two pane for singleInstance deep links

If the activity's launch mode is "singleInstance", it can't be embedded
in Settings since it will be created in a new task.

Bug: 229371407
Test: adb shell am start -a android.settings.NETWORK_OPERATOR_SETTINGS
Change-Id: I1689d860151182cd9e97d9e4fd65d30a8804a570
This commit is contained in:
Jason Chiu
2022-05-26 17:47:18 +08:00
parent fa878f2f26
commit 0c732f2a80

View File

@@ -466,6 +466,15 @@ public class SettingsActivity extends SettingsBaseActivity
return false; return false;
} }
// If the activity's launch mode is "singleInstance", it can't be embedded in Settings since
// it will be created in a new task.
ActivityInfo info = intent.resolveActivityInfo(getPackageManager(),
PackageManager.MATCH_DEFAULT_ONLY);
if (info.launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
Log.w(LOG_TAG, "launchMode: singleInstance");
return false;
}
if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) { if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) {
// Slice deep link starts the Intent using SubSettingLauncher. Returns true to show // Slice deep link starts the Intent using SubSettingLauncher. Returns true to show
// 2-pane deep link. // 2-pane deep link.