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

Commit fea784dd authored by Jim Miller's avatar Jim Miller Committed by Android (Google) Code Review
Browse files

Merge "Fix bug where dismiss() was being called from the wrong thread" into klp-dev

parents 8c5b15c6 6001379b
Loading
Loading
Loading
Loading
+24 −18
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ public class KeyguardViewMediator {
    private static final int SHOW_ASSISTANT = 14;
    private static final int DISPATCH_EVENT = 15;
    private static final int LAUNCH_CAMERA = 16;
    private static final int DISMISS = 17;

    /**
     * The default amount of time we stay awake (used for all key input)
@@ -910,12 +911,16 @@ public class KeyguardViewMediator {
    /**
     * Dismiss the keyguard through the security layers.
     */
    public void dismiss() {
    public void handleDismiss() {
        if (mShowing && !mHidden) {
            mKeyguardViewManager.dismiss();
        }
    }

    public void dismiss() {
        mHandler.sendEmptyMessage(DISMISS);
    }

    /**
     * Send message to keyguard telling it to reset its state.
     * @param options options about how to show the keyguard
@@ -1014,14 +1019,13 @@ public class KeyguardViewMediator {
    };

    public void keyguardDone(boolean authenticated, boolean wakeup) {
        mKeyguardDonePending = false;
        synchronized (this) {
            EventLog.writeEvent(70000, 2);
        if (DEBUG) Log.d(TAG, "keyguardDone(" + authenticated + ")");
            Message msg = mHandler.obtainMessage(KEYGUARD_DONE, authenticated ? 1 : 0,
                    wakeup ? 1 : 0);
            mHandler.sendMessage(msg);
        EventLog.writeEvent(70000, 2);
        synchronized (this) {
            mKeyguardDonePending = false;
        }
        Message msg = mHandler.obtainMessage(KEYGUARD_DONE, authenticated ? 1 : 0, wakeup ? 1 : 0);
        mHandler.sendMessage(msg);
    }

    /**
@@ -1037,31 +1041,31 @@ public class KeyguardViewMediator {
            switch (msg.what) {
                case SHOW:
                    handleShow((Bundle) msg.obj);
                    return ;
                    break;
                case HIDE:
                    handleHide();
                    return ;
                    break;
                case RESET:
                    handleReset((Bundle) msg.obj);
                    return ;
                    break;
                case VERIFY_UNLOCK:
                    handleVerifyUnlock();
                    return;
                    break;
                case NOTIFY_SCREEN_OFF:
                    handleNotifyScreenOff();
                    return;
                    break;
                case NOTIFY_SCREEN_ON:
                    handleNotifyScreenOn((IKeyguardShowCallback) msg.obj);
                    return;
                    break;
                case KEYGUARD_DONE:
                    handleKeyguardDone(msg.arg1 != 0, msg.arg2 != 0);
                    return;
                    break;
                case KEYGUARD_DONE_DRAWING:
                    handleKeyguardDoneDrawing();
                    return;
                    break;
                case KEYGUARD_DONE_AUTHENTICATING:
                    keyguardDone(true, true);
                    return;
                    break;
                case SET_HIDDEN:
                    handleSetHidden(msg.arg1 != 0);
                    break;
@@ -1079,6 +1083,9 @@ public class KeyguardViewMediator {
                case LAUNCH_CAMERA:
                    handleLaunchCamera();
                    break;
                case DISMISS:
                    handleDismiss();
                    break;
            }
        }
    };
@@ -1178,8 +1185,7 @@ public class KeyguardViewMediator {

    private void updateActivityLockScreenState() {
        try {
            ActivityManagerNative.getDefault().setLockScreenShown(
                    mShowing && !mHidden);
            ActivityManagerNative.getDefault().setLockScreenShown(mShowing && !mHidden);
        } catch (RemoteException e) {
        }
    }