Merge "Respect KEYGUARD_DISABLE_SHORTCUTS_ALL" into tm-qpr-dev am: d112915038

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21421869

Change-Id: Ibc16c81e183d804c052d65e820ca30523e9cb8e9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Ale Nijamkin
2023-02-17 00:55:01 +00:00
committed by Automerger Merge Worker
2 changed files with 23 additions and 3 deletions

View File

@@ -415,8 +415,9 @@ constructor(
withContext(backgroundDispatcher) { withContext(backgroundDispatcher) {
devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId) devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)
} }
val flagsToCheck = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL val flagsToCheck =
// TODO(b/268218507): "or" with DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL or
DevicePolicyManager.KEYGUARD_DISABLE_SHORTCUTS_ALL
return flagsToCheck and flags != 0 return flagsToCheck and flags != 0
} }

View File

@@ -243,7 +243,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
} }
@Test @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 { testScope.runTest {
whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId)) whenever(devicePolicyManager.getKeyguardDisabledFeatures(null, userTracker.userId))
.thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL) .thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_ALL)
@@ -261,6 +261,25 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
assertThat(collectedValue).isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java) 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 @Test
fun `quickAffordance - bottom start affordance hidden while dozing`() = fun `quickAffordance - bottom start affordance hidden while dozing`() =
testScope.runTest { testScope.runTest {