diff --git a/Android.bp b/Android.bp index b7da53ea72d..325b0d89f9e 100644 --- a/Android.bp +++ b/Android.bp @@ -112,6 +112,7 @@ android_library { "Settings-change-ids", "SystemUIUnfoldLib", "co.aospa.framework", + "google-securityhub", ], libs: [ @@ -150,6 +151,18 @@ android_app { ], } +android_library_import { + name: "google-securityhub", + aars: ["libs/google-securityhub.aar"], + sdk_version: "33", + static_libs: [ + "androidx.preference_preference", + "com.google.android.material_material", + "guava", + ] +} + + android_library_import { name: "contextualcards", aars: ["libs/contextualcards.aar"], diff --git a/libs/google-securityhub.aar b/libs/google-securityhub.aar new file mode 100644 index 00000000000..5632bfd30c7 Binary files /dev/null and b/libs/google-securityhub.aar differ diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java index 207b5dfbdb8..cedcd00bdb1 100644 --- a/src/com/android/settings/core/gateway/SettingsGateway.java +++ b/src/com/android/settings/core/gateway/SettingsGateway.java @@ -183,6 +183,8 @@ import com.android.settings.wifi.tether.WifiTetherClientManager; import com.android.settings.wifi.tether.WifiTetherSettings; +import com.google.android.settings.security.SecurityHubDashboard; + public class SettingsGateway { /** @@ -353,7 +355,8 @@ public class SettingsGateway { AppLocaleDetails.class.getName(), TurnScreenOnSettings.class.getName(), TurnScreenOnDetails.class.getName(), - WifiTetherClientManager.class.getName() + WifiTetherClientManager.class.getName(), + SecurityHubDashboard.class.getName() }; public static final String[] SETTINGS_FOR_RESTRICTED = { diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java index 89f74de8233..85d81924461 100644 --- a/src/com/android/settings/overlay/FeatureFactoryImpl.java +++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java @@ -74,6 +74,7 @@ import com.android.settings.wifi.WifiTrackerLibProvider; import com.android.settings.wifi.WifiTrackerLibProviderImpl; import com.android.settingslib.core.instrumentation.MetricsFeatureProvider; +import com.google.android.settings.security.SecuritySettingsFeatureProviderGoogleImpl; /** * {@link FeatureFactory} implementation for AOSP Settings. @@ -314,7 +315,8 @@ public WifiTrackerLibProvider getWifiTrackerLibProvider() { @Override public SecuritySettingsFeatureProvider getSecuritySettingsFeatureProvider() { if (mSecuritySettingsFeatureProvider == null) { - mSecuritySettingsFeatureProvider = new SecuritySettingsFeatureProviderImpl(); + mSecuritySettingsFeatureProvider = + new SecuritySettingsFeatureProviderGoogleImpl(getAppContext()); } return mSecuritySettingsFeatureProvider; } diff --git a/src/com/android/settings/security/SecuritySettingsFeatureProviderImpl.java b/src/com/android/settings/security/SecuritySettingsFeatureProviderImpl.java index e4f540c758c..12b3bcf4952 100644 --- a/src/com/android/settings/security/SecuritySettingsFeatureProviderImpl.java +++ b/src/com/android/settings/security/SecuritySettingsFeatureProviderImpl.java @@ -16,21 +16,26 @@ package com.android.settings.security; +import com.android.settings.R; +import com.android.settings.overlay.FeatureFactory; +import com.google.android.settings.security.SecurityHubDashboard; + /** Implementation for {@code SecuritySettingsFeatureProvider}. */ public class SecuritySettingsFeatureProviderImpl implements SecuritySettingsFeatureProvider { @Override public boolean hasAlternativeSecuritySettingsFragment() { - return false; + return true; } @Override public String getAlternativeSecuritySettingsFragmentClassname() { - return null; + return SecurityHubDashboard.class.getName(); } @Override public String getAlternativeAdvancedSettingsCategoryKey() { - return null; + return FeatureFactory.getAppContext().getString( + R.string.config_alternative_advanced_security_category_key); } } diff --git a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java index f83a9095902..7c2abec980e 100644 --- a/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java +++ b/src/com/android/settings/security/TopLevelSecurityEntryPreferenceController.java @@ -25,6 +25,7 @@ import com.android.settings.core.SubSettingLauncher; import com.android.settings.overlay.FeatureFactory; import com.android.settings.safetycenter.SafetyCenterManagerWrapper; +import com.google.android.settings.security.SecurityHubDashboard; public class TopLevelSecurityEntryPreferenceController extends BasePreferenceController { @@ -50,18 +51,14 @@ public boolean handlePreferenceTreeClick(Preference preference) { return super.handlePreferenceTreeClick(preference); } - if (mSecuritySettingsFeatureProvider.hasAlternativeSecuritySettingsFragment()) { - String alternativeFragmentClassname = - mSecuritySettingsFeatureProvider - .getAlternativeSecuritySettingsFragmentClassname(); - if (alternativeFragmentClassname != null) { - new SubSettingLauncher(mContext) - .setDestination(alternativeFragmentClassname) - .setSourceMetricsCategory(getMetricsCategory()) - .setIsSecondLayerPage(true) - .launch(); - return true; - } + String alternativeFragmentClassname = SecurityHubDashboard.class.getName(); + if (alternativeFragmentClassname != null) { + new SubSettingLauncher(mContext) + .setDestination(alternativeFragmentClassname) + .setSourceMetricsCategory(getMetricsCategory()) + .setIsSecondLayerPage(true) + .launch(); + return true; } return super.handlePreferenceTreeClick(preference);