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
This commit is contained in:
Jan Tomljanovic
2021-04-27 20:58:12 +01:00
parent 6be940f396
commit 07bffff454
3 changed files with 151 additions and 3 deletions

View File

@@ -219,7 +219,7 @@ public class SettingsActivity extends SettingsBaseActivity
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 @@ public class SettingsActivity extends SettingsBaseActivity
}
// 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 @@ public class SettingsActivity extends SettingsBaseActivity
}
}
/** 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);