system/bt
Revisión | 7fe86917d75785f33992b172e5241744a0f80e17 (tree) |
---|---|
Tiempo | 2017-06-09 08:58:40 |
Autor | Pavlin Radoslavov <pavlin@goog...> |
Commiter | Pavlin Radoslavov |
Ignore the Class Of Device if the value is invalid
If a Bluetooth Device is dual-mode and is discoverable as both
a Classic and a LE device, ignore unknown "zero" values
triggered by the LE advertisements. Otherwise, those could overwrite
a valid (previously discovered) Class Of Device.
Bug: 37615863
Test: Manual with LG HBS1100 headset
Change-Id: I5a0f6ef56248b41d973b850a5542475e45e0312d
(cherry picked from commit a052757882927c042399d614bc298f9704ce07a3)
@@ -1243,7 +1243,6 @@ static void btif_dm_search_devices_evt(uint16_t event, char* p_param) { | ||
1243 | 1243 | |
1244 | 1244 | case BTA_DM_INQ_RES_EVT: { |
1245 | 1245 | /* inquiry result */ |
1246 | - uint32_t cod; | |
1247 | 1246 | bt_bdname_t bdname; |
1248 | 1247 | bt_bdaddr_t bdaddr; |
1249 | 1248 | uint8_t remote_name_len; |
@@ -1258,13 +1257,6 @@ static void btif_dm_search_devices_evt(uint16_t event, char* p_param) { | ||
1258 | 1257 | p_search_data->inq_res.device_type); |
1259 | 1258 | bdname.name[0] = 0; |
1260 | 1259 | |
1261 | - cod = devclass2uint(p_search_data->inq_res.dev_class); | |
1262 | - | |
1263 | - if (cod == 0) { | |
1264 | - LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__); | |
1265 | - cod = COD_UNCLASSIFIED; | |
1266 | - } | |
1267 | - | |
1268 | 1260 | if (!check_eir_remote_name(p_search_data, bdname.name, &remote_name_len)) |
1269 | 1261 | check_cached_remote_name(p_search_data, bdname.name, &remote_name_len); |
1270 | 1262 |
@@ -1300,10 +1292,15 @@ static void btif_dm_search_devices_evt(uint16_t event, char* p_param) { | ||
1300 | 1292 | } |
1301 | 1293 | |
1302 | 1294 | /* DEV_CLASS */ |
1303 | - BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], | |
1304 | - BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), | |
1305 | - &cod); | |
1306 | - num_properties++; | |
1295 | + uint32_t cod = devclass2uint(p_search_data->inq_res.dev_class); | |
1296 | + BTIF_TRACE_DEBUG("%s cod is 0x%06x", __func__, cod); | |
1297 | + if (cod != 0) { | |
1298 | + BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], | |
1299 | + BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), | |
1300 | + &cod); | |
1301 | + num_properties++; | |
1302 | + } | |
1303 | + | |
1307 | 1304 | /* DEV_TYPE */ |
1308 | 1305 | /* FixMe: Assumption is that bluetooth.h and BTE enums match */ |
1309 | 1306 |