Don't reset mPendingPinLock on keyguardGoingAway

Only reset mPendingPinLock on primary bouncer changes
if the primary bouncer is about to show and the keyguard
is NOT going away.

Test: atest KeyguardViewMediatorTest
Fixes: 285023830
Change-Id: I85c5b51b989211a85d309630b9474536da856048
This commit is contained in:
Beverly
2023-06-14 17:04:18 +00:00
committed by Beverly Tai
parent 57b293ef31
commit 6190b8a7bc
2 changed files with 35 additions and 1 deletions

View File

@@ -1201,7 +1201,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
@Override
public void onPrimaryBouncerShowingChanged() {
synchronized (KeyguardViewMediator.this) {
if (mKeyguardStateController.isPrimaryBouncerShowing()) {
if (mKeyguardStateController.isPrimaryBouncerShowing()
&& !mKeyguardStateController.isKeyguardGoingAway()) {
mPendingPinLock = false;
}
adjustStatusBarLocked(mKeyguardStateController.isPrimaryBouncerShowing(), false);

View File

@@ -148,6 +148,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
private @Mock ShadeWindowLogger mShadeWindowLogger;
private @Captor ArgumentCaptor<KeyguardUpdateMonitorCallback>
mKeyguardUpdateMonitorCallbackCaptor;
private @Captor ArgumentCaptor<KeyguardStateController.Callback>
mKeyguardStateControllerCallback;
private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake();
private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock());
@@ -595,6 +597,33 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
);
}
@Test
@TestableLooper.RunWithLooper(setAsMainLooper = true)
public void pendingPinLockOnKeyguardGoingAway_doKeyguardLockedOnKeyguardVisibilityChanged() {
// GIVEN SIM_STATE_PIN_REQUIRED
mViewMediator.onSystemReady();
final KeyguardUpdateMonitorCallback keyguardUpdateMonitorCallback =
mViewMediator.mUpdateCallback;
keyguardUpdateMonitorCallback.onSimStateChanged(0, 0,
TelephonyManager.SIM_STATE_PIN_REQUIRED);
TestableLooper.get(this).processAllMessages();
// ...and then the primary bouncer shows while the keyguard is going away
captureKeyguardStateControllerCallback();
when(mKeyguardStateController.isPrimaryBouncerShowing()).thenReturn(true);
when(mKeyguardStateController.isKeyguardGoingAway()).thenReturn(true);
mKeyguardStateControllerCallback.getValue().onPrimaryBouncerShowingChanged();
TestableLooper.get(this).processAllMessages();
// WHEN keyguard visibility becomes FALSE
mViewMediator.setShowingLocked(false);
keyguardUpdateMonitorCallback.onKeyguardVisibilityChanged(false);
TestableLooper.get(this).processAllMessages();
// THEN keyguard shows due to the pending SIM PIN lock
assertTrue(mViewMediator.isShowingAndNotOccluded());
}
private void createAndStartViewMediator() {
mViewMediator = new KeyguardViewMediator(
mContext,
@@ -638,4 +667,8 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
private void captureKeyguardUpdateMonitorCallback() {
verify(mUpdateMonitor).registerCallback(mKeyguardUpdateMonitorCallbackCaptor.capture());
}
private void captureKeyguardStateControllerCallback() {
verify(mKeyguardStateController).addCallback(mKeyguardStateControllerCallback.capture());
}
}