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:
@@ -154,8 +154,7 @@
|
||||
<!-- Activity for launching deep link page in 2-pane. -->
|
||||
<activity android:name=".homepage.DeepLinkHomepageActivity"
|
||||
android:label="@string/settings_label_launcher"
|
||||
android:theme="@style/Theme.Settings.Home.DeepLink"
|
||||
android:taskAffinity=""
|
||||
android:theme="@style/Theme.Settings.Home"
|
||||
android:launchMode="singleTask"
|
||||
android:exported="true"
|
||||
android:enabled="false"
|
||||
@@ -169,9 +168,9 @@
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity android:name=".homepage.SliceDeepLinkHomepageActivity"
|
||||
<activity android:name=".homepage.DeepLinkHomepageActivityInternal"
|
||||
android:label="@string/settings_label_launcher"
|
||||
android:theme="@style/Theme.Settings.Home.DeepLink"
|
||||
android:theme="@style/Theme.Settings.Home.NoAnimation"
|
||||
android:taskAffinity=""
|
||||
android:launchMode="singleTask"
|
||||
android:exported="false"
|
||||
|
@@ -218,7 +218,7 @@
|
||||
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.Settings.Home.DeepLink">
|
||||
<style name="Theme.Settings.Home.NoAnimation">
|
||||
<item name="android:windowAnimationStyle">@null</item>
|
||||
</style>
|
||||
|
||||
|
@@ -65,8 +65,8 @@ import com.android.settings.core.SettingsBaseActivity;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.core.gateway.SettingsGateway;
|
||||
import com.android.settings.dashboard.DashboardFeatureProvider;
|
||||
import com.android.settings.homepage.DeepLinkHomepageActivityInternal;
|
||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settings.homepage.SliceDeepLinkHomepageActivity;
|
||||
import com.android.settings.homepage.TopLevelSettings;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.wfd.WifiDisplaySettings;
|
||||
@@ -254,7 +254,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
final Intent intent = getIntent();
|
||||
|
||||
if (shouldShowTwoPaneDeepLink(intent) && tryStartTwoPaneDeepLink(intent)) {
|
||||
finishAndRemoveTask();
|
||||
finish();
|
||||
super.onCreate(savedState);
|
||||
return;
|
||||
}
|
||||
@@ -421,7 +421,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
mHighlightMenuKey = highlightMenuKey;
|
||||
}
|
||||
trampolineIntent = getTrampolineIntent(intent, mHighlightMenuKey);
|
||||
trampolineIntent.setClass(this, SliceDeepLinkHomepageActivity.class);
|
||||
trampolineIntent.setClass(this, DeepLinkHomepageActivityInternal.class);
|
||||
} else {
|
||||
trampolineIntent = getTrampolineIntent(intent, mHighlightMenuKey);
|
||||
}
|
||||
@@ -440,8 +440,11 @@ public class SettingsActivity extends SettingsBaseActivity
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the activity is not the task root, it should not start trampoline for deep links.
|
||||
if (!isTaskRoot()) {
|
||||
// If the activity is task root, starting trampoline is needed in order to show two-pane UI.
|
||||
// If FLAG_ACTIVITY_NEW_TASK is set, the activity will become the start of a new task on
|
||||
// this history stack, so starting trampoline is needed in order to notify the homepage that
|
||||
// the highlight key is changed.
|
||||
if (!isTaskRoot() && (intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -16,6 +16,6 @@
|
||||
|
||||
package com.android.settings.homepage;
|
||||
|
||||
/** Activity for other apps to launch Settings deep link page */
|
||||
/** Activity for other apps to launch a Settings deep link page */
|
||||
public class DeepLinkHomepageActivity extends SettingsHomepageActivity {
|
||||
}
|
||||
|
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.settings.homepage;
|
||||
|
||||
/** Activity for Slices to launch Settings deep link page */
|
||||
public class SliceDeepLinkHomepageActivity extends SettingsHomepageActivity {
|
||||
/**
|
||||
* Activity used for search results and slices to launch a deep link page without the cross-app
|
||||
* transition animation
|
||||
*/
|
||||
public class DeepLinkHomepageActivityInternal extends SettingsHomepageActivity {
|
||||
}
|
@@ -344,7 +344,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
|
||||
}
|
||||
|
||||
if (!(this instanceof DeepLinkHomepageActivity
|
||||
|| this instanceof SliceDeepLinkHomepageActivity)) {
|
||||
|| this instanceof DeepLinkHomepageActivityInternal)) {
|
||||
Log.e(TAG, "Not a deep link component");
|
||||
finish();
|
||||
return;
|
||||
|
@@ -34,6 +34,7 @@ import com.android.settings.SubSettings;
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
|
||||
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
|
||||
import com.android.settings.core.FeatureFlags;
|
||||
import com.android.settings.homepage.DeepLinkHomepageActivityInternal;
|
||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
|
||||
@@ -101,6 +102,7 @@ public class SearchResultTrampoline extends Activity {
|
||||
} else if (isSettingsIntelligence(callingActivity)) {
|
||||
if (FeatureFlagUtils.isEnabled(this, FeatureFlags.SETTINGS_SEARCH_ALWAYS_EXPAND)) {
|
||||
startActivity(SettingsActivity.getTrampolineIntent(intent, highlightMenuKey)
|
||||
.setClass(this, DeepLinkHomepageActivityInternal.class)
|
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user