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
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 22160d7..50a52aa 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -208,7 +208,33 @@
         }
     }
     /** 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 */ }