From 7ffd6d81868a89537e85f22f874c9623f6dc6dd4 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Wed, 15 Sep 2021 17:14:38 +0800 Subject: [PATCH] Fix sometimes deep link does not show in 2-pane Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK starts the activity-alias 'DeepLinkHomepageActivity', however, if Settings app first time (from application cteation) starts from the activity-alias 'Settings', framework will uses 'Settings' instead of DeepLinkHomepageActivity to match pair rule. User will see full screen deep link for this case. This change registers deep link pair rule for both the activity-alias 'Settings' and 'DeepLinkHomepageActivity'. Bug: 200131691 Test: manual 1. Launch Settings from launcher. 2. Launch Settings from Settings shortcut widget. 3. Observe if the shortcut page shows in 2-pane. Change-Id: Ice9d09f3545a02603f529d5d19e621ae82302004 --- .../settings/homepage/SettingsHomepageActivity.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index f073a618e05..c065c75c7b9 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java @@ -24,7 +24,6 @@ import android.content.ComponentName; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Bundle; -import android.provider.Settings; import android.text.TextUtils; import android.util.FeatureFlagUtils; import android.util.Log; @@ -40,6 +39,7 @@ import androidx.fragment.app.FragmentTransaction; import androidx.window.embedding.SplitController; import com.android.settings.R; +import com.android.settings.Settings; import com.android.settings.Utils; import com.android.settings.accounts.AvatarViewMixin; import com.android.settings.core.CategoryMixin; @@ -180,12 +180,12 @@ public class SettingsHomepageActivity extends FragmentActivity implements final Intent intent = getIntent(); if (intent == null || !TextUtils.equals(intent.getAction(), - Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK)) { + android.provider.Settings.ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK)) { return; } final String intentUriString = intent.getStringExtra( - Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI); + android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI); if (TextUtils.isEmpty(intentUriString)) { Log.e(TAG, "No EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI to deep link"); finish(); @@ -215,12 +215,17 @@ public class SettingsHomepageActivity extends FragmentActivity implements targetIntent.putExtra(EXTRA_IS_FROM_SETTINGS_HOMEPAGE, true); - // Set 2-pane pair rule for the external deep link page. + // Set 2-pane pair rule for the deep link page. ActivityEmbeddingRulesController.registerTwoPanePairRule(this, new ComponentName(Utils.SETTINGS_PACKAGE_NAME, ALIAS_DEEP_LINK), targetComponentName, true /* finishPrimaryWithSecondary */, true /* finishSecondaryWithPrimary */); + ActivityEmbeddingRulesController.registerTwoPanePairRule(this, + new ComponentName(Settings.class.getPackageName(), Settings.class.getName()), + targetComponentName, + true /* finishPrimaryWithSecondary */, + true /* finishSecondaryWithPrimary */); startActivity(targetIntent); }