Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationsInteractorTest.kt +23 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.dump.dumpManager import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.collectLastValue Loading Loading @@ -59,6 +61,7 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() { keyguardInteractor = keyguardInteractor, sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor, dumpManager = dumpManager, biometricUnlockInteractor = biometricUnlockInteractor, ) } Loading Loading @@ -128,6 +131,26 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() { assertThat(content!!.title).isEqualTo("REDACTED") } @Test fun content_sensitive_unlocked_biometricUnlockDismissesKeyguard() = kosmos.runTest { // GIVEN a promoted entry val ronEntry = buildPublicPrivatePromotedOngoing() setKeyguardLocked(true) setScreenSharingProtectionActive(false) kosmos.fakeKeyguardRepository.setBiometricUnlockState( BiometricUnlockMode.UNLOCK_COLLAPSING ) renderNotificationListInteractor.setRenderedList(listOf(ronEntry)) // THEN aod content remains redacted val content by collectLastValue(underTest.content) assertThat(content).isNotNull() assertThat(content!!.title).isEqualTo("REDACTED") } private fun Kosmos.setKeyguardLocked(locked: Boolean) { fakeKeyguardRepository.setKeyguardDismissible(!locked) } Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt +10 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.domain.interactor.BiometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.policy.domain.interactor.SensitiveNotificationProtectionInteractor import com.android.systemui.util.kotlin.FlowDumperImpl Loading @@ -36,18 +38,22 @@ constructor( keyguardInteractor: KeyguardInteractor, sensitiveNotificationProtectionInteractor: SensitiveNotificationProtectionInteractor, dumpManager: DumpManager, biometricUnlockInteractor: BiometricUnlockInteractor, ) : FlowDumperImpl(dumpManager) { /** * Whether the system is unlocked and not screensharing such that private notification content * is allowed to show on the aod * Whether the system is unlocked, not screensharing such that private notification content is * allowed to show on the aod, and a biometric is not about to dismiss the keyguard */ private val canShowPrivateNotificationContent: Flow<Boolean> = combine( keyguardInteractor.isKeyguardDismissible, sensitiveNotificationProtectionInteractor.isSensitiveStateActive, ) { isKeyguardDismissible, isSensitive -> isKeyguardDismissible && !isSensitive biometricUnlockInteractor.unlockState, ) { isKeyguardDismissible, isSensitive, biometricUnlockState -> isKeyguardDismissible && !isSensitive && !BiometricUnlockMode.dismissesKeyguard(biometricUnlockState.mode) } /** The content to show as the promoted notification on AOD */ Loading packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dump.dumpManager import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.policy.domain.interactor.sensitiveNotificationProtectionInteractor Loading @@ -28,5 +29,6 @@ val Kosmos.aodPromotedNotificationInteractor by keyguardInteractor = keyguardInteractor, sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor, dumpManager = dumpManager, biometricUnlockInteractor = biometricUnlockInteractor, ) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationsInteractorTest.kt +23 −0 Original line number Diff line number Diff line Loading @@ -24,7 +24,9 @@ import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.dump.dumpManager import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.Kosmos.Fixture import com.android.systemui.kosmos.collectLastValue Loading Loading @@ -59,6 +61,7 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() { keyguardInteractor = keyguardInteractor, sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor, dumpManager = dumpManager, biometricUnlockInteractor = biometricUnlockInteractor, ) } Loading Loading @@ -128,6 +131,26 @@ class AODPromotedNotificationsInteractorTest : SysuiTestCase() { assertThat(content!!.title).isEqualTo("REDACTED") } @Test fun content_sensitive_unlocked_biometricUnlockDismissesKeyguard() = kosmos.runTest { // GIVEN a promoted entry val ronEntry = buildPublicPrivatePromotedOngoing() setKeyguardLocked(true) setScreenSharingProtectionActive(false) kosmos.fakeKeyguardRepository.setBiometricUnlockState( BiometricUnlockMode.UNLOCK_COLLAPSING ) renderNotificationListInteractor.setRenderedList(listOf(ronEntry)) // THEN aod content remains redacted val content by collectLastValue(underTest.content) assertThat(content).isNotNull() assertThat(content!!.title).isEqualTo("REDACTED") } private fun Kosmos.setKeyguardLocked(locked: Boolean) { fakeKeyguardRepository.setKeyguardDismissible(!locked) } Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractor.kt +10 −4 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.domain.interactor.BiometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor import com.android.systemui.keyguard.shared.model.BiometricUnlockMode import com.android.systemui.statusbar.notification.promoted.shared.model.PromotedNotificationContentModel import com.android.systemui.statusbar.policy.domain.interactor.SensitiveNotificationProtectionInteractor import com.android.systemui.util.kotlin.FlowDumperImpl Loading @@ -36,18 +38,22 @@ constructor( keyguardInteractor: KeyguardInteractor, sensitiveNotificationProtectionInteractor: SensitiveNotificationProtectionInteractor, dumpManager: DumpManager, biometricUnlockInteractor: BiometricUnlockInteractor, ) : FlowDumperImpl(dumpManager) { /** * Whether the system is unlocked and not screensharing such that private notification content * is allowed to show on the aod * Whether the system is unlocked, not screensharing such that private notification content is * allowed to show on the aod, and a biometric is not about to dismiss the keyguard */ private val canShowPrivateNotificationContent: Flow<Boolean> = combine( keyguardInteractor.isKeyguardDismissible, sensitiveNotificationProtectionInteractor.isSensitiveStateActive, ) { isKeyguardDismissible, isSensitive -> isKeyguardDismissible && !isSensitive biometricUnlockInteractor.unlockState, ) { isKeyguardDismissible, isSensitive, biometricUnlockState -> isKeyguardDismissible && !isSensitive && !BiometricUnlockMode.dismissesKeyguard(biometricUnlockState.mode) } /** The content to show as the promoted notification on AOD */ Loading
packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/promoted/domain/interactor/AODPromotedNotificationInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.promoted.domain.interactor import com.android.systemui.dump.dumpManager import com.android.systemui.keyguard.domain.interactor.biometricUnlockInteractor import com.android.systemui.keyguard.domain.interactor.keyguardInteractor import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.policy.domain.interactor.sensitiveNotificationProtectionInteractor Loading @@ -28,5 +29,6 @@ val Kosmos.aodPromotedNotificationInteractor by keyguardInteractor = keyguardInteractor, sensitiveNotificationProtectionInteractor = sensitiveNotificationProtectionInteractor, dumpManager = dumpManager, biometricUnlockInteractor = biometricUnlockInteractor, ) }