Launch SecurityHub fragment on SECURITY_SETTINGS intent when available.

Test: atest SettingsUnitTests
Test: adb shell am start -a android.settings.SECURITY_SETTINGS opens
SecurityHub screen (when SecurityHub enabled)
Test: assistant opens SecurityHub screen (when SecurityHub enabled) when
given instrucion to "open security settings"
Bug: 183930061

Change-Id: Ie8fcb2f2dce4cd0a2a84c6cd21a0a1c0b2b3665e
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index b672917..923c2bd 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -219,7 +219,7 @@
     private String getMetricsTag() {
         String tag = null;
         if (getIntent() != null && getIntent().hasExtra(EXTRA_SHOW_FRAGMENT)) {
-            tag = getIntent().getStringExtra(EXTRA_SHOW_FRAGMENT);
+            tag = getInitialFragmentName(getIntent());
         }
         if (TextUtils.isEmpty(tag)) {
             Log.w(LOG_TAG, "MetricsTag is invalid " + tag);
@@ -262,7 +262,7 @@
         }
 
         // Getting Intent properties can only be done after the super.onCreate(...)
-        final String initialFragmentName = intent.getStringExtra(EXTRA_SHOW_FRAGMENT);
+        final String initialFragmentName = getInitialFragmentName(intent);
 
         // This is a "Sub Settings" when:
         // - this is a real SubSettings
@@ -363,6 +363,12 @@
         }
     }
 
+    /** Returns the initial fragment name that the activity will launch. */
+    @VisibleForTesting
+    public String getInitialFragmentName(Intent intent) {
+        return intent.getStringExtra(EXTRA_SHOW_FRAGMENT);
+    }
+
     @Override
     protected void onApplyThemeResource(Theme theme, int resid, boolean first) {
         theme.applyStyle(R.style.SetupWizardPartnerResource, true);