Loading system/bta/dm/bta_dm_act.cc +24 −116 Original line number Original line Diff line number Diff line Loading @@ -391,11 +391,7 @@ void BTA_dm_on_hw_on() { LOG_INFO("%s: Read default class of device {0x%x, 0x%x, 0x%x}", __func__, LOG_INFO("%s: Read default class of device {0x%x, 0x%x, 0x%x}", __func__, dev_class[0], dev_class[1], dev_class[2]); dev_class[0], dev_class[1], dev_class[2]); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SetDeviceClass(dev_class); } else { BTM_SetDeviceClass(dev_class); BTM_SetDeviceClass(dev_class); } /* load BLE local information: ID keys, ER if available */ /* load BLE local information: ID keys, ER if available */ Octet16 er; Octet16 er; Loading @@ -411,11 +407,7 @@ void BTA_dm_on_hw_on() { } } bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID; bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID; if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecRegister(&bta_security); } else { get_btm_client_interface().security.BTM_SecRegister(&bta_security); get_btm_client_interface().security.BTM_SecRegister(&bta_security); } BTM_WritePageTimeout(osi_property_get_int32(PROPERTY_PAGE_TIMEOUT, BTM_WritePageTimeout(osi_property_get_int32(PROPERTY_PAGE_TIMEOUT, p_bta_dm_cfg->page_timeout)); p_bta_dm_cfg->page_timeout)); Loading Loading @@ -602,11 +594,7 @@ static void bta_dm_process_remove_device_no_callback( /* need to remove all pending background connection before unpair */ /* need to remove all pending background connection before unpair */ BTA_GATTC_CancelOpen(0, bd_addr, false); BTA_GATTC_CancelOpen(0, bd_addr, false); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteDevice(bd_addr); } else { BTM_SecDeleteDevice(bd_addr); BTM_SecDeleteDevice(bd_addr); } /* remove all cached GATT information */ /* remove all cached GATT information */ BTA_GATTC_Refresh(bd_addr); BTA_GATTC_Refresh(bd_addr); Loading Loading @@ -729,10 +717,6 @@ void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) { if (msg->link_key_known) p_lc = &msg->link_key; if (msg->link_key_known) p_lc = &msg->link_key; if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, msg->key_type, msg->pin_length); } else { auto add_result = auto add_result = BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, msg->key_type, msg->pin_length); msg->key_type, msg->pin_length); Loading @@ -741,7 +725,6 @@ void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) { << ADDRESS_TO_LOGGABLE_STR(msg->bd_addr); << ADDRESS_TO_LOGGABLE_STR(msg->bd_addr); } } } } } /** This function forces to close the connection to a remote device and /** This function forces to close the connection to a remote device and * optionaly remove the device from security database if required. */ * optionaly remove the device from security database if required. */ Loading Loading @@ -788,17 +771,12 @@ void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, char* p_name; char* p_name; tBTM_STATUS status = tBTM_STATUS status = (bluetooth::shim::is_gd_security_enabled()) BTM_SecBond(bd_addr, addr_type, transport, device_type, 0, NULL); ? bluetooth::shim::BTM_SecBond(bd_addr, addr_type, transport, device_type) : BTM_SecBond(bd_addr, addr_type, transport, device_type, 0, NULL); if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED)) { if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED)) { memset(&sec_event, 0, sizeof(tBTA_DM_SEC)); memset(&sec_event, 0, sizeof(tBTA_DM_SEC)); sec_event.auth_cmpl.bd_addr = bd_addr; sec_event.auth_cmpl.bd_addr = bd_addr; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bd_addr); ? bluetooth::shim::BTM_SecReadDevName(bd_addr) : BTM_SecReadDevName(bd_addr); if (p_name != NULL) { if (p_name != NULL) { memcpy(sec_event.auth_cmpl.bd_name, p_name, BD_NAME_LEN); memcpy(sec_event.auth_cmpl.bd_name, p_name, BD_NAME_LEN); sec_event.auth_cmpl.bd_name[BD_NAME_LEN] = 0; sec_event.auth_cmpl.bd_name[BD_NAME_LEN] = 0; Loading Loading @@ -826,9 +804,7 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) { APPL_TRACE_EVENT(" bta_dm_bond_cancel "); APPL_TRACE_EVENT(" bta_dm_bond_cancel "); status = (bluetooth::shim::is_gd_security_enabled()) status = BTM_SecBondCancel(bd_addr); ? bluetooth::shim::BTM_SecBondCancel(bd_addr) : BTM_SecBondCancel(bd_addr); if (bta_dm_cb.p_sec_cback && if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED && status != BTM_SUCCESS)) { (status != BTM_CMD_STARTED && status != BTM_SUCCESS)) { Loading @@ -841,43 +817,22 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) { /** Send the pin_reply to a request from BTM */ /** Send the pin_reply to a request from BTM */ void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) { void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) { if (msg->accept) { if (msg->accept) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); } else { BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); } } else { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); } else { } else { BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); } } } } } /** Send the user confirm request reply in response to a request from BTM */ /** Send the user confirm request reply in response to a request from BTM */ void bta_dm_confirm(const RawAddress& bd_addr, bool accept) { void bta_dm_confirm(const RawAddress& bd_addr, bool accept) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_ConfirmReqReply( accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); } else { BTM_ConfirmReqReply(accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); BTM_ConfirmReqReply(accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); } } } /** respond to the OOB data request for the remote device from BTM */ /** respond to the OOB data request for the remote device from BTM */ void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) { void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_RemoteOobDataReply( msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c, msg->r); } else { BTM_RemoteOobDataReply(msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, BTM_RemoteOobDataReply(msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c, msg->r); msg->bd_addr, msg->c, msg->r); } } } /******************************************************************************* /******************************************************************************* * * Loading Loading @@ -1015,11 +970,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, bta_dm_search_cb.peer_bdaddr = bd_addr; bta_dm_search_cb.peer_bdaddr = bd_addr; bta_dm_search_cb.peer_name[0] = 0; bta_dm_search_cb.peer_name[0] = 0; btm_status = btm_status = BTM_ReadRemoteDeviceName(bta_dm_search_cb.peer_bdaddr, (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_ReadRemoteDeviceName( bta_dm_search_cb.peer_bdaddr, bta_dm_remname_cback, transport) : BTM_ReadRemoteDeviceName(bta_dm_search_cb.peer_bdaddr, bta_dm_remname_cback, transport); bta_dm_remname_cback, transport); if (btm_status == BTM_CMD_STARTED) { if (btm_status == BTM_CMD_STARTED) { Loading @@ -1033,12 +984,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, * "bta_dm_remname_cback" */ * "bta_dm_remname_cback" */ /* adding callback to get notified that current reading remote name done */ /* adding callback to get notified that current reading remote name done */ if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } return (true); return (true); } else { } else { Loading Loading @@ -1360,13 +1306,7 @@ void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { /* callbacks */ /* callbacks */ /* start next bd_addr if necessary */ /* start next bd_addr if necessary */ if (bluetooth::shim::is_gd_security_enabled()) { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } BTM_LogHistory( BTM_LogHistory( kBtmLogTag, bta_dm_search_cb.peer_bdaddr, "Discovery completed", kBtmLogTag, bta_dm_search_cb.peer_bdaddr, "Discovery completed", Loading Loading @@ -1436,12 +1376,7 @@ void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { if (bta_dm_search_cb.p_sdp_db) if (bta_dm_search_cb.p_sdp_db) osi_free_and_reset((void**)&bta_dm_search_cb.p_sdp_db); osi_free_and_reset((void**)&bta_dm_search_cb.p_sdp_db); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } p_msg = (tBTA_DM_MSG*)osi_calloc(sizeof(tBTA_DM_MSG)); p_msg = (tBTA_DM_MSG*)osi_calloc(sizeof(tBTA_DM_MSG)); p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT; p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT; Loading Loading @@ -2213,24 +2148,13 @@ static void bta_dm_remname_cback(const tBTM_REMOTE_DEV_NAME* p) { p_remote_name->remote_bd_name[0], p_remote_name->length); p_remote_name->remote_bd_name[0], p_remote_name->length); if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } } else { } else { // if we got a different response, maybe ignore it // if we got a different response, maybe ignore it // we will have made a request directly from BTM_ReadRemoteDeviceName so we // we will have made a request directly from BTM_ReadRemoteDeviceName so we // expect a dedicated response for us // expect a dedicated response for us if (p_remote_name->hci_status == HCI_ERR_CONNECTION_EXISTS) { if (p_remote_name->hci_status == HCI_ERR_CONNECTION_EXISTS) { if (bluetooth::shim::is_gd_security_enabled()) { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } LOG_INFO( LOG_INFO( "Assume command failed due to disconnection hci_status:%s peer:%s", "Assume command failed due to disconnection hci_status:%s peer:%s", hci_error_code_text(p_remote_name->hci_status).c_str(), hci_error_code_text(p_remote_name->hci_status).c_str(), Loading Loading @@ -2791,10 +2715,7 @@ static void bta_dm_acl_down(const RawAddress& bd_addr, continue; continue; if (device->conn_state == BTA_DM_UNPAIRING) { if (device->conn_state == BTA_DM_UNPAIRING) { issue_unpair_cb = issue_unpair_cb = BTM_SecDeleteDevice(device->peer_bdaddr); (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_SecDeleteDevice(device->peer_bdaddr) : BTM_SecDeleteDevice(device->peer_bdaddr); /* remove all cached GATT information */ /* remove all cached GATT information */ BTA_GATTC_Refresh(bd_addr); BTA_GATTC_Refresh(bd_addr); Loading Loading @@ -3038,11 +2959,7 @@ static void bta_dm_remove_sec_dev_entry(const RawAddress& remote_bd_addr) { APPL_TRACE_DEBUG( APPL_TRACE_DEBUG( "%s ACL is not down. Schedule for Dev Removal when ACL closes", "%s ACL is not down. Schedule for Dev Removal when ACL closes", __func__); __func__); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecClearSecurityFlags(remote_bd_addr); } else { BTM_SecClearSecurityFlags(remote_bd_addr); BTM_SecClearSecurityFlags(remote_bd_addr); } for (int i = 0; i < bta_dm_cb.device_list.count; i++) { for (int i = 0; i < bta_dm_cb.device_list.count; i++) { if (bta_dm_cb.device_list.peer_device[i].peer_bdaddr == remote_bd_addr) { if (bta_dm_cb.device_list.peer_device[i].peer_bdaddr == remote_bd_addr) { bta_dm_cb.device_list.peer_device[i].remove_dev_pending = TRUE; bta_dm_cb.device_list.peer_device[i].remove_dev_pending = TRUE; Loading Loading @@ -3118,10 +3035,7 @@ static char* bta_dm_get_remname(void) { /* If the name isn't already stored, try retrieving from BTM */ /* If the name isn't already stored, try retrieving from BTM */ if (*p_name == '\0') { if (*p_name == '\0') { p_temp = p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr); (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr) : BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr); if (p_temp != NULL) p_name = p_temp; if (p_temp != NULL) p_name = p_temp; } } Loading Loading @@ -3866,9 +3780,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, case BTM_LE_SEC_REQUEST_EVT: case BTM_LE_SEC_REQUEST_EVT: sec_event.ble_req.bd_addr = bda; sec_event.ble_req.bd_addr = bda; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.ble_req.bd_name, p_name, BD_NAME_LEN + 1); strlcpy((char*)sec_event.ble_req.bd_name, p_name, BD_NAME_LEN + 1); else else Loading @@ -3878,9 +3790,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, case BTM_LE_KEY_NOTIF_EVT: case BTM_LE_KEY_NOTIF_EVT: sec_event.key_notif.bd_addr = bda; sec_event.key_notif.bd_addr = bda; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.key_notif.bd_name, p_name, BD_NAME_LEN + 1); strlcpy((char*)sec_event.key_notif.bd_name, p_name, BD_NAME_LEN + 1); else else Loading Loading @@ -3931,9 +3841,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, sec_event.auth_cmpl.bd_addr = bda; sec_event.auth_cmpl.bd_addr = bda; BTM_ReadDevInfo(bda, &sec_event.auth_cmpl.dev_type, BTM_ReadDevInfo(bda, &sec_event.auth_cmpl.dev_type, &sec_event.auth_cmpl.addr_type); &sec_event.auth_cmpl.addr_type); p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN + 1)); strlcpy((char*)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN + 1)); else else Loading system/btif/src/btif_dm.cc +40 −50 Original line number Original line Diff line number Diff line Loading @@ -659,12 +659,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, if (strlen((const char*)bd_name)) { if (strlen((const char*)bd_name)) { BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_BDNAME, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_BDNAME, strlen((char*)bd_name), bd_name); strlen((char*)bd_name), bd_name); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property( status = btif_storage_set_remote_device_property( &bdaddr, &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device name", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device name", status); status); } num_properties++; num_properties++; } } Loading @@ -689,12 +687,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod); BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property(&bdaddr, status = btif_storage_set_remote_device_property( &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", status); status); } num_properties++; num_properties++; /* device type */ /* device type */ Loading @@ -712,12 +708,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type); &dev_type); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property(&bdaddr, status = btif_storage_set_remote_device_property( &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", status); status); } num_properties++; num_properties++; GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb( GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb( Loading Loading @@ -1106,7 +1100,6 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { RawAddress bd_addr = p_auth_cmpl->bd_addr; RawAddress bd_addr = p_auth_cmpl->bd_addr; tBLE_ADDR_TYPE addr_type = p_auth_cmpl->addr_type; tBLE_ADDR_TYPE addr_type = p_auth_cmpl->addr_type; if (!bluetooth::shim::is_gd_security_enabled()) { if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) { if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) { if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) || if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) || (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) || (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) || Loading Loading @@ -1138,7 +1131,6 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { } } } } } } } if (p_auth_cmpl->success) { if (p_auth_cmpl->success) { // save remote info to iot conf file // save remote info to iot conf file Loading @@ -1159,9 +1151,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { return; return; } } if (!bluetooth::shim::is_gd_security_enabled()) { btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type); btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type); } int dev_type; int dev_type; if (BTM_GetPeerDeviceTypeFromFeatures(bd_addr) == BT_DEVICE_TYPE_DUMO) { if (BTM_GetPeerDeviceTypeFromFeatures(bd_addr) == BT_DEVICE_TYPE_DUMO) { Loading system/gd/hci/controller.cc +6 −7 Original line number Original line Diff line number Diff line Loading @@ -120,13 +120,12 @@ struct Controller::impl { } } // SSP is managed by security layer once enabled // SSP is managed by security layer once enabled if (!common::init_flags::gd_security_is_enabled()) { write_simple_pairing_mode(Enable::ENABLED); write_simple_pairing_mode(Enable::ENABLED); if (module_.SupportsSecureConnections()) { if (module_.SupportsSecureConnections()) { hci_->EnqueueCommand( hci_->EnqueueCommand( WriteSecureConnectionsHostSupportBuilder::Create(Enable::ENABLED), WriteSecureConnectionsHostSupportBuilder::Create(Enable::ENABLED), handler->BindOnceOn(this, &Controller::impl::write_secure_connections_host_support_complete_handler)); handler->BindOnceOn( } this, &Controller::impl::write_secure_connections_host_support_complete_handler)); } } if (is_supported(OpCode::LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) && module_.SupportsBleDataPacketLengthExtension()) { if (is_supported(OpCode::LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) && module_.SupportsBleDataPacketLengthExtension()) { hci_->EnqueueCommand( hci_->EnqueueCommand( Loading system/gd/rust/common/src/init_flags.rs +1 −3 Original line number Original line Diff line number Diff line Loading @@ -379,7 +379,6 @@ init_flags!( gd_link_policy, gd_link_policy, gd_remote_name_request, gd_remote_name_request, gd_rust, gd_rust, gd_security, hci_adapter: i32, hci_adapter: i32, hfp_dynamic_version = true, hfp_dynamic_version = true, irk_rotation, irk_rotation, Loading Loading @@ -419,8 +418,7 @@ init_flags!( } } dependencies: { dependencies: { always_use_private_gatt_for_debugging => private_gatt, always_use_private_gatt_for_debugging => private_gatt, private_gatt => rust_event_loop, private_gatt => rust_event_loop gd_core => gd_security } } ); ); Loading system/gd/rust/shim/src/init_flags.rs +0 −1 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,6 @@ mod ffi { fn gd_link_policy_is_enabled() -> bool; fn gd_link_policy_is_enabled() -> bool; fn gd_remote_name_request_is_enabled() -> bool; fn gd_remote_name_request_is_enabled() -> bool; fn gd_rust_is_enabled() -> bool; fn gd_rust_is_enabled() -> bool; fn gd_security_is_enabled() -> bool; fn get_default_log_level() -> i32; fn get_default_log_level() -> i32; fn get_hci_adapter() -> i32; fn get_hci_adapter() -> i32; fn get_log_level_for_tag(tag: &str) -> i32; fn get_log_level_for_tag(tag: &str) -> i32; Loading Loading
system/bta/dm/bta_dm_act.cc +24 −116 Original line number Original line Diff line number Diff line Loading @@ -391,11 +391,7 @@ void BTA_dm_on_hw_on() { LOG_INFO("%s: Read default class of device {0x%x, 0x%x, 0x%x}", __func__, LOG_INFO("%s: Read default class of device {0x%x, 0x%x, 0x%x}", __func__, dev_class[0], dev_class[1], dev_class[2]); dev_class[0], dev_class[1], dev_class[2]); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SetDeviceClass(dev_class); } else { BTM_SetDeviceClass(dev_class); BTM_SetDeviceClass(dev_class); } /* load BLE local information: ID keys, ER if available */ /* load BLE local information: ID keys, ER if available */ Octet16 er; Octet16 er; Loading @@ -411,11 +407,7 @@ void BTA_dm_on_hw_on() { } } bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID; bta_dm_search_cb.conn_id = GATT_INVALID_CONN_ID; if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecRegister(&bta_security); } else { get_btm_client_interface().security.BTM_SecRegister(&bta_security); get_btm_client_interface().security.BTM_SecRegister(&bta_security); } BTM_WritePageTimeout(osi_property_get_int32(PROPERTY_PAGE_TIMEOUT, BTM_WritePageTimeout(osi_property_get_int32(PROPERTY_PAGE_TIMEOUT, p_bta_dm_cfg->page_timeout)); p_bta_dm_cfg->page_timeout)); Loading Loading @@ -602,11 +594,7 @@ static void bta_dm_process_remove_device_no_callback( /* need to remove all pending background connection before unpair */ /* need to remove all pending background connection before unpair */ BTA_GATTC_CancelOpen(0, bd_addr, false); BTA_GATTC_CancelOpen(0, bd_addr, false); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteDevice(bd_addr); } else { BTM_SecDeleteDevice(bd_addr); BTM_SecDeleteDevice(bd_addr); } /* remove all cached GATT information */ /* remove all cached GATT information */ BTA_GATTC_Refresh(bd_addr); BTA_GATTC_Refresh(bd_addr); Loading Loading @@ -729,10 +717,6 @@ void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) { if (msg->link_key_known) p_lc = &msg->link_key; if (msg->link_key_known) p_lc = &msg->link_key; if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, msg->key_type, msg->pin_length); } else { auto add_result = auto add_result = BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, BTM_SecAddDevice(msg->bd_addr, p_dc, msg->bd_name, nullptr, p_lc, msg->key_type, msg->pin_length); msg->key_type, msg->pin_length); Loading @@ -741,7 +725,6 @@ void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg) { << ADDRESS_TO_LOGGABLE_STR(msg->bd_addr); << ADDRESS_TO_LOGGABLE_STR(msg->bd_addr); } } } } } /** This function forces to close the connection to a remote device and /** This function forces to close the connection to a remote device and * optionaly remove the device from security database if required. */ * optionaly remove the device from security database if required. */ Loading Loading @@ -788,17 +771,12 @@ void bta_dm_bond(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type, char* p_name; char* p_name; tBTM_STATUS status = tBTM_STATUS status = (bluetooth::shim::is_gd_security_enabled()) BTM_SecBond(bd_addr, addr_type, transport, device_type, 0, NULL); ? bluetooth::shim::BTM_SecBond(bd_addr, addr_type, transport, device_type) : BTM_SecBond(bd_addr, addr_type, transport, device_type, 0, NULL); if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED)) { if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED)) { memset(&sec_event, 0, sizeof(tBTA_DM_SEC)); memset(&sec_event, 0, sizeof(tBTA_DM_SEC)); sec_event.auth_cmpl.bd_addr = bd_addr; sec_event.auth_cmpl.bd_addr = bd_addr; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bd_addr); ? bluetooth::shim::BTM_SecReadDevName(bd_addr) : BTM_SecReadDevName(bd_addr); if (p_name != NULL) { if (p_name != NULL) { memcpy(sec_event.auth_cmpl.bd_name, p_name, BD_NAME_LEN); memcpy(sec_event.auth_cmpl.bd_name, p_name, BD_NAME_LEN); sec_event.auth_cmpl.bd_name[BD_NAME_LEN] = 0; sec_event.auth_cmpl.bd_name[BD_NAME_LEN] = 0; Loading Loading @@ -826,9 +804,7 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) { APPL_TRACE_EVENT(" bta_dm_bond_cancel "); APPL_TRACE_EVENT(" bta_dm_bond_cancel "); status = (bluetooth::shim::is_gd_security_enabled()) status = BTM_SecBondCancel(bd_addr); ? bluetooth::shim::BTM_SecBondCancel(bd_addr) : BTM_SecBondCancel(bd_addr); if (bta_dm_cb.p_sec_cback && if (bta_dm_cb.p_sec_cback && (status != BTM_CMD_STARTED && status != BTM_SUCCESS)) { (status != BTM_CMD_STARTED && status != BTM_SUCCESS)) { Loading @@ -841,43 +817,22 @@ void bta_dm_bond_cancel(const RawAddress& bd_addr) { /** Send the pin_reply to a request from BTM */ /** Send the pin_reply to a request from BTM */ void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) { void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg) { if (msg->accept) { if (msg->accept) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); } else { BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); BTM_PINCodeReply(msg->bd_addr, BTM_SUCCESS, msg->pin_len, msg->p_pin); } } else { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); } else { } else { BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); BTM_PINCodeReply(msg->bd_addr, BTM_NOT_AUTHORIZED, 0, NULL); } } } } } /** Send the user confirm request reply in response to a request from BTM */ /** Send the user confirm request reply in response to a request from BTM */ void bta_dm_confirm(const RawAddress& bd_addr, bool accept) { void bta_dm_confirm(const RawAddress& bd_addr, bool accept) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_ConfirmReqReply( accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); } else { BTM_ConfirmReqReply(accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); BTM_ConfirmReqReply(accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, bd_addr); } } } /** respond to the OOB data request for the remote device from BTM */ /** respond to the OOB data request for the remote device from BTM */ void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) { void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_RemoteOobDataReply( msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c, msg->r); } else { BTM_RemoteOobDataReply(msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, BTM_RemoteOobDataReply(msg->accept ? BTM_SUCCESS : BTM_NOT_AUTHORIZED, msg->bd_addr, msg->c, msg->r); msg->bd_addr, msg->c, msg->r); } } } /******************************************************************************* /******************************************************************************* * * Loading Loading @@ -1015,11 +970,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, bta_dm_search_cb.peer_bdaddr = bd_addr; bta_dm_search_cb.peer_bdaddr = bd_addr; bta_dm_search_cb.peer_name[0] = 0; bta_dm_search_cb.peer_name[0] = 0; btm_status = btm_status = BTM_ReadRemoteDeviceName(bta_dm_search_cb.peer_bdaddr, (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_ReadRemoteDeviceName( bta_dm_search_cb.peer_bdaddr, bta_dm_remname_cback, transport) : BTM_ReadRemoteDeviceName(bta_dm_search_cb.peer_bdaddr, bta_dm_remname_cback, transport); bta_dm_remname_cback, transport); if (btm_status == BTM_CMD_STARTED) { if (btm_status == BTM_CMD_STARTED) { Loading @@ -1033,12 +984,7 @@ static bool bta_dm_read_remote_device_name(const RawAddress& bd_addr, * "bta_dm_remname_cback" */ * "bta_dm_remname_cback" */ /* adding callback to get notified that current reading remote name done */ /* adding callback to get notified that current reading remote name done */ if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecAddRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecAddRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } return (true); return (true); } else { } else { Loading Loading @@ -1360,13 +1306,7 @@ void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { /* callbacks */ /* callbacks */ /* start next bd_addr if necessary */ /* start next bd_addr if necessary */ if (bluetooth::shim::is_gd_security_enabled()) { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } BTM_LogHistory( BTM_LogHistory( kBtmLogTag, bta_dm_search_cb.peer_bdaddr, "Discovery completed", kBtmLogTag, bta_dm_search_cb.peer_bdaddr, "Discovery completed", Loading Loading @@ -1436,12 +1376,7 @@ void bta_dm_sdp_result(tBTA_DM_MSG* p_data) { if (bta_dm_search_cb.p_sdp_db) if (bta_dm_search_cb.p_sdp_db) osi_free_and_reset((void**)&bta_dm_search_cb.p_sdp_db); osi_free_and_reset((void**)&bta_dm_search_cb.p_sdp_db); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } p_msg = (tBTA_DM_MSG*)osi_calloc(sizeof(tBTA_DM_MSG)); p_msg = (tBTA_DM_MSG*)osi_calloc(sizeof(tBTA_DM_MSG)); p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT; p_msg->hdr.event = BTA_DM_DISCOVERY_RESULT_EVT; Loading Loading @@ -2213,24 +2148,13 @@ static void bta_dm_remname_cback(const tBTM_REMOTE_DEV_NAME* p) { p_remote_name->remote_bd_name[0], p_remote_name->length); p_remote_name->remote_bd_name[0], p_remote_name->length); if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bta_dm_search_cb.peer_bdaddr == p_remote_name->bd_addr) { if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); } } else { } else { // if we got a different response, maybe ignore it // if we got a different response, maybe ignore it // we will have made a request directly from BTM_ReadRemoteDeviceName so we // we will have made a request directly from BTM_ReadRemoteDeviceName so we // expect a dedicated response for us // expect a dedicated response for us if (p_remote_name->hci_status == HCI_ERR_CONNECTION_EXISTS) { if (p_remote_name->hci_status == HCI_ERR_CONNECTION_EXISTS) { if (bluetooth::shim::is_gd_security_enabled()) { BTM_SecDeleteRmtNameNotifyCallback(&bta_dm_service_search_remname_cback); bluetooth::shim::BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } else { BTM_SecDeleteRmtNameNotifyCallback( &bta_dm_service_search_remname_cback); } LOG_INFO( LOG_INFO( "Assume command failed due to disconnection hci_status:%s peer:%s", "Assume command failed due to disconnection hci_status:%s peer:%s", hci_error_code_text(p_remote_name->hci_status).c_str(), hci_error_code_text(p_remote_name->hci_status).c_str(), Loading Loading @@ -2791,10 +2715,7 @@ static void bta_dm_acl_down(const RawAddress& bd_addr, continue; continue; if (device->conn_state == BTA_DM_UNPAIRING) { if (device->conn_state == BTA_DM_UNPAIRING) { issue_unpair_cb = issue_unpair_cb = BTM_SecDeleteDevice(device->peer_bdaddr); (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_SecDeleteDevice(device->peer_bdaddr) : BTM_SecDeleteDevice(device->peer_bdaddr); /* remove all cached GATT information */ /* remove all cached GATT information */ BTA_GATTC_Refresh(bd_addr); BTA_GATTC_Refresh(bd_addr); Loading Loading @@ -3038,11 +2959,7 @@ static void bta_dm_remove_sec_dev_entry(const RawAddress& remote_bd_addr) { APPL_TRACE_DEBUG( APPL_TRACE_DEBUG( "%s ACL is not down. Schedule for Dev Removal when ACL closes", "%s ACL is not down. Schedule for Dev Removal when ACL closes", __func__); __func__); if (bluetooth::shim::is_gd_security_enabled()) { bluetooth::shim::BTM_SecClearSecurityFlags(remote_bd_addr); } else { BTM_SecClearSecurityFlags(remote_bd_addr); BTM_SecClearSecurityFlags(remote_bd_addr); } for (int i = 0; i < bta_dm_cb.device_list.count; i++) { for (int i = 0; i < bta_dm_cb.device_list.count; i++) { if (bta_dm_cb.device_list.peer_device[i].peer_bdaddr == remote_bd_addr) { if (bta_dm_cb.device_list.peer_device[i].peer_bdaddr == remote_bd_addr) { bta_dm_cb.device_list.peer_device[i].remove_dev_pending = TRUE; bta_dm_cb.device_list.peer_device[i].remove_dev_pending = TRUE; Loading Loading @@ -3118,10 +3035,7 @@ static char* bta_dm_get_remname(void) { /* If the name isn't already stored, try retrieving from BTM */ /* If the name isn't already stored, try retrieving from BTM */ if (*p_name == '\0') { if (*p_name == '\0') { p_temp = p_temp = BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr); (bluetooth::shim::is_gd_security_enabled()) ? bluetooth::shim::BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr) : BTM_SecReadDevName(bta_dm_search_cb.peer_bdaddr); if (p_temp != NULL) p_name = p_temp; if (p_temp != NULL) p_name = p_temp; } } Loading Loading @@ -3866,9 +3780,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, case BTM_LE_SEC_REQUEST_EVT: case BTM_LE_SEC_REQUEST_EVT: sec_event.ble_req.bd_addr = bda; sec_event.ble_req.bd_addr = bda; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.ble_req.bd_name, p_name, BD_NAME_LEN + 1); strlcpy((char*)sec_event.ble_req.bd_name, p_name, BD_NAME_LEN + 1); else else Loading @@ -3878,9 +3790,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, case BTM_LE_KEY_NOTIF_EVT: case BTM_LE_KEY_NOTIF_EVT: sec_event.key_notif.bd_addr = bda; sec_event.key_notif.bd_addr = bda; p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.key_notif.bd_name, p_name, BD_NAME_LEN + 1); strlcpy((char*)sec_event.key_notif.bd_name, p_name, BD_NAME_LEN + 1); else else Loading Loading @@ -3931,9 +3841,7 @@ static uint8_t bta_dm_ble_smp_cback(tBTM_LE_EVT event, const RawAddress& bda, sec_event.auth_cmpl.bd_addr = bda; sec_event.auth_cmpl.bd_addr = bda; BTM_ReadDevInfo(bda, &sec_event.auth_cmpl.dev_type, BTM_ReadDevInfo(bda, &sec_event.auth_cmpl.dev_type, &sec_event.auth_cmpl.addr_type); &sec_event.auth_cmpl.addr_type); p_name = (bluetooth::shim::is_gd_security_enabled()) p_name = BTM_SecReadDevName(bda); ? bluetooth::shim::BTM_SecReadDevName(bda) : BTM_SecReadDevName(bda); if (p_name != NULL) if (p_name != NULL) strlcpy((char*)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN + 1)); strlcpy((char*)sec_event.auth_cmpl.bd_name, p_name, (BD_NAME_LEN + 1)); else else Loading
system/btif/src/btif_dm.cc +40 −50 Original line number Original line Diff line number Diff line Loading @@ -659,12 +659,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, if (strlen((const char*)bd_name)) { if (strlen((const char*)bd_name)) { BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_BDNAME, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_BDNAME, strlen((char*)bd_name), bd_name); strlen((char*)bd_name), bd_name); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property( status = btif_storage_set_remote_device_property( &bdaddr, &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device name", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device name", status); status); } num_properties++; num_properties++; } } Loading @@ -689,12 +687,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod); BT_PROPERTY_CLASS_OF_DEVICE, sizeof(cod), &cod); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property(&bdaddr, status = btif_storage_set_remote_device_property( &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device class", status); status); } num_properties++; num_properties++; /* device type */ /* device type */ Loading @@ -712,12 +708,10 @@ static void btif_update_remote_properties(const RawAddress& bdaddr, BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties], BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type); &dev_type); if (!bluetooth::shim::is_gd_security_enabled()) { status = btif_storage_set_remote_device_property(&bdaddr, status = btif_storage_set_remote_device_property( &properties[num_properties]); &bdaddr, &properties[num_properties]); ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", ASSERTC(status == BT_STATUS_SUCCESS, "failed to save remote device type", status); status); } num_properties++; num_properties++; GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb( GetInterfaceToProfiles()->events->invoke_remote_device_properties_cb( Loading Loading @@ -1106,7 +1100,6 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { RawAddress bd_addr = p_auth_cmpl->bd_addr; RawAddress bd_addr = p_auth_cmpl->bd_addr; tBLE_ADDR_TYPE addr_type = p_auth_cmpl->addr_type; tBLE_ADDR_TYPE addr_type = p_auth_cmpl->addr_type; if (!bluetooth::shim::is_gd_security_enabled()) { if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) { if ((p_auth_cmpl->success) && (p_auth_cmpl->key_present)) { if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) || if ((p_auth_cmpl->key_type < HCI_LKEY_TYPE_DEBUG_COMB) || (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) || (p_auth_cmpl->key_type == HCI_LKEY_TYPE_AUTH_COMB) || Loading Loading @@ -1138,7 +1131,6 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { } } } } } } } if (p_auth_cmpl->success) { if (p_auth_cmpl->success) { // save remote info to iot conf file // save remote info to iot conf file Loading @@ -1159,9 +1151,7 @@ static void btif_dm_auth_cmpl_evt(tBTA_DM_AUTH_CMPL* p_auth_cmpl) { return; return; } } if (!bluetooth::shim::is_gd_security_enabled()) { btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type); btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type); } int dev_type; int dev_type; if (BTM_GetPeerDeviceTypeFromFeatures(bd_addr) == BT_DEVICE_TYPE_DUMO) { if (BTM_GetPeerDeviceTypeFromFeatures(bd_addr) == BT_DEVICE_TYPE_DUMO) { Loading
system/gd/hci/controller.cc +6 −7 Original line number Original line Diff line number Diff line Loading @@ -120,13 +120,12 @@ struct Controller::impl { } } // SSP is managed by security layer once enabled // SSP is managed by security layer once enabled if (!common::init_flags::gd_security_is_enabled()) { write_simple_pairing_mode(Enable::ENABLED); write_simple_pairing_mode(Enable::ENABLED); if (module_.SupportsSecureConnections()) { if (module_.SupportsSecureConnections()) { hci_->EnqueueCommand( hci_->EnqueueCommand( WriteSecureConnectionsHostSupportBuilder::Create(Enable::ENABLED), WriteSecureConnectionsHostSupportBuilder::Create(Enable::ENABLED), handler->BindOnceOn(this, &Controller::impl::write_secure_connections_host_support_complete_handler)); handler->BindOnceOn( } this, &Controller::impl::write_secure_connections_host_support_complete_handler)); } } if (is_supported(OpCode::LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) && module_.SupportsBleDataPacketLengthExtension()) { if (is_supported(OpCode::LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH) && module_.SupportsBleDataPacketLengthExtension()) { hci_->EnqueueCommand( hci_->EnqueueCommand( Loading
system/gd/rust/common/src/init_flags.rs +1 −3 Original line number Original line Diff line number Diff line Loading @@ -379,7 +379,6 @@ init_flags!( gd_link_policy, gd_link_policy, gd_remote_name_request, gd_remote_name_request, gd_rust, gd_rust, gd_security, hci_adapter: i32, hci_adapter: i32, hfp_dynamic_version = true, hfp_dynamic_version = true, irk_rotation, irk_rotation, Loading Loading @@ -419,8 +418,7 @@ init_flags!( } } dependencies: { dependencies: { always_use_private_gatt_for_debugging => private_gatt, always_use_private_gatt_for_debugging => private_gatt, private_gatt => rust_event_loop, private_gatt => rust_event_loop gd_core => gd_security } } ); ); Loading
system/gd/rust/shim/src/init_flags.rs +0 −1 Original line number Original line Diff line number Diff line Loading @@ -32,7 +32,6 @@ mod ffi { fn gd_link_policy_is_enabled() -> bool; fn gd_link_policy_is_enabled() -> bool; fn gd_remote_name_request_is_enabled() -> bool; fn gd_remote_name_request_is_enabled() -> bool; fn gd_rust_is_enabled() -> bool; fn gd_rust_is_enabled() -> bool; fn gd_security_is_enabled() -> bool; fn get_default_log_level() -> i32; fn get_default_log_level() -> i32; fn get_hci_adapter() -> i32; fn get_hci_adapter() -> i32; fn get_log_level_for_tag(tag: &str) -> i32; fn get_log_level_for_tag(tag: &str) -> i32; Loading