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

Commit 5e44f848 authored by Darrell Shi's avatar Darrell Shi Committed by Android (Google) Code Review
Browse files

Merge "Allow keyguard to be locked while dreaming" into main

parents 14c68466 aaa4abf1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2104,6 +2104,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, CoreSt
    private void handleDreamingStateChanged(int dreamStart) {
        Assert.isMainThread();
        mIsDreaming = dreamStart == 1;

        // Allow keyguard to be locked once dream starts.
        if (mIsDreaming) {
            setForceIsDismissibleKeyguard(false);
        }

        for (int i = 0; i < mCallbacks.size(); i++) {
            KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
            if (cb != null) {
+8 −0
Original line number Diff line number Diff line
@@ -2469,6 +2469,14 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
        Assert.assertFalse(mKeyguardUpdateMonitor.forceIsDismissibleIsKeepingDeviceUnlocked());
    }

    @Test
    public void forceIsDismissibleKeyguard_respectsDream() {
        mKeyguardUpdateMonitor.tryForceIsDismissibleKeyguard();
        mKeyguardUpdateMonitor.dispatchDreamingStarted();
        mTestableLooper.processAllMessages();
        Assert.assertFalse(mKeyguardUpdateMonitor.forceIsDismissibleIsKeepingDeviceUnlocked());
    }

    private Intent defaultSimStateChangedIntent() {
        Intent intent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, 0);