Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,31 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { assertThat(collectedValue()).isEqualTo(KeyguardQuickAffordanceModel.Hidden) } @Test fun quickAffordanceAlwaysVisible_notVisible_restrictedByPolicyManager() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL) repository.setKeyguardShowing(false) repository.setIsDozing(true) homeControls.setState( KeyguardQuickAffordanceConfig.LockScreenState.Visible( icon = ICON, activationState = ActivationState.Active, ) ) val collectedValue by collectLastValue( underTest.quickAffordanceAlwaysVisible( KeyguardQuickAffordancePosition.BOTTOM_START ) ) assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun quickAffordanceAlwaysVisible_evenWhenLockScreenNotShowingAndDozing() = testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +6 −2 Original line number Diff line number Diff line Loading @@ -120,10 +120,14 @@ constructor( * This is useful for experiences like the lock screen preview mode, where the affordances must * always be visible. */ fun quickAffordanceAlwaysVisible( suspend fun quickAffordanceAlwaysVisible( position: KeyguardQuickAffordancePosition, ): Flow<KeyguardQuickAffordanceModel> { return quickAffordanceInternal(position) return if (isFeatureDisabledByDevicePolicy()) { flowOf(KeyguardQuickAffordanceModel.Hidden) } else { quickAffordanceInternal(position) } } /** Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +25 −0 Original line number Diff line number Diff line Loading @@ -343,6 +343,31 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { assertThat(collectedValue()).isEqualTo(KeyguardQuickAffordanceModel.Hidden) } @Test fun quickAffordanceAlwaysVisible_notVisible_restrictedByPolicyManager() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL) repository.setKeyguardShowing(false) repository.setIsDozing(true) homeControls.setState( KeyguardQuickAffordanceConfig.LockScreenState.Visible( icon = ICON, activationState = ActivationState.Active, ) ) val collectedValue by collectLastValue( underTest.quickAffordanceAlwaysVisible( KeyguardQuickAffordancePosition.BOTTOM_START ) ) assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun quickAffordanceAlwaysVisible_evenWhenLockScreenNotShowingAndDozing() = testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +6 −2 Original line number Diff line number Diff line Loading @@ -120,10 +120,14 @@ constructor( * This is useful for experiences like the lock screen preview mode, where the affordances must * always be visible. */ fun quickAffordanceAlwaysVisible( suspend fun quickAffordanceAlwaysVisible( position: KeyguardQuickAffordancePosition, ): Flow<KeyguardQuickAffordanceModel> { return quickAffordanceInternal(position) return if (isFeatureDisabledByDevicePolicy()) { flowOf(KeyguardQuickAffordanceModel.Hidden) } else { quickAffordanceInternal(position) } } /** Loading