Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a644a64f authored by Prabal Singh's avatar Prabal Singh
Browse files

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
parent 6c3f1df8
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -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 */ }