From 4dd3f11349588ff88dbd7d718dc2c2487880a6ad Mon Sep 17 00:00:00 2001 From: Arc Wang Date: Thu, 23 Sep 2021 14:47:15 +0800 Subject: [PATCH] Fix not able to add Settings shortcut widget problem After users select a shortcut item in CreateShortcutActivity, launchers need to get result from CreateShortcutActivity. For large screen devices, Settings deep link will start DeepLinkHomepageActivity and then DeepLinkHomepageActivity starts the deep link page. The CreateShortcutActivity result deos not forward to launcher and there is no shortcut added. This change uses Intent.FLAG_ACTIVITY_FORWARD_RESULT to forward result from CreateShortcutActivity to launcher. Bug: 200889769 Test: manual Long click launcher -> Widget -> Settings -> select an item and check if it adds a short on launcher. Change-Id: Idd5fc642be5c1fb2f747316c3ddcd9b7f0b33852 --- src/com/android/settings/SettingsActivity.java | 1 + src/com/android/settings/homepage/SettingsHomepageActivity.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index d5730a12fbd..dc5d68ffc45 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -384,6 +384,7 @@ public class SettingsActivity extends SettingsBaseActivity trampolineIntent.putExtra( android.provider.Settings.EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_URI, intent.toUri(Intent.URI_INTENT_SCHEME)); + trampolineIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); startActivity(trampolineIntent); return true; diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index 5df7b7a3cb1..d6a8a927527 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java @@ -212,6 +212,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements intent.setAction(null); targetIntent.setFlags(targetIntent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK); + targetIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); // Sender of intent may want to send intent extra data to the destination of targetIntent. targetIntent.replaceExtras(intent);