diff options
| author | 2021-10-27 09:47:19 +0000 | |
|---|---|---|
| committer | 2021-10-27 09:47:19 +0000 | |
| commit | 90bf16877c3a4409ad2729ca5165765c32efa013 (patch) | |
| tree | ca6226258ecbe18eb006cc2ff31c27e33a265662 | |
| parent | bd7aec979fa47d92e67c7b8881d5bd73dfefdfe5 (diff) | |
| parent | 0da8f446edfe7ab5951f26d9302349ba581544a5 (diff) | |
Merge "Clear pending actions on local device on wakeup." am: c680c7efed am: 9ea8453e12 am: 5f14e32d17 am: 0da8f446ed
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684647
Change-Id: I2081432c8c186cdd6dd5c4b1c8b722f8338cb9b3
| -rwxr-xr-x | services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java | 6 | ||||
| -rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiControlService.java | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java index a2cb78d27a57..c27293c3cc09 100755 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java @@ -209,6 +209,12 @@ abstract class HdmiCecLocalDevice { void init() { assertRunOnServiceThread(); mPreferredAddress = getPreferredAddress(); + if (mHandler.hasMessages(MSG_DISABLE_DEVICE_TIMEOUT)) { + // Remove and trigger the queued message for clearing all actions when going to standby. + // This is necessary because the device may wake up before the message is triggered. + mHandler.removeMessages(MSG_DISABLE_DEVICE_TIMEOUT); + handleDisableDeviceTimeout(); + } mPendingActionClearedCallback = null; } diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index e5a8a17df525..a571dc06db97 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -3131,7 +3131,7 @@ public class HdmiControlService extends SystemService { Slog.v(TAG, "On standby-action cleared:" + device.mDeviceType); devices.remove(device); if (devices.isEmpty()) { - onStandbyCompleted(standbyAction); + onPendingActionsCleared(standbyAction); // We will not clear local devices here, since some OEM/SOC will keep passing // the received packets until the application processor enters to the sleep // actually. @@ -3193,10 +3193,17 @@ public class HdmiControlService extends SystemService { mHdmiCecNetwork.clearLocalDevices(); } + /** + * Normally called after all devices have cleared their pending actions, to execute the final + * phase of the standby flow. + * + * This can also be called during wakeup, when pending actions are cleared after failing to be + * cleared during standby. In this case, it does not execute the standby flow. + */ @ServiceThreadOnly - private void onStandbyCompleted(int standbyAction) { + private void onPendingActionsCleared(int standbyAction) { assertRunOnServiceThread(); - Slog.v(TAG, "onStandbyCompleted"); + Slog.v(TAG, "onPendingActionsCleared"); if (!mPowerStatusController.isPowerStatusTransientToStandby()) { return; |