From a644a64fe95fc3a5d19e08f114afe1fe0512f5b0 Mon Sep 17 00:00:00 2001 From: Prabal Singh Date: Mon, 13 Feb 2023 17:41:06 +0000 Subject: [PATCH] Redirect AdvancedSecuritySettings to MoreSettings When safety center is enabled, AdvancedSecuritySettings page will be merged into MoreSettings. Test: manually tested Bug: b/269079559 Change-Id: I4f22befa915c78e1ca4e73e16cda05b50e890deb --- src/com/android/settings/Settings.java | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java index 22160d75741..50a52aa4d1f 100644 --- a/src/com/android/settings/Settings.java +++ b/src/com/android/settings/Settings.java @@ -208,7 +208,33 @@ public class Settings extends SettingsActivity { } } /** Activity for the Advanced security settings. */ - public static class SecurityAdvancedSettings extends SettingsActivity { /* empty */ } + public static class SecurityAdvancedSettings extends SettingsActivity { + private static final String TAG = "SecurityAdvancedActivity"; + @Override + protected void onCreate(Bundle savedState) { + super.onCreate(savedState); + handleMoreSettingsRedirection(); + } + + /** Redirects to More Settings if Safety center is enabled. */ + @VisibleForTesting + public void handleMoreSettingsRedirection() { + if (isFinishing()) { + // Don't trampoline if already exiting this activity. + return; + } + + if (SafetyCenterManagerWrapper.get().isEnabled(this)) { + try { + startActivity( + new Intent("com.android.settings.MORE_SECURITY_PRIVACY_SETTINGS")); + finish(); + } catch (ActivityNotFoundException e) { + Log.e(TAG, "Unable to open More Settings", e); + } + } + } + } /** Activity for the More settings page. */ public static class MoreSecurityPrivacySettingsActivity extends SettingsActivity { /* empty */ } public static class UsageAccessSettingsActivity extends SettingsActivity { /* empty */ }