Loading services/core/java/com/android/server/power/DisplayPowerController.java +56 −54 Original line number Diff line number Diff line Loading @@ -479,7 +479,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call && mProximity == PROXIMITY_POSITIVE) { mScreenOffBecauseOfProximity = true; sendOnProximityPositiveWithWakelock(); setScreenOn(false); } } else if (mWaitingForNegativeProximity && mScreenOffBecauseOfProximity Loading Loading @@ -544,9 +543,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mUsingScreenAutoBrightness = false; } // Animate the screen on or off. if (!mScreenOffBecauseOfProximity) { if (mPowerRequest.wantScreenOnAny()) { // Animate the screen on or off unless blocked. if (mScreenOffBecauseOfProximity) { // Screen off due to proximity. setScreenOn(false); unblockScreenOn(); } else if (mPowerRequest.wantScreenOnAny()) { // Want screen on. // Wait for previous off animation to complete beforehand. // It is relatively short but if we cancel it and switch to the Loading Loading @@ -584,6 +586,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } else { // Want screen off. // Wait for previous on animation to complete beforehand. unblockScreenOn(); if (!mElectronBeamOnAnimator.isStarted()) { if (!mElectronBeamOffAnimator.isStarted()) { if (mPowerState.getElectronBeamLevel() == 0.0f) { Loading @@ -600,7 +603,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } } } } // Report whether the display is ready for use. // We mostly care about the screen state here, ignoring brightness changes Loading Loading @@ -641,15 +643,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private void unblockScreenOn() { if (mScreenOnWasBlocked) { mScreenOnWasBlocked = false; if (DEBUG) { Slog.d(TAG, "Unblocked screen on after " + (SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime) + " ms"); long delay = SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime; if (delay > 1000 || DEBUG) { Slog.d(TAG, "Unblocked screen on after " + delay + " ms"); } } } private void setScreenOn(boolean on) { if (!mPowerState.isScreenOn() == on) { if (mPowerState.isScreenOn() != on) { mPowerState.setScreenOn(on); if (on) { mNotifier.onScreenOn(); Loading services/core/java/com/android/server/power/DisplayPowerState.java +8 −1 Original line number Diff line number Diff line Loading @@ -304,8 +304,15 @@ final class DisplayPowerState { int brightness = mScreenOn && mElectronBeamLevel > 0f ? mScreenBrightness : 0; if (mPhotonicModulator.setState(mScreenOn, brightness)) { if (DEBUG) { Slog.d(TAG, "Screen ready"); } mScreenReady = true; invokeCleanListenerIfNeeded(); } else { if (DEBUG) { Slog.d(TAG, "Screen not ready"); } } } }; Loading Loading @@ -355,7 +362,7 @@ final class DisplayPowerState { AsyncTask.THREAD_POOL_EXECUTOR.execute(mTask); } } return mChangeInProgress; return !mChangeInProgress; } } Loading services/core/java/com/android/server/power/PowerManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,9 @@ public final class PowerManagerService extends com.android.server.SystemService if (!mSystemReady || mDirty == 0) { return; } if (!Thread.holdsLock(mLock)) { Slog.wtf(TAG, "Power manager lock was not held when calling updatePowerStateLocked"); } // Phase 0: Basic state updates. updateIsPoweredLocked(mDirty); Loading Loading
services/core/java/com/android/server/power/DisplayPowerController.java +56 −54 Original line number Diff line number Diff line Loading @@ -479,7 +479,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call && mProximity == PROXIMITY_POSITIVE) { mScreenOffBecauseOfProximity = true; sendOnProximityPositiveWithWakelock(); setScreenOn(false); } } else if (mWaitingForNegativeProximity && mScreenOffBecauseOfProximity Loading Loading @@ -544,9 +543,12 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mUsingScreenAutoBrightness = false; } // Animate the screen on or off. if (!mScreenOffBecauseOfProximity) { if (mPowerRequest.wantScreenOnAny()) { // Animate the screen on or off unless blocked. if (mScreenOffBecauseOfProximity) { // Screen off due to proximity. setScreenOn(false); unblockScreenOn(); } else if (mPowerRequest.wantScreenOnAny()) { // Want screen on. // Wait for previous off animation to complete beforehand. // It is relatively short but if we cancel it and switch to the Loading Loading @@ -584,6 +586,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } else { // Want screen off. // Wait for previous on animation to complete beforehand. unblockScreenOn(); if (!mElectronBeamOnAnimator.isStarted()) { if (!mElectronBeamOffAnimator.isStarted()) { if (mPowerState.getElectronBeamLevel() == 0.0f) { Loading @@ -600,7 +603,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call } } } } // Report whether the display is ready for use. // We mostly care about the screen state here, ignoring brightness changes Loading Loading @@ -641,15 +643,15 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call private void unblockScreenOn() { if (mScreenOnWasBlocked) { mScreenOnWasBlocked = false; if (DEBUG) { Slog.d(TAG, "Unblocked screen on after " + (SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime) + " ms"); long delay = SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime; if (delay > 1000 || DEBUG) { Slog.d(TAG, "Unblocked screen on after " + delay + " ms"); } } } private void setScreenOn(boolean on) { if (!mPowerState.isScreenOn() == on) { if (mPowerState.isScreenOn() != on) { mPowerState.setScreenOn(on); if (on) { mNotifier.onScreenOn(); Loading
services/core/java/com/android/server/power/DisplayPowerState.java +8 −1 Original line number Diff line number Diff line Loading @@ -304,8 +304,15 @@ final class DisplayPowerState { int brightness = mScreenOn && mElectronBeamLevel > 0f ? mScreenBrightness : 0; if (mPhotonicModulator.setState(mScreenOn, brightness)) { if (DEBUG) { Slog.d(TAG, "Screen ready"); } mScreenReady = true; invokeCleanListenerIfNeeded(); } else { if (DEBUG) { Slog.d(TAG, "Screen not ready"); } } } }; Loading Loading @@ -355,7 +362,7 @@ final class DisplayPowerState { AsyncTask.THREAD_POOL_EXECUTOR.execute(mTask); } } return mChangeInProgress; return !mChangeInProgress; } } Loading
services/core/java/com/android/server/power/PowerManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1047,6 +1047,9 @@ public final class PowerManagerService extends com.android.server.SystemService if (!mSystemReady || mDirty == 0) { return; } if (!Thread.holdsLock(mLock)) { Slog.wtf(TAG, "Power manager lock was not held when calling updatePowerStateLocked"); } // Phase 0: Basic state updates. updateIsPoweredLocked(mDirty); Loading