Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +3 −2 Original line number Diff line number Diff line Loading @@ -415,8 +415,9 @@ constructor( withContext(backgroundDispatcher) { devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId) } val flagsToCheck = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL // TODO(b/268218507): "or" with DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL val flagsToCheck = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL or DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL return flagsToCheck and flags != 0 } Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +20 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun `quickAffordance - bottom end affordance is hidden when disabled by device policy`() = fun `quickAffordance - hidden when all features are disabled by device policy`() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL) Loading @@ -261,6 +261,25 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun `quickAffordance - hidden when shortcuts feature is disabled by device policy`() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL) quickAccessWallet.setState( KeyguardQuickAffordanceConfig.LockScreenState.Visible( icon = ICON, ) ) val collectedValue by collectLastValue( underTest.quickAffordance(KeyguardQuickAffordancePosition.BOTTOM_END) ) assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun `quickAffordance - bottom start affordance hidden while dozing`() = testScope.runTest { Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +3 −2 Original line number Diff line number Diff line Loading @@ -415,8 +415,9 @@ constructor( withContext(backgroundDispatcher) { devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId) } val flagsToCheck = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL // TODO(b/268218507): "or" with DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL val flagsToCheck = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL or DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL return flagsToCheck and flags != 0 } Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractorTest.kt +20 −1 Original line number Diff line number Diff line Loading @@ -243,7 +243,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { } @Test fun `quickAffordance - bottom end affordance is hidden when disabled by device policy`() = fun `quickAffordance - hidden when all features are disabled by device policy`() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL) Loading @@ -261,6 +261,25 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() { assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun `quickAffordance - hidden when shortcuts feature is disabled by device policy`() = testScope.runTest { whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL) quickAccessWallet.setState( KeyguardQuickAffordanceConfig.LockScreenState.Visible( icon = ICON, ) ) val collectedValue by collectLastValue( underTest.quickAffordance(KeyguardQuickAffordancePosition.BOTTOM_END) ) assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) } @Test fun `quickAffordance - bottom start affordance hidden while dozing`() = testScope.runTest { Loading