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

Commit 4e8a19c7 authored by Craig Mautner's avatar Craig Mautner
Browse files

Remove overly tight constraint on drawn Keyguard.

The requirement that a window that is invisible will not be drawn is
incorrect. In particular the test fails before a surface has even been
added (mHasSurface == false) or shown (mPolicyVisibility == false).
This was causing the screen to turn on before Keyguard had been drawn
and exposing surfaces that would have normally remained hidden.

Also, don't pass null into KeyguardServiceDelegate.onShown() or we
will immediately turn the screen on before Keyguard is drawn.

Fixes bug 11062635.

Change-Id: I964c7ef186d0a94678020b9c27ca6b79e5433350
parent 5dadf838
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -420,6 +420,7 @@ public class KeyguardViewManager {
    public synchronized void onScreenTurnedOn(final IKeyguardShowCallback callback) {
        if (DEBUG) Log.d(TAG, "onScreenTurnedOn()");
        mScreenOn = true;
        final IBinder token = mKeyguardHost == null ? null : mKeyguardHost.getWindowToken();
        if (mKeyguardView != null) {
            mKeyguardView.onScreenTurnedOn();

@@ -432,10 +433,6 @@ public class KeyguardViewManager {
                    mKeyguardHost.post(new Runnable() {
                        @Override
                        public void run() {
                            IBinder token = null;
                            if (mKeyguardHost.getVisibility() == View.VISIBLE) {
                                token = mKeyguardHost.getWindowToken();
                            }
                            try {
                                callback.onShown(token);
                            } catch (RemoteException e) {
@@ -445,7 +442,7 @@ public class KeyguardViewManager {
                    });
                } else {
                    try {
                        callback.onShown(null);
                        callback.onShown(token);
                    } catch (RemoteException e) {
                        Slog.w(TAG, "Exception calling onShown():", e);
                    }
@@ -453,7 +450,7 @@ public class KeyguardViewManager {
            }
        } else if (callback != null) {
            try {
                callback.onShown(null);
                callback.onShown(token);
            } catch (RemoteException e) {
                Slog.w(TAG, "Exception calling onShown():", e);
            }
+3 −1
Original line number Diff line number Diff line
@@ -4275,12 +4275,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                })) {
                    return;
                }
                Slog.i(TAG, "No lock screen! waitForWindowDrawn false");

            } catch (RemoteException ex) {
                // Can't happen in system process.
            }
        }

        Slog.i(TAG, "No lock screen!");
        Slog.i(TAG, "No lock screen! windowToken=" + windowToken);
        finishScreenTurningOn(screenOnListener);
    }

+3 −3
Original line number Diff line number Diff line
@@ -9468,9 +9468,8 @@ public class WindowManagerService extends IWindowManager.Stub
                //Slog.i(TAG, "Waiting for drawn " + win + ": removed="
                //        + win.mRemoved + " visible=" + win.isVisibleLw()
                //        + " shown=" + win.mSurfaceShown);
                if (win.mRemoved || !win.isVisibleLw()) {
                    // Window has been removed or made invisible; no draw
                    // will now happen, so stop waiting.
                if (win.mRemoved) {
                    // Window has been removed; no draw will now happen, so stop waiting.
                    Slog.w(TAG, "Aborted waiting for drawn: " + pair.first);
                    try {
                        pair.second.sendResult(null);
@@ -9505,6 +9504,7 @@ public class WindowManagerService extends IWindowManager.Stub
                    checkDrawnWindowsLocked();
                    return true;
                }
                Slog.i(TAG, "waitForWindowDrawn: win null");
            }
        }
        return false;