Enhance Settings deep link transition

Since the deep link mechanism uses a trampoline activity to redirect the
target activity, and the targeting activity is launched in a separate
task, there will be two transitions played, where one is the splash
screen with the trampoline acitvity and another one is the task
transition. This makes the UX weird.

To avoid this, this CL tries to make the targeting activity launch in
the same task as the trampoline acitivity by removing the taskAffinity,
so there won't be a task transition.

Fix: 215275940
Test: Create a settings shortcut on the home screen and launch it.
Change-Id: I7621ab9f1132acbf619495801a3b985c5c3b1b5d
This commit is contained in:
Jason Chiu
2021-12-02 14:26:24 +08:00
parent 46adb8e175
commit 177573c892
8 changed files with 24 additions and 21 deletions

View File

@@ -41,8 +41,8 @@ import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroduction
import com.android.settings.biometrics.fingerprint.FingerprintEnrollIntroductionInternal;
import com.android.settings.core.FeatureFlags;
import com.android.settings.homepage.DeepLinkHomepageActivity;
import com.android.settings.homepage.DeepLinkHomepageActivityInternal;
import com.android.settings.homepage.SettingsHomepageActivity;
import com.android.settings.homepage.SliceDeepLinkHomepageActivity;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.users.AvatarPickerActivity;
@@ -106,9 +106,7 @@ public class ActivityEmbeddingRulesController {
}
/**
* Register a new SplitPairRule for Settings home. Because homepage is able to be opened by
* {@link Settings} or {@link SettingsHomepageActivity} or
* {@link SliceDeepLinkHomepageActivity}, we register split rule for above cases.
* Registers a {@link SplitPairRule} for all classes that Settings homepage can be invoked from.
*/
public static void registerTwoPanePairRuleForSettingsHome(Context context,
ComponentName secondaryComponent,
@@ -151,7 +149,7 @@ public class ActivityEmbeddingRulesController {
registerTwoPanePairRule(
context,
new ComponentName(context, SliceDeepLinkHomepageActivity.class),
new ComponentName(context, DeepLinkHomepageActivityInternal.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
@@ -202,8 +200,6 @@ public class ActivityEmbeddingRulesController {
private void registerHomepagePlaceholderRule() {
final Set<ActivityFilter> activityFilters = new HashSet<>();
addActivityFilter(activityFilters, SettingsHomepageActivity.class);
addActivityFilter(activityFilters, DeepLinkHomepageActivity.class);
addActivityFilter(activityFilters, SliceDeepLinkHomepageActivity.class);
addActivityFilter(activityFilters, Settings.class);
final Intent intent = new Intent(mContext, Settings.NetworkDashboardActivity.class);