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

Commit 904732c4 authored by Craig Mautner's avatar Craig Mautner
Browse files

Call requestFocus and ensure that screenOn is set.

When maybeCreateKeyguardLocked was called from methods other than
show(), the requestFocus() call on the new KeyguardHostView was
never made.

At boot time the screen on notification was not propagated to
KeyguardViewManager because the showListener callback was null.
This passes on the notification but does not make the callback
if it is null.

Bug: 7299119 fixed.
Change-Id: Iaf058954473dc63fe4864ab1f435db4463b1110e
parent e13ae648
Loading
Loading
Loading
Loading
+22 −18
Original line number Original line Diff line number Diff line
@@ -43,7 +43,7 @@ import com.android.internal.widget.LockPatternUtils;


/**
/**
 * Manages creating, showing, hiding and resetting the keyguard.  Calls back
 * Manages creating, showing, hiding and resetting the keyguard.  Calls back
 * via {@link com.android.internal.policy.impl.KeyguardViewCallback} to poke
 * via {@link KeyguardViewMediator.ViewMediatorCallback} to poke
 * the wake lock and report that the keyguard is done, which is in turn,
 * the wake lock and report that the keyguard is done, which is in turn,
 * reported to this class by the current {@link KeyguardViewBase}.
 * reported to this class by the current {@link KeyguardViewBase}.
 */
 */
@@ -233,6 +233,7 @@ public class KeyguardViewManager {


        if (mScreenOn) {
        if (mScreenOn) {
            mKeyguardView.show();
            mKeyguardView.show();
            mKeyguardView.requestFocus();
        }
        }
    }
    }


@@ -314,10 +315,12 @@ public class KeyguardViewManager {


            // Caller should wait for this window to be shown before turning
            // Caller should wait for this window to be shown before turning
            // on the screen.
            // on the screen.
            if (showListener != null) {
                if (mKeyguardHost.getVisibility() == View.VISIBLE) {
                if (mKeyguardHost.getVisibility() == View.VISIBLE) {
                    // Keyguard may be in the process of being shown, but not yet
                    // Keyguard may be in the process of being shown, but not yet
                    // updated with the window manager...  give it a chance to do so.
                    // updated with the window manager...  give it a chance to do so.
                    mKeyguardHost.post(new Runnable() {
                    mKeyguardHost.post(new Runnable() {
                        @Override
                        public void run() {
                        public void run() {
                            if (mKeyguardHost.getVisibility() == View.VISIBLE) {
                            if (mKeyguardHost.getVisibility() == View.VISIBLE) {
                                showListener.onShown(mKeyguardHost.getWindowToken());
                                showListener.onShown(mKeyguardHost.getWindowToken());
@@ -329,7 +332,8 @@ public class KeyguardViewManager {
                } else {
                } else {
                    showListener.onShown(null);
                    showListener.onShown(null);
                }
                }
        } else {
            }
        } else if (showListener != null) {
            showListener.onShown(null);
            showListener.onShown(null);
        }
        }
    }
    }
@@ -356,11 +360,10 @@ public class KeyguardViewManager {
        if (mKeyguardView != null) {
        if (mKeyguardView != null) {
            mKeyguardView.wakeWhenReadyTq(keyCode);
            mKeyguardView.wakeWhenReadyTq(keyCode);
            return true;
            return true;
        } else {
        }
        Log.w(TAG, "mKeyguardView is null in wakeWhenReadyTq");
        Log.w(TAG, "mKeyguardView is null in wakeWhenReadyTq");
        return false;
        return false;
    }
    }
    }


    /**
    /**
     * Hides the keyguard view
     * Hides the keyguard view
@@ -382,6 +385,7 @@ public class KeyguardViewManager {
                final KeyguardViewBase lastView = mKeyguardView;
                final KeyguardViewBase lastView = mKeyguardView;
                mKeyguardView = null;
                mKeyguardView = null;
                mKeyguardHost.postDelayed(new Runnable() {
                mKeyguardHost.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                    public void run() {
                        synchronized (KeyguardViewManager.this) {
                        synchronized (KeyguardViewManager.this) {
                            lastView.cleanUp();
                            lastView.cleanUp();
+2 −4
Original line number Original line Diff line number Diff line
@@ -629,10 +629,8 @@ public class KeyguardViewMediator {
            mScreenOn = true;
            mScreenOn = true;
            cancelDoKeyguardLaterLocked();
            cancelDoKeyguardLaterLocked();
            if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence);
            if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence);
            if (showListener != null) {
            notifyScreenOnLocked(showListener);
            notifyScreenOnLocked(showListener);
        }
        }
        }
        maybeSendUserPresentBroadcast();
        maybeSendUserPresentBroadcast();
    }
    }


@@ -1365,7 +1363,7 @@ public class KeyguardViewMediator {


    /**
    /**
     * Handle message sent by {@link #verifyUnlock}
     * Handle message sent by {@link #verifyUnlock}
     * @see #RESET
     * @see #VERIFY_UNLOCK
     */
     */
    private void handleVerifyUnlock() {
    private void handleVerifyUnlock() {
        synchronized (KeyguardViewMediator.this) {
        synchronized (KeyguardViewMediator.this) {