Loading packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +8 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard */ @Override public void finish(boolean strongAuth, int targetUserId) { if (mFeatureFlags.isEnabled(Flags.PREVENT_BYPASS_KEYGUARD) && !mKeyguardStateController.canDismissLockScreen() && !strongAuth) { Log.e(TAG, "Tried to dismiss keyguard when lockscreen is not dismissible and user " + "was not authenticated with a primary security method " + "(pin/password/pattern)."); return; } // If there's a pending runnable because the user interacted with a widget // and we're leaving keyguard, then run it. boolean deferKeyguardDone = false; Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +5 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,11 @@ object Flags { @JvmField val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = true) /** Whether to inflate the bouncer view on a background thread. */ // TODO(b/273341787): Tracking Bug @JvmField val PREVENT_BYPASS_KEYGUARD = unreleasedFlag(230, "prevent_bypass_keyguard") // 300 - power menu // TODO(b/254512600): Tracking Bug @JvmField val POWER_MENU_LITE = releasedFlag(300, "power_menu_lite") Loading packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { .thenReturn(mKeyguardMessageAreaController); when(mKeyguardPasswordView.getWindowInsetsController()).thenReturn(mWindowInsetsController); when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(SecurityMode.PIN); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); mKeyguardPasswordViewController = new KeyguardPasswordViewController( (KeyguardPasswordView) mKeyguardPasswordView, mKeyguardUpdateMonitor, SecurityMode.Password, mLockPatternUtils, null, Loading Loading @@ -551,6 +552,22 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { assertThat(mKeyguardSecurityContainerController.willRunDismissFromKeyguard()).isFalse(); } @Test public void testSecurityCallbackFinish() { when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardUpdateMonitor.isUserUnlocked(0)).thenReturn(true); mKeyguardSecurityContainerController.finish(true, 0); verify(mViewMediatorCallback).keyguardDone(anyBoolean(), anyInt()); } @Test public void testSecurityCallbackFinish_cannotDismissLockScreenAndNotStrongAuth() { when(mFeatureFlags.isEnabled(Flags.PREVENT_BYPASS_KEYGUARD)).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false); mKeyguardSecurityContainerController.finish(false, 0); verify(mViewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()); } @Test public void testOnStartingToHide() { mKeyguardSecurityContainerController.onStartingToHide(); Loading Loading
packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +8 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard */ @Override public void finish(boolean strongAuth, int targetUserId) { if (mFeatureFlags.isEnabled(Flags.PREVENT_BYPASS_KEYGUARD) && !mKeyguardStateController.canDismissLockScreen() && !strongAuth) { Log.e(TAG, "Tried to dismiss keyguard when lockscreen is not dismissible and user " + "was not authenticated with a primary security method " + "(pin/password/pattern)."); return; } // If there's a pending runnable because the user interacted with a widget // and we're leaving keyguard, then run it. boolean deferKeyguardDone = false; Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +5 −0 Original line number Diff line number Diff line Loading @@ -235,6 +235,11 @@ object Flags { @JvmField val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = true) /** Whether to inflate the bouncer view on a background thread. */ // TODO(b/273341787): Tracking Bug @JvmField val PREVENT_BYPASS_KEYGUARD = unreleasedFlag(230, "prevent_bypass_keyguard") // 300 - power menu // TODO(b/254512600): Tracking Bug @JvmField val POWER_MENU_LITE = releasedFlag(300, "power_menu_lite") Loading
packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -196,6 +196,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { .thenReturn(mKeyguardMessageAreaController); when(mKeyguardPasswordView.getWindowInsetsController()).thenReturn(mWindowInsetsController); when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(SecurityMode.PIN); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); mKeyguardPasswordViewController = new KeyguardPasswordViewController( (KeyguardPasswordView) mKeyguardPasswordView, mKeyguardUpdateMonitor, SecurityMode.Password, mLockPatternUtils, null, Loading Loading @@ -551,6 +552,22 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { assertThat(mKeyguardSecurityContainerController.willRunDismissFromKeyguard()).isFalse(); } @Test public void testSecurityCallbackFinish() { when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardUpdateMonitor.isUserUnlocked(0)).thenReturn(true); mKeyguardSecurityContainerController.finish(true, 0); verify(mViewMediatorCallback).keyguardDone(anyBoolean(), anyInt()); } @Test public void testSecurityCallbackFinish_cannotDismissLockScreenAndNotStrongAuth() { when(mFeatureFlags.isEnabled(Flags.PREVENT_BYPASS_KEYGUARD)).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false); mKeyguardSecurityContainerController.finish(false, 0); verify(mViewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()); } @Test public void testOnStartingToHide() { mKeyguardSecurityContainerController.onStartingToHide(); Loading