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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user