diff options
author | Andre Eisenbach <eisenbach@google.com> | 2015-10-19 16:06:20 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-10-21 20:51:10 +0000 |
commit | 58593a02736ff9ac9bdccd0e3186602f17452cdf (patch) | |
tree | 9daa3addd801a8ce65189769160002ff56f5577c | |
parent | 61968383a63be05a335e26bc53ef39d9af98ad72 (diff) | |
download | bt-58593a02736ff9ac9bdccd0e3186602f17452cdf.tar.gz |
Remove absolute volume control whitelist
Remove the absolute volume control whitelist to enable absolute volume
control for all compatible devices.
Bug: 25081918
Change-Id: Iab0e4b4c4fd3dac0fefdf62ec80419dd64b56c0c
-rw-r--r-- | btif/src/btif_rc.c | 74 |
1 files changed, 8 insertions, 66 deletions
diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c index caf584870..56f296f0f 100644 --- a/btif/src/btif_rc.c +++ b/btif/src/btif_rc.c @@ -150,7 +150,6 @@ static int uinput_driver_check(); static int uinput_create(char *name); static int init_uinput (void); static void close_uinput (void); -static BOOLEAN dev_blacklisted_for_absolute_volume(BD_ADDR peer_dev); static void sleep_ms(uint32_t timeout_ms); static const struct { @@ -169,27 +168,6 @@ static const struct { { NULL, 0, 0, 0 } }; -/* the rc_black_addr_prefix and rc_white_addr_prefix are used to correct - * IOP issues of absolute volume feature - * We encoutered A2DP headsets/carkits advertising absolute volume but buggy. - * We would like to blacklist those devices. - * But we donot have a full list of the bad devices. So as a temp fix, we - * are blacklisting all the devices except the devices we have well tested, - * the ones in the whitelist. - * - * For now, only the rc_white_addr_prefix is used in the code while - * rc_black_addr_prefix is kept here for future long term solution. - */ -static const UINT8 rc_white_addr_prefix[][3] = { - {0x94, 0xCE, 0x2C}, // Sony SBH50 - {0x30, 0x17, 0xC8} // Sony wm600 -}; - -static const char* rc_white_name[] = { - "SBH50", - "MW600" -}; - static void send_reject_response (UINT8 rc_handle, UINT8 label, UINT8 pdu, UINT8 status); static UINT8 opcode_from_pdu(UINT8 pdu); @@ -351,24 +329,28 @@ void handle_rc_features() bt_bdaddr_t rc_addr; bdcpy(rc_addr.address, btif_rc_cb.rc_addr); - if (dev_blacklisted_for_absolute_volume(btif_rc_cb.rc_addr)) - { - btif_rc_cb.rc_features &= ~BTA_AV_FEAT_ADV_CTRL; - } + // 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 (btif_rc_cb.rc_features & BTA_AV_FEAT_BROWSE) { rc_features |= BTRC_FEAT_BROWSE; } + if ( (btif_rc_cb.rc_features & BTA_AV_FEAT_ADV_CTRL) && (btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG)) { rc_features |= BTRC_FEAT_ABSOLUTE_VOLUME; } + if (btif_rc_cb.rc_features & BTA_AV_FEAT_METADATA) { rc_features |= BTRC_FEAT_METADATA; } + BTIF_TRACE_DEBUG("%s: rc_features=0x%x", __FUNCTION__, rc_features); HAL_CBACK(bt_rc_callbacks, remote_features_cb, &rc_addr, rc_features) @@ -1884,46 +1866,6 @@ void lbl_destroy() } /******************************************************************************* -** Function dev_blacklisted_for_absolute_volume -** -** Description Blacklist Devices that donot handle absolute volume well -** We are blacklisting all the devices that are not in whitelist -** -** Returns True if the device is in the list -*******************************************************************************/ -static BOOLEAN dev_blacklisted_for_absolute_volume(BD_ADDR peer_dev) -{ - int i; - char *dev_name_str = NULL; - int whitelist_size = sizeof(rc_white_addr_prefix)/sizeof(rc_white_addr_prefix[0]); - - for (i = 0; i < whitelist_size; i++) { - if (rc_white_addr_prefix[i][0] == peer_dev[0] && - rc_white_addr_prefix[i][1] == peer_dev[1] && - rc_white_addr_prefix[i][2] == peer_dev[2]) { - BTIF_TRACE_DEBUG("whitelist absolute volume for %02x:%02x:%02x", - peer_dev[0], peer_dev[1], peer_dev[2]); - return FALSE; - } - } - - dev_name_str = BTM_SecReadDevName(peer_dev); - whitelist_size = sizeof(rc_white_name)/sizeof(char*); - if (dev_name_str != NULL) { - for (i = 0; i < whitelist_size; i++) { - if (strcmp(dev_name_str, rc_white_name[i]) == 0) { - BTIF_TRACE_DEBUG("whitelist absolute volume for %s", dev_name_str); - return FALSE; - } - } - } - - BTIF_TRACE_WARNING("blacklist absolute volume for %02x:%02x:%02x, name = %s", - peer_dev[0], peer_dev[1], peer_dev[2], dev_name_str); - return TRUE; -} - -/******************************************************************************* ** Function sleep_ms ** ** Description Sleep the calling thread unconditionally for |