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

Be more explicit about initialization -- power manager never sends
screen update when first initializing, phone window manager retreives
current screen state and applies that itself when initializing.

Change-Id: I8294ed36d700e186c1637754df8c8183721c15dd
This commit is contained in:
Dianne Hackborn
2011-09-22 13:37:48 -07:00
parent e690f565fd
commit 400110902e
2 changed files with 47 additions and 23 deletions

View File

@ -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();

View File

@ -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;
}
}