diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2015-04-20 13:17:13 +0900 |
---|---|---|
committer | Jinsuk Kim <jinsukkim@google.com> | 2015-04-21 06:56:04 +0900 |
commit | 7e4b480a0bf9f93a428f7c46bfea77ebfdb92d40 (patch) | |
tree | 34537e6d28d0c409a4f6e753c82e6497e9f0c41f /services/core/java/com/android/server/hdmi | |
parent | 341cba2ae6b1c62a418d693ccd27ef3452e76739 (diff) | |
download | frameworks_base-7e4b480a0bf9f93a428f7c46bfea77ebfdb92d40.zip frameworks_base-7e4b480a0bf9f93a428f7c46bfea77ebfdb92d40.tar.gz frameworks_base-7e4b480a0bf9f93a428f7c46bfea77ebfdb92d40.tar.bz2 |
CEC: Prevent premature standby process completion
Handles the situation where standby is prematurely completed
by handleTerminateArc initiated in HdmiCecLocalDeviceTv.disableDevice().
Power status is now checked to stop the flow before removing
RequestArcTerminateAction which can call mPendingActionClearedCallback.
Also Make sure mPendingActionClearedCallback is set to null at the beginning
so that disable callback is not invoked unintentionally in
HdmiCecLocalDevice.checkIfPendingActionsCleared() which is supposed to work
at standby process only. It is now invoked by handleDisableDeviceTimeout
to make sure standby process is completed with PendingActionClearedCallback
at HdmiControlService.onStandby().
Bug: 20159835, Bug: 19930352
Change-Id: Iac29dfb6acff76182ff4e9563edc611406c23f3c
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java | 10 | ||||
-rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java index b24bc65..8031c05 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDevice.java @@ -176,6 +176,7 @@ abstract class HdmiCecLocalDevice { void init() { assertRunOnServiceThread(); mPreferredAddress = getPreferredAddress(); + mPendingActionClearedCallback = null; } /** @@ -837,16 +838,16 @@ abstract class HdmiCecLocalDevice { * * @param initiatedByCec true if this sequence is initiated * by the reception the CEC messages like <Standby> - * @param origialCallback callback interface to get notified when all pending actions are + * @param originalCallback callback interface to get notified when all pending actions are * cleared */ protected void disableDevice(boolean initiatedByCec, - final PendingActionClearedCallback origialCallback) { + final PendingActionClearedCallback originalCallback) { mPendingActionClearedCallback = new PendingActionClearedCallback() { @Override public void onCleared(HdmiCecLocalDevice device) { mHandler.removeMessages(MSG_DISABLE_DEVICE_TIMEOUT); - origialCallback.onCleared(device); + originalCallback.onCleared(device); } }; mHandler.sendMessageDelayed(Message.obtain(mHandler, MSG_DISABLE_DEVICE_TIMEOUT), @@ -865,6 +866,9 @@ abstract class HdmiCecLocalDevice { action.finish(false); iter.remove(); } + if (mPendingActionClearedCallback != null) { + mPendingActionClearedCallback.onCleared(this); + } } /** diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 94f8dee..c4f410f 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -1109,11 +1109,13 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { @ServiceThreadOnly protected boolean handleTerminateArc(HdmiCecMessage message) { assertRunOnServiceThread(); - // In cast of termination, do not check ARC configuration in that AVR device - // might be removed already. - - // In case where <Terminate Arc> is started by <Request ARC Termination> - // need to clean up RequestArcInitiationAction. + if (mService .isPowerStandbyOrTransient()) { + setArcStatus(false); + return true; + } + // Do not check ARC configuration since the AVR might have been already removed. + // Clean up RequestArcTerminationAction in case <Terminate Arc> was started by + // <Request ARC Termination>. removeAction(RequestArcTerminationAction.class); SetArcTransmissionStateAction action = new SetArcTransmissionStateAction(this, message.getSource(), false); |