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

Commit fb49cd95 authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Fix issue #5355844: PowerManager does not call screenTurningOn after boot."

parents 5840639f 40011090
Loading
Loading
Loading
Loading
+39 −21
Original line number Diff line number Diff line
@@ -716,6 +716,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {

        // Controls rotation and the like.
        initializeHdmiState();

        // Match current screen state.
        if (mPowerManager.isScreenOn()) {
            screenTurningOn(null);
        } else {
            screenTurnedOff(WindowManagerPolicy.OFF_BECAUSE_OF_USER);
        }
    }

    public void setInitialDisplaySize(int width, int height) {
@@ -2780,12 +2787,18 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    /** {@inheritDoc} */
    public void screenTurningOn(final ScreenOnListener screenOnListener) {
        EventLog.writeEvent(70000, 1);
        //Slog.i(TAG, "Screen turning on...");
        if (false) {
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Slog.i(TAG, "Screen turning on...", here);
        }
        if (screenOnListener != null) {
            mKeyguardMediator.onScreenTurnedOn(new KeyguardViewManager.ShowListener() {
                @Override public void onShown(IBinder windowToken) {
                    if (windowToken != null) {
                        try {
                        mWindowManager.waitForWindowDrawn(windowToken, new IRemoteCallback.Stub() {
                            mWindowManager.waitForWindowDrawn(windowToken,
                                    new IRemoteCallback.Stub() {
                                @Override public void sendResult(Bundle data) {
                                    Slog.i(TAG, "Lock screen displayed!");
                                    screenOnListener.onScreenOn();
@@ -2805,6 +2818,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    }
                }
            });
        } else {
            synchronized (mLock) {
                mScreenOnFully = true;
            }
        }
        synchronized (mLock) {
            mScreenOnEarly = true;
            updateOrientationListenerLp();
+8 −2
Original line number Diff line number Diff line
@@ -564,6 +564,7 @@ public class PowerManagerService extends IPowerManager.Stub
            // We make sure to start out with the screen on due to user activity.
            // (They did just boot their device, after all.)
            forceUserActivityLocked();
            mInitialized = true;
        }
    }

@@ -1330,6 +1331,13 @@ public class PowerManagerService extends IPowerManager.Stub
            // (And also do not send needless broadcasts about the screen.)
            return;
        }

        if (DEBUG_SCREEN_ON) {
            RuntimeException here = new RuntimeException("here");
            here.fillInStackTrace();
            Slog.i(TAG, "sendNotificationLocked: " + on, here);
        }

        if (!on) {
            mStillNeedSleepNotification = false;
        }
@@ -1845,8 +1853,6 @@ public class PowerManagerService extends IPowerManager.Stub
            mPowerState = (mPowerState & ~LIGHTS_MASK) | (newState & LIGHTS_MASK);

            updateNativePowerStateLocked();

            mInitialized = true;
        }
    }