OSDN Git Service

DO NOT MERGE Blacklist devices for absolute volume control
authorAndre Eisenbach <eisenbach@google.com>
Fri, 11 Dec 2015 20:32:21 +0000 (12:32 -0800)
committerAndre Eisenbach <eisenbach@google.com>
Tue, 1 Mar 2016 18:49:53 +0000 (10:49 -0800)
Some devices do not play well with absolute volume control. They either
play back music at unacceptably loud volume levels or provide
insufficiently granular volume control where a single "step" of volume
change results in unexpectedly large jumps in volume.

Bug: 2607006426060431
Change-Id: I5a336fba87119325b47a5ad385e9c48a631f2121

btif/src/btif_rc.c
device/include/interop.h
device/include/interop_database.h
device/src/interop.c

index 6667ddb..15fc9cf 100644 (file)
@@ -36,6 +36,7 @@
 #include "btif_common.h"
 #include "btif_util.h"
 #include "btif_av.h"
+#include "device/include/interop.h"
 #include "hardware/bt_rc.h"
 #include "uinput.h"
 
@@ -324,11 +325,8 @@ void handle_rc_features()
     bt_bdaddr_t rc_addr;
     bdcpy(rc_addr.address, btif_rc_cb.rc_addr);
 
-    // TODO(eisenbach): If devices need to be blacklisted for absolute
-    // volume, it should be added to device/include/interop_database.h
-    // For now, everything goes... If blacklisting is necessary, exclude
-    // the following bit here:
-    //    btif_rc_cb.rc_features &= ~BTA_AV_FEAT_ADV_CTRL;
+    if (interop_match(INTEROP_DISABLE_ABSOLUTE_VOLUME, &rc_addr))
+        btif_rc_cb.rc_features &= ~BTA_AV_FEAT_ADV_CTRL;
 
     if (btif_rc_cb.rc_features & BTA_AV_FEAT_BROWSE)
     {
index b2b01bb..883e245 100644 (file)
@@ -34,7 +34,12 @@ typedef enum {
   // requiring multiple retries to complete pairing. To avoid degrading the user
   // experience for those devices, automatically re-try pairing if page
   // timeouts are received during pairing.
-  INTEROP_AUTO_RETRY_PAIRING
+  INTEROP_AUTO_RETRY_PAIRING,
+
+  // Devices requiring this workaround do not handle Bluetooth Absolute Volume
+  // control correctly, leading to undesirable (potentially harmful) volume levels
+  // or general lack of controlability.
+  INTEROP_DISABLE_ABSOLUTE_VOLUME
 } interop_feature_t;
 
 // Check if a given |addr| matches a known interoperability workaround as identified
index 9148f68..58d5ba5 100644 (file)
@@ -43,5 +43,21 @@ static const interop_entry_t interop_database[] = {
   {{0x80, 0xe4, 0xda, 0x70,   0,0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 
   // BMW car kits (Harman/Becker)
-  {{0x9c, 0xdf, 0x03,       0,0,0}, 3, INTEROP_AUTO_RETRY_PAIRING}
+  {{0x9c, 0xdf, 0x03,       0,0,0}, 3, INTEROP_AUTO_RETRY_PAIRING},
+
+  // JayBird BlueBuds X - low granularity on volume control
+  {{0x44, 0x5e, 0xf3,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+  // LG Tone HBS-730 - unacceptably loud volume
+  {{0x00, 0x18, 0x6b,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+  {{0xb8, 0xad, 0x3e,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+  // LG Tone HV-800 - unacceptably loud volume
+  {{0xa0, 0xe9, 0xdb,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+  // SOL REPUBLIC Tracks Air - unable to adjust volume back off from max
+  {{0xa4, 0x15, 0x66,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+  // VW Car Kit - not enough granularity with volume
+  {{0x00, 0x26, 0x7e,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 };
index 605d7be..f25348a 100644 (file)
@@ -96,6 +96,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) {
   switch (feature) {
     CASE_RETURN_STR(INTEROP_DISABLE_LE_SECURE_CONNECTIONS)
     CASE_RETURN_STR(INTEROP_AUTO_RETRY_PAIRING)
+    CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME)
   }
 
   return "UNKNOWN";