From 27c6b55ac51736c92fc674e495935fc6bebfc87d Mon Sep 17 00:00:00 2001 From: Jason Chiu Date: Mon, 13 Jun 2022 16:32:08 +0800 Subject: [PATCH] Remove FLAG_ACTIVITY_NEW_DOCUMENT when starting the deep link If an app starts a Settings deep link with FLAG_ACTIVITY_NEW_DOCUMENT, FLAG_ACIVITY_NEW_TASK is auto-appended by frameworks which causes a SecurityException on the 2-pane design because starting a new task on the right pane is not allowed. Deep links in the 2-pane design will clear the top activities, which has the same UX behavior of setting FLAG_ACTIVITY_NEW_DOCUMENT, so we remove the flag in this case. Fix: 233917580 Test: start account page via Assistant Change-Id: Idcbeb96e441592d48686f18f3433864f2c14832a --- src/com/android/settings/homepage/SettingsHomepageActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index 3c72dd1c3b5..8e14c5a44ea 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java @@ -436,7 +436,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements // To prevent launchDeepLinkIntentToRight again for configuration change. intent.setAction(null); - targetIntent.removeFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + targetIntent.removeFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NEW_DOCUMENT); targetIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); // Sender of intent may want to send intent extra data to the destination of targetIntent.