Merge changes I5150d58a,If6c3edbf into tm-qpr-dev
* changes: Prevent keyguard from dismissing if not... Add flag to prevent keyguard bypass
This commit is contained in:
@@ -260,6 +260,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void finish(boolean strongAuth, int targetUserId) {
|
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
|
// If there's a pending runnable because the user interacted with a widget
|
||||||
// and we're leaving keyguard, then run it.
|
// and we're leaving keyguard, then run it.
|
||||||
boolean deferKeyguardDone = false;
|
boolean deferKeyguardDone = false;
|
||||||
|
|||||||
@@ -235,6 +235,11 @@ object Flags {
|
|||||||
@JvmField
|
@JvmField
|
||||||
val ASYNC_INFLATE_BOUNCER = unreleasedFlag(229, "async_inflate_bouncer", teamfood = true)
|
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
|
// 300 - power menu
|
||||||
// TODO(b/254512600): Tracking Bug
|
// TODO(b/254512600): Tracking Bug
|
||||||
@JvmField val POWER_MENU_LITE = releasedFlag(300, "power_menu_lite")
|
@JvmField val POWER_MENU_LITE = releasedFlag(300, "power_menu_lite")
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
.thenReturn(mKeyguardMessageAreaController);
|
.thenReturn(mKeyguardMessageAreaController);
|
||||||
when(mKeyguardPasswordView.getWindowInsetsController()).thenReturn(mWindowInsetsController);
|
when(mKeyguardPasswordView.getWindowInsetsController()).thenReturn(mWindowInsetsController);
|
||||||
when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(SecurityMode.PIN);
|
when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn(SecurityMode.PIN);
|
||||||
|
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||||
mKeyguardPasswordViewController = new KeyguardPasswordViewController(
|
mKeyguardPasswordViewController = new KeyguardPasswordViewController(
|
||||||
(KeyguardPasswordView) mKeyguardPasswordView, mKeyguardUpdateMonitor,
|
(KeyguardPasswordView) mKeyguardPasswordView, mKeyguardUpdateMonitor,
|
||||||
SecurityMode.Password, mLockPatternUtils, null,
|
SecurityMode.Password, mLockPatternUtils, null,
|
||||||
@@ -551,6 +552,22 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
|
|||||||
assertThat(mKeyguardSecurityContainerController.willRunDismissFromKeyguard()).isFalse();
|
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
|
@Test
|
||||||
public void testOnStartingToHide() {
|
public void testOnStartingToHide() {
|
||||||
mKeyguardSecurityContainerController.onStartingToHide();
|
mKeyguardSecurityContainerController.onStartingToHide();
|
||||||
|
|||||||
Reference in New Issue
Block a user