From f8201e1c6bf7fadc0a332151a652325a7f31255a Mon Sep 17 00:00:00 2001 From: Liejun Tao Date: Tue, 8 Mar 2016 23:04:17 -0600 Subject: [PATCH] Absolute volume: Black list device if remote can't change volume If remote device failed to change volume too many times, black list it to avoid using Absolute volume feature. Bug: 26694114 Change-Id: Idb7a772b0ef936b2351bfc92722ec3c0d748822c --- src/com/android/bluetooth/avrcp/Avrcp.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/android/bluetooth/avrcp/Avrcp.java b/src/com/android/bluetooth/avrcp/Avrcp.java index 099ab546..808d2bfe 100755 --- a/src/com/android/bluetooth/avrcp/Avrcp.java +++ b/src/com/android/bluetooth/avrcp/Avrcp.java @@ -146,7 +146,7 @@ public final class Avrcp { private static final int SKIP_DOUBLE_INTERVAL = 3000; private static final long MAX_MULTIPLIER_VALUE = 128L; private static final int CMD_TIMEOUT_DELAY = 2000; - private static final int MAX_ERROR_RETRY_TIMES = 3; + private static final int MAX_ERROR_RETRY_TIMES = 6; private static final int AVRCP_MAX_VOL = 127; private static final int AVRCP_BASE_VOLUME_STEP = 1; @@ -533,6 +533,8 @@ public final class Avrcp { mVolCmdSetInProgress = false; if (mAbsVolRetryTimes >= MAX_ERROR_RETRY_TIMES) { mAbsVolRetryTimes = 0; + /* too many volume change failures, black list the device */ + blackListCurrentDevice(); } else { mAbsVolRetryTimes += 1; if (setVolumeNative(mLastRemoteVolume)) { -- 2.11.0