Loading src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settings.development import android.content.Context import android.permission.flags.Flags.sensitiveNotificationAppProtection import android.provider.Settings import android.view.flags.Flags.sensitiveContentAppProtection import androidx.annotation.VisibleForTesting import androidx.preference.Preference import androidx.preference.TwoStatePreference Loading Loading @@ -64,6 +65,7 @@ class SensitiveContentProtectionPreferenceController(val context: Context) : override fun isAvailable(): Boolean { return sensitiveNotificationAppProtection() || screenshareNotificationHiding() || sensitiveContentAppProtection() } companion object { Loading tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt +10 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider import android.provider.Settings import android.provider.Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS import android.view.flags.Flags.FLAG_SENSITIVE_CONTENT_APP_PROTECTION import androidx.preference.Preference import androidx.preference.PreferenceScreen import androidx.preference.SwitchPreference Loading Loading @@ -132,7 +133,8 @@ class SensitiveContentProtectionPreferenceControllerTest { @Test @RequiresFlagsDisabled( FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION, FLAG_SCREENSHARE_NOTIFICATION_HIDING) FLAG_SCREENSHARE_NOTIFICATION_HIDING, FLAG_SENSITIVE_CONTENT_APP_PROTECTION) fun isAvailable_flagsDisabled_returnFalse() { assertFalse(controller.isAvailable) } Loading @@ -148,4 +150,10 @@ class SensitiveContentProtectionPreferenceControllerTest { fun isAvailable_screenshareNotificationHidingEnabled_returnTrue() { assertTrue(controller.isAvailable) } @Test @RequiresFlagsEnabled(FLAG_SENSITIVE_CONTENT_APP_PROTECTION) fun isAvailable_screenshareSensitiveContentHidingEnabled_returnTrue() { assertTrue(controller.isAvailable) } } Loading
src/com/android/settings/development/SensitiveContentProtectionPreferenceController.kt +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settings.development import android.content.Context import android.permission.flags.Flags.sensitiveNotificationAppProtection import android.provider.Settings import android.view.flags.Flags.sensitiveContentAppProtection import androidx.annotation.VisibleForTesting import androidx.preference.Preference import androidx.preference.TwoStatePreference Loading Loading @@ -64,6 +65,7 @@ class SensitiveContentProtectionPreferenceController(val context: Context) : override fun isAvailable(): Boolean { return sensitiveNotificationAppProtection() || screenshareNotificationHiding() || sensitiveContentAppProtection() } companion object { Loading
tests/spa_unit/src/com/android/settings/development/SensitiveContentProtectionPreferenceControllerTest.kt +10 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.platform.test.annotations.RequiresFlagsEnabled import android.platform.test.flag.junit.DeviceFlagsValueProvider import android.provider.Settings import android.provider.Settings.Global.DISABLE_SCREEN_SHARE_PROTECTIONS_FOR_APPS_AND_NOTIFICATIONS import android.view.flags.Flags.FLAG_SENSITIVE_CONTENT_APP_PROTECTION import androidx.preference.Preference import androidx.preference.PreferenceScreen import androidx.preference.SwitchPreference Loading Loading @@ -132,7 +133,8 @@ class SensitiveContentProtectionPreferenceControllerTest { @Test @RequiresFlagsDisabled( FLAG_SENSITIVE_NOTIFICATION_APP_PROTECTION, FLAG_SCREENSHARE_NOTIFICATION_HIDING) FLAG_SCREENSHARE_NOTIFICATION_HIDING, FLAG_SENSITIVE_CONTENT_APP_PROTECTION) fun isAvailable_flagsDisabled_returnFalse() { assertFalse(controller.isAvailable) } Loading @@ -148,4 +150,10 @@ class SensitiveContentProtectionPreferenceControllerTest { fun isAvailable_screenshareNotificationHidingEnabled_returnTrue() { assertTrue(controller.isAvailable) } @Test @RequiresFlagsEnabled(FLAG_SENSITIVE_CONTENT_APP_PROTECTION) fun isAvailable_screenshareSensitiveContentHidingEnabled_returnTrue() { assertTrue(controller.isAvailable) } }