diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2015-04-14 09:43:45 +0900 |
---|---|---|
committer | Jinsuk Kim <jinsukkim@google.com> | 2015-04-14 09:43:45 +0900 |
commit | 7b0cf6413218e5b5c549eea31733222fcffafabc (patch) | |
tree | 1e41a663f186d07ba8aff9309a68eede05c54c67 /services/core/java/com/android/server/hdmi | |
parent | 07e1967cfce129afd0db3beefde343fe59405dc5 (diff) | |
download | frameworks_base-7b0cf6413218e5b5c549eea31733222fcffafabc.zip frameworks_base-7b0cf6413218e5b5c549eea31733222fcffafabc.tar.gz frameworks_base-7b0cf6413218e5b5c549eea31733222fcffafabc.tar.bz2 |
CEC: Remove system audio on hotplug
System audio was not being immediately removed by polling mechanism
mechanism but was being checked three times in order to avoid accidental
polling failure. This came with a side effect of the system audio
not removed instantly even when the device is physically removed.
This CL relies on hotplug event to tell whether the device removal
should be done right away or has to wait for 3 polling intervals.
Bug: 20133405
Change-Id: I9dbd7a8b9e424d523d0c22e4cac19b341461b71e
Diffstat (limited to 'services/core/java/com/android/server/hdmi')
3 files changed, 19 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java index 4ac2b48..94f8dee 100644 --- a/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +++ b/services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java @@ -913,6 +913,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { } } + @ServiceThreadOnly + boolean isConnected(int portId) { + assertRunOnServiceThread(); + return mService.isConnected(portId); + } + private void notifyArcStatusToAudioService(boolean enabled) { // Note that we don't set any name to ARC. mService.getAudioManager().setWiredDeviceConnectionState( diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java index 49a96d8..2cbc1b9 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlService.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java @@ -780,6 +780,12 @@ public final class HdmiControlService extends SystemService { return false; } + @ServiceThreadOnly + boolean isConnected(int portId) { + assertRunOnServiceThread(); + return mCecController.isConnected(portId); + } + void runOnServiceThread(Runnable runnable) { mHandler.post(runnable); } diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java index a944a27..5f2d651 100644 --- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java +++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java @@ -156,10 +156,13 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction { int index = -1; while ((index = removed.nextSetBit(index + 1)) != -1) { if (index == Constants.ADDR_AUDIO_SYSTEM) { - ++mAvrStatusCount; - Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount); - if (mAvrStatusCount < AVR_COUNT_MAX) { - continue; + HdmiDeviceInfo avr = tv().getAvrDeviceInfo(); + if (avr != null && tv().isConnected(avr.getPortId())) { + ++mAvrStatusCount; + Slog.w(TAG, "Ack not returned from AVR. count: " + mAvrStatusCount); + if (mAvrStatusCount < AVR_COUNT_MAX) { + continue; + } } } Slog.v(TAG, "Remove device by hot-plug detection:" + index); |