Loading services/java/com/android/server/power/DisplayPowerController.java +56 −54 Original line number Diff line number Diff line Loading @@ -610,7 +610,6 @@ final class DisplayPowerController { && mProximity == PROXIMITY_POSITIVE) { mScreenOffBecauseOfProximity = true; sendOnProximityPositiveWithWakelock(); setScreenOn(false); } } else if (mWaitingForNegativeProximity && mScreenOffBecauseOfProximity Loading Loading @@ -670,9 +669,12 @@ final class DisplayPowerController { mUsingScreenAutoBrightness = false; } // Animate the screen on or off. if (!mScreenOffBecauseOfProximity) { if (wantScreenOn(mPowerRequest.screenState)) { // Animate the screen on or off unless blocked. if (mScreenOffBecauseOfProximity) { // Screen off due to proximity. setScreenOn(false); unblockScreenOn(); } else if (wantScreenOn(mPowerRequest.screenState)) { // 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 @@ -710,6 +712,7 @@ final class DisplayPowerController { } 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 @@ -726,7 +729,6 @@ final class DisplayPowerController { } } } } // Report whether the display is ready for use. // We mostly care about the screen state here, ignoring brightness changes Loading Loading @@ -762,15 +764,15 @@ final class DisplayPowerController { 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/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/java/com/android/server/power/PowerManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1135,6 +1135,9 @@ public final class PowerManagerService extends IPowerManager.Stub 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/java/com/android/server/power/DisplayPowerController.java +56 −54 Original line number Diff line number Diff line Loading @@ -610,7 +610,6 @@ final class DisplayPowerController { && mProximity == PROXIMITY_POSITIVE) { mScreenOffBecauseOfProximity = true; sendOnProximityPositiveWithWakelock(); setScreenOn(false); } } else if (mWaitingForNegativeProximity && mScreenOffBecauseOfProximity Loading Loading @@ -670,9 +669,12 @@ final class DisplayPowerController { mUsingScreenAutoBrightness = false; } // Animate the screen on or off. if (!mScreenOffBecauseOfProximity) { if (wantScreenOn(mPowerRequest.screenState)) { // Animate the screen on or off unless blocked. if (mScreenOffBecauseOfProximity) { // Screen off due to proximity. setScreenOn(false); unblockScreenOn(); } else if (wantScreenOn(mPowerRequest.screenState)) { // 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 @@ -710,6 +712,7 @@ final class DisplayPowerController { } 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 @@ -726,7 +729,6 @@ final class DisplayPowerController { } } } } // Report whether the display is ready for use. // We mostly care about the screen state here, ignoring brightness changes Loading Loading @@ -762,15 +764,15 @@ final class DisplayPowerController { 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/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/java/com/android/server/power/PowerManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -1135,6 +1135,9 @@ public final class PowerManagerService extends IPowerManager.Stub 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