diff options
author | Rupesh Bansal <brup@google.com> | 2023-01-07 02:01:21 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-01-07 02:01:21 +0000 |
commit | 3284b2ae23c025a73f5e45b166e5d10ea4ef8162 (patch) | |
tree | 0258059af0f0a83ff23293ab1afb0980cbd59c4f | |
parent | b1f85974bcf5da55a833ebb3296eff73aa53f469 (diff) | |
parent | c16b2af4a22656ff72ba9a6a31acc8e146feb5b4 (diff) | |
download | base-3284b2ae23c025a73f5e45b166e5d10ea4ef8162.tar.gz |
Merge "Setting the display state to off when the default display is being changed" into tm-qpr-dev
-rw-r--r-- | services/core/java/com/android/server/display/DisplayPowerController.java | 4 | ||||
-rw-r--r-- | services/core/java/com/android/server/display/DisplayPowerState.java | 14 |
2 files changed, 13 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java index b43d830e7935..d6e78a195be4 100644 --- a/services/core/java/com/android/server/display/DisplayPowerController.java +++ b/services/core/java/com/android/server/display/DisplayPowerController.java @@ -818,8 +818,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call loadFromDisplayDeviceConfig(token, info); // Since the underlying display-device changed, we really don't know the - // last command that was sent to change it's state. Lets assume it is unknown so - // that we trigger a change immediately. + // last command that was sent to change it's state. Lets assume it is off and we + // trigger a change immediately. mPowerState.resetScreenState(); } if (mIsEnabled != isEnabled || mIsInTransition != isInTransition) { diff --git a/services/core/java/com/android/server/display/DisplayPowerState.java b/services/core/java/com/android/server/display/DisplayPowerState.java index f650b118b815..7d1396d7e413 100644 --- a/services/core/java/com/android/server/display/DisplayPowerState.java +++ b/services/core/java/com/android/server/display/DisplayPowerState.java @@ -340,12 +340,20 @@ final class DisplayPowerState { } /** - * Resets the screen state to unknown. Useful when the underlying display-device changes for the - * LogicalDisplay and we do not know the last state that was sent to it. + * Resets the screen state to {@link Display#STATE_OFF}. Even though we do not know the last + * state that was sent to the underlying display-device, we assume it is off. + * + * We do not set the screen state to {@link Display#STATE_UNKNOWN} to avoid getting in the state + * where PhotonicModulator holds onto the lock. This happens because we currently try to keep + * the mScreenState and mPendingState in sync, however if the screenState is set to + * {@link Display#STATE_UNKNOWN} here, mPendingState will get progressed to this, which will + * force the PhotonicModulator thread to wait onto the lock to take it out of that state. + * b/262294651 for more info. */ void resetScreenState() { - mScreenState = Display.STATE_UNKNOWN; + mScreenState = Display.STATE_OFF; mScreenReady = false; + scheduleScreenUpdate(); } private void scheduleScreenUpdate() { |