Merge changes I5150d58a,If6c3edbf into tm-qpr-dev am: 56f76309da

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

Change-Id: Ib152fb4072bec704302ff2de6475263ab63391aa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Aaron Liu
2023-03-20 16:46:38 +00:00
committed by Automerger Merge Worker
3 changed files with 30 additions and 0 deletions

View File

@@ -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;

View File

@@ -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")

View File

@@ -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,
@@ -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();