diff options
author | Jinsuk Kim <jinsukkim@google.com> | 2015-01-29 07:01:16 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-29 07:01:16 +0000 |
commit | b3bae9dc1a649eb326d17c2035c0f567b797edf3 (patch) | |
tree | 598e5a244f0724063d0a35599a60224ad064977e | |
parent | 6da2c666d258a0ac3d65b867d7443a3e3f8cded0 (diff) | |
parent | a6a01787fb657189202dec096c30b3d2f63197dc (diff) | |
download | frameworks_base-b3bae9dc1a649eb326d17c2035c0f567b797edf3.zip frameworks_base-b3bae9dc1a649eb326d17c2035c0f567b797edf3.tar.gz frameworks_base-b3bae9dc1a649eb326d17c2035c0f567b797edf3.tar.bz2 |
am a6a01787: am 07600116: CEC: Ensure stable AVR connection
* commit 'a6a01787fb657189202dec096c30b3d2f63197dc':
CEC: Ensure stable AVR connection
-rw-r--r-- | services/core/java/com/android/server/hdmi/HotplugDetectionAction.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java index 722be71..1bbd038 100644 --- a/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java +++ b/services/core/java/com/android/server/hdmi/HotplugDetectionAction.java @@ -38,6 +38,7 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction { private static final int POLLING_INTERVAL_MS = 5000; private static final int TIMEOUT_COUNT = 3; + private static final int AVR_COUNT_MAX = 3; // State in which waits for next polling private static final int STATE_WAIT_FOR_NEXT_POLLING = 1; @@ -48,6 +49,12 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction { private int mTimeoutCount = 0; + // Counter used to ensure the connection to AVR is stable. Occasional failure to get + // polling response from AVR despite its presence leads to unstable status flipping. + // This is a workaround to deal with it, by removing the device only if the removal + // is detected {@code AVR_COUNT_MAX} times in a row. + private int mAvrStatusCount = 0; + /** * Constructor * @@ -148,10 +155,22 @@ final class HotplugDetectionAction extends HdmiCecFeatureAction { BitSet removed = complement(currentInfos, polledResult); 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; + } + } Slog.v(TAG, "Remove device by hot-plug detection:" + index); removeDevice(index); } + // Reset the counter if the ack is returned from AVR. + if (!removed.get(Constants.ADDR_AUDIO_SYSTEM)) { + mAvrStatusCount = 0; + } + // Next, check added devices. BitSet added = complement(polledResult, currentInfos); index = -1; |