Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +7 −5 Original line number Diff line number Diff line Loading @@ -789,9 +789,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, @Override public int getBouncerPromptReason() { int currentUser = KeyguardUpdateMonitor.getCurrentUser(); boolean trust = mUpdateMonitor.isTrustUsuallyManaged(currentUser); boolean biometrics = mUpdateMonitor.isUnlockingWithBiometricsPossible(currentUser); boolean any = trust || biometrics; boolean trustAgentsEnabled = mUpdateMonitor.isTrustUsuallyManaged(currentUser); boolean biometricsEnrolled = mUpdateMonitor.isUnlockingWithBiometricsPossible(currentUser); boolean any = trustAgentsEnabled || biometricsEnrolled; KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker = mUpdateMonitor.getStrongAuthTracker(); int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser); Loading @@ -800,9 +801,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, return KeyguardSecurityView.PROMPT_REASON_RESTART; } else if (any && (strongAuth & STRONG_AUTH_REQUIRED_AFTER_TIMEOUT) != 0) { return KeyguardSecurityView.PROMPT_REASON_TIMEOUT; } else if (any && (strongAuth & STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW) != 0) { } else if ((strongAuth & STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW) != 0) { return KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN; } else if (trust && (strongAuth & SOME_AUTH_REQUIRED_AFTER_USER_REQUEST) != 0) { } else if (trustAgentsEnabled && (strongAuth & SOME_AUTH_REQUIRED_AFTER_USER_REQUEST) != 0) { return KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; } else if (any && ((strongAuth & STRONG_AUTH_REQUIRED_AFTER_LOCKOUT) != 0 || mUpdateMonitor.isFingerprintLockedOut())) { Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.systemui.keyguard; import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; Loading @@ -43,6 +46,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardDisplayManager; import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.SysuiTestCase; Loading Loading @@ -181,6 +185,24 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager, atLeast(1)).show(null); } @Test public void testBouncerPrompt_deviceLockedByAdmin() { // GIVEN no trust agents enabled and biometrics aren't enrolled when(mUpdateMonitor.isTrustUsuallyManaged(anyInt())).thenReturn(false); when(mUpdateMonitor.isUnlockingWithBiometricsPossible(anyInt())).thenReturn(false); // WHEN the strong auth reason is AFTER_DPM_LOCK_NOW KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker = mock(KeyguardUpdateMonitor.StrongAuthTracker.class); when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(strongAuthTracker); when(strongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn( STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW); // THEN the bouncer prompt reason should return PROMPT_REASON_DEVICE_ADMIN assertEquals(KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN, mViewMediator.mViewMediatorCallback.getBouncerPromptReason()); } private void createAndStartViewMediator() { mViewMediator = new KeyguardViewMediator( mContext, Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +7 −5 Original line number Diff line number Diff line Loading @@ -789,9 +789,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, @Override public int getBouncerPromptReason() { int currentUser = KeyguardUpdateMonitor.getCurrentUser(); boolean trust = mUpdateMonitor.isTrustUsuallyManaged(currentUser); boolean biometrics = mUpdateMonitor.isUnlockingWithBiometricsPossible(currentUser); boolean any = trust || biometrics; boolean trustAgentsEnabled = mUpdateMonitor.isTrustUsuallyManaged(currentUser); boolean biometricsEnrolled = mUpdateMonitor.isUnlockingWithBiometricsPossible(currentUser); boolean any = trustAgentsEnabled || biometricsEnrolled; KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker = mUpdateMonitor.getStrongAuthTracker(); int strongAuth = strongAuthTracker.getStrongAuthForUser(currentUser); Loading @@ -800,9 +801,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable, return KeyguardSecurityView.PROMPT_REASON_RESTART; } else if (any && (strongAuth & STRONG_AUTH_REQUIRED_AFTER_TIMEOUT) != 0) { return KeyguardSecurityView.PROMPT_REASON_TIMEOUT; } else if (any && (strongAuth & STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW) != 0) { } else if ((strongAuth & STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW) != 0) { return KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN; } else if (trust && (strongAuth & SOME_AUTH_REQUIRED_AFTER_USER_REQUEST) != 0) { } else if (trustAgentsEnabled && (strongAuth & SOME_AUTH_REQUIRED_AFTER_USER_REQUEST) != 0) { return KeyguardSecurityView.PROMPT_REASON_USER_REQUEST; } else if (any && ((strongAuth & STRONG_AUTH_REQUIRED_AFTER_LOCKOUT) != 0 || mUpdateMonitor.isFingerprintLockedOut())) { Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.systemui.keyguard; import static android.view.WindowManagerPolicyConstants.OFF_BECAUSE_OF_USER; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; Loading @@ -43,6 +46,7 @@ import androidx.test.filters.SmallTest; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardDisplayManager; import com.android.keyguard.KeyguardSecurityView; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.mediator.ScreenOnCoordinator; import com.android.systemui.SysuiTestCase; Loading Loading @@ -181,6 +185,24 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager, atLeast(1)).show(null); } @Test public void testBouncerPrompt_deviceLockedByAdmin() { // GIVEN no trust agents enabled and biometrics aren't enrolled when(mUpdateMonitor.isTrustUsuallyManaged(anyInt())).thenReturn(false); when(mUpdateMonitor.isUnlockingWithBiometricsPossible(anyInt())).thenReturn(false); // WHEN the strong auth reason is AFTER_DPM_LOCK_NOW KeyguardUpdateMonitor.StrongAuthTracker strongAuthTracker = mock(KeyguardUpdateMonitor.StrongAuthTracker.class); when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(strongAuthTracker); when(strongAuthTracker.getStrongAuthForUser(anyInt())).thenReturn( STRONG_AUTH_REQUIRED_AFTER_DPM_LOCK_NOW); // THEN the bouncer prompt reason should return PROMPT_REASON_DEVICE_ADMIN assertEquals(KeyguardSecurityView.PROMPT_REASON_DEVICE_ADMIN, mViewMediator.mViewMediatorCallback.getBouncerPromptReason()); } private void createAndStartViewMediator() { mViewMediator = new KeyguardViewMediator( mContext, Loading