From 2cb3f925a3cb605e319d7894d9b77c42db4550f1 Mon Sep 17 00:00:00 2001 From: Yi-Ling Chuang Date: Mon, 24 Jan 2022 10:35:06 +0800 Subject: [PATCH] Only set embedding rule for top level injection Only the injected items on the top level pages should always be opened on the right pane, so we should only register the split rule for that part. This will leave flexibilities for those injected items in the subpages. Fixes: 216026158 Test: Go to Passwords & accounts > {account} > Google Account and see the page opened in a full screen/new task. Change-Id: I9f311547854ace410e93fdb4ca394df1079f723c --- .../dashboard/DashboardFeatureProviderImpl.java | 17 +++++++---------- .../profileselector/ProfileSelectDialog.java | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java index cdac3b9f41d..8ad66d23e4f 100644 --- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java @@ -171,11 +171,13 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { intent.setAction(action); } // Register the rule for injected apps. - ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome( - mContext, - new ComponentName(tile.getPackageName(), tile.getComponentName()), - action, - true /* clearTop */); + if (fragment instanceof TopLevelSettings) { + ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome( + mContext, + new ComponentName(tile.getPackageName(), tile.getComponentName()), + action, + true /* clearTop */); + } pref.setOnPreferenceClickListener(preference -> { TopLevelHighlightMixin highlightMixin = null; if (fragment instanceof TopLevelSettings @@ -442,11 +444,6 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { ProfileSelectDialog.updateUserHandlesIfNeeded(mContext, tile); mMetricsFeatureProvider.logStartedIntent(intent, sourceMetricCategory); - //TODO(b/201970810): Add test cases. - if (tile.isNewTask(mContext)) { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - } - if (tile.userHandle == null || tile.isPrimaryProfileOnly()) { activity.startActivity(intent); } else if (tile.userHandle.size() == 1) { diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java index e0ba3787199..d3234dd1151 100644 --- a/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java +++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectDialog.java @@ -97,7 +97,7 @@ public class ProfileSelectDialog extends DialogFragment implements OnClickListen public void onClick(DialogInterface dialog, int which) { final UserHandle user = mSelectedTile.userHandle.get(which); // Show menu on top level items. - final Intent intent = mSelectedTile.getIntent(); + final Intent intent = new Intent(mSelectedTile.getIntent()); FeatureFactory.getFactory(getContext()).getMetricsFeatureProvider() .logStartedIntentWithProfile(intent, mSourceMetricCategory, which == 1 /* isWorkProfile */);