From 4884157649559076d9a362acae4529ef9c0925f8 Mon Sep 17 00:00:00 2001 From: Simon Wingrove Date: Mon, 17 Oct 2022 14:50:50 +0100 Subject: [PATCH] Don't trampoline twice when opening security or privacy Settings already trampolines to a two-pane version of deeplink activities, doing another trampoline will wind up creating a second task covering up the first, with the wrong layout. Bug: 253554698 Test: manually Change-Id: Ib7ba5c95cac2f644ade37a41f321d11c8f1d1b89 --- src/com/android/settings/Settings.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index f1c11918884..50ffdc720eb 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -152,6 +152,11 @@ public class Settings extends SettingsActivity { /** Redirects to SafetyCenter if enabled. */ @VisibleForTesting public void handleSafetyCenterRedirection() { + if (isFinishing()) { + // Don't trampoline if already exiting this activity. + return; + } + if (SafetyCenterManagerWrapper.get().isEnabled(this)) { try { startActivity(new Intent(Intent.ACTION_SAFETY_CENTER)); @@ -213,6 +218,11 @@ public class Settings extends SettingsActivity { /** Redirects to SafetyCenter if enabled. */ @VisibleForTesting public void handleSafetyCenterRedirection() { + if (isFinishing()) { + // Don't trampoline if already exiting this activity. + return; + } + if (ACTION_PRIVACY_SETTINGS.equals(getIntent().getAction()) && SafetyCenterManagerWrapper.get().isEnabled(this)) { try {