From 488f79cab56117acadd9599847e50f5d07d98111 Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Fri, 5 Nov 2021 11:07:33 +0800 Subject: [PATCH] [Large screen] SplitListener may not provide correct information SettingsActivity may send Settings 2-pane deep link Intent to SettingsHomepageActivity if split callback tells that there is no SplitInfo. Wallpaper app sends deep link Intent to SettingsHomepageActivity, and then SettingsHomepageActivity starts Wallpaper app page. The flow should be 2-pane organized but the split callback tells that splitInfos is empty. This change checks if the Intent is from SettingsHomepageActivity to prevent the Intent loop by the bug. Bug: 205206004 Test: manual Long click Launcher -> Wallpaper & style Change-Id: I6b9d76c136238e556384e891ae1700ae7c1bb41f --- src/com/android/settings/SettingsActivity.java | 5 +++++ .../android/settings/homepage/SettingsHomepageActivity.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 226e1de1895..957efdf7bed 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -451,6 +451,11 @@ public class SettingsActivity extends SettingsBaseActivity return false; } + if (intent.getBooleanExtra(SettingsHomepageActivity.EXTRA_IS_FROM_SETTINGS_HOMEPAGE, + /* defaultValue */ false)) { + return false; + } + if (TextUtils.equals(intent.getAction(), Intent.ACTION_CREATE_SHORTCUT)) { // Returns false to show full screen for Intent.ACTION_CREATE_SHORTCUT because // - Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and activity diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index 0322cfa8b5e..f90ca1c6eec 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java @@ -63,6 +63,10 @@ public class SettingsHomepageActivity extends FragmentActivity implements private static final String TAG = "SettingsHomepageActivity"; + // Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK. + // Put true value to the intent when startActivity for a deep link intent from this Activity. + public static final String EXTRA_IS_FROM_SETTINGS_HOMEPAGE = "is_from_settings_homepage"; + // Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK. // Set & get Uri of the Intent separately to prevent failure of Intent#ParseUri. public static final String EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_DATA = @@ -264,6 +268,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements // Sender of intent may want to send intent extra data to the destination of targetIntent. targetIntent.replaceExtras(intent); + targetIntent.putExtra(EXTRA_IS_FROM_SETTINGS_HOMEPAGE, true); targetIntent.putExtra(SettingsActivity.EXTRA_IS_FROM_SLICE, false); targetIntent.setData(intent.getParcelableExtra(