Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eaa12913 authored by Beverly Tai's avatar Beverly Tai
Browse files

Revert "On device lockdown, always show the keyguard"

This reverts commit c851ef6d.

Reason for revert: b/300463732 regression
Bug: 300463732
Bug: 218495634

Change-Id: I314e5615b798487d9a965eaa0937905b65aa85fc
Merged-In: I314e5615b798487d9a965eaa0937905b65aa85fc
parent f0ebf508
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -768,13 +768,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
                }
            }
        }

        @Override
        public void onStrongAuthStateChanged(int userId) {
            if (mLockPatternUtils.isUserInLockdown(KeyguardUpdateMonitor.getCurrentUser())) {
                doKeyguardLocked(null);
            }
        }
    };

    ViewMediatorCallback mViewMediatorCallback = new ViewMediatorCallback() {
@@ -2159,9 +2152,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
     * Enable the keyguard if the settings are appropriate.
     */
    private void doKeyguardLocked(Bundle options) {
        // if another app is disabling us, don't show unless we're in lockdown mode
        if (!mExternallyEnabled
                && !mLockPatternUtils.isUserInLockdown(KeyguardUpdateMonitor.getCurrentUser())) {
        // if another app is disabling us, don't show
        if (!mExternallyEnabled) {
            if (DEBUG) Log.d(TAG, "doKeyguard: not showing because externally disabled");

            mNeedToReshowWhenReenabled = true;
+0 −25
Original line number Diff line number Diff line
@@ -157,8 +157,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
    private @Mock AuthController mAuthController;
    private @Mock ShadeExpansionStateManager mShadeExpansionStateManager;
    private @Mock ShadeWindowLogger mShadeWindowLogger;
    private @Captor ArgumentCaptor<KeyguardUpdateMonitorCallback>
            mKeyguardUpdateMonitorCallbackCaptor;
    private @Captor ArgumentCaptor<KeyguardStateController.Callback>
            mKeyguardStateControllerCallback;
    private DeviceConfigProxy mDeviceConfig = new DeviceConfigProxyFake();
@@ -205,25 +203,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        createAndStartViewMediator();
    }

    @Test
    @TestableLooper.RunWithLooper(setAsMainLooper = true)
    public void onLockdown_showKeyguard_evenIfKeyguardIsNotEnabledExternally() {
        // GIVEN keyguard is not enabled and isn't showing
        mViewMediator.onSystemReady();
        mViewMediator.setKeyguardEnabled(false);
        TestableLooper.get(this).processAllMessages();
        captureKeyguardUpdateMonitorCallback();
        assertFalse(mViewMediator.isShowingAndNotOccluded());

        // WHEN lockdown occurs
        when(mLockPatternUtils.isUserInLockdown(anyInt())).thenReturn(true);
        mKeyguardUpdateMonitorCallbackCaptor.getValue().onStrongAuthStateChanged(0);

        // THEN keyguard is shown
        TestableLooper.get(this).processAllMessages();
        assertTrue(mViewMediator.isShowingAndNotOccluded());
    }

    @Test
    public void testOnGoingToSleep_UpdatesKeyguardGoingAway() {
        mViewMediator.onStartedGoingToSleep(OFF_BECAUSE_OF_USER);
@@ -844,10 +823,6 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
        mViewMediator.registerCentralSurfaces(mCentralSurfaces, null, null, null, null, null);
    }

    private void captureKeyguardUpdateMonitorCallback() {
        verify(mUpdateMonitor).registerCallback(mKeyguardUpdateMonitorCallbackCaptor.capture());
    }

    private void captureKeyguardStateControllerCallback() {
        verify(mKeyguardStateController).addCallback(mKeyguardStateControllerCallback.capture());
    }