Loading system/bta/has/has_client.cc +5 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,11 @@ public: if (com::android::bluetooth::flags::hap_connect_only_requested_device()) { auto device = std::find_if(devices_.begin(), devices_.end(), HasDevice::MatchAddress(address)); if (device == devices_.end()) { log::warn("Device not connected to profile{}", address); return; } auto conn_id = device->conn_id; auto is_connecting_actively = device->is_connecting_actively; Loading system/bta/has/has_client_test.cc +13 −0 Original line number Diff line number Diff line Loading @@ -1195,7 +1195,20 @@ TEST_F(HasClientTest, test_connect_after_remove) { Mock::VerifyAndClearExpectations(&callbacks); } TEST_F(HasClientTest, test_disconnect_non_connected_without_hap_connect_only_requested_device_flag) { com::android::bluetooth::flags::provider_->hap_connect_only_requested_device(false); const RawAddress test_address = GetTestAddress(1); /* Override the default action to prevent us sendind the connected event */ EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, _)) .WillOnce(Return()); HasClient::Get()->Connect(test_address); TestDisconnect(test_address, GATT_INVALID_CONN_ID); } TEST_F(HasClientTest, test_disconnect_non_connected) { com::android::bluetooth::flags::provider_->hap_connect_only_requested_device(true); const RawAddress test_address = GetTestAddress(1); /* Override the default action to prevent us sendind the connected event */ Loading Loading
system/bta/has/has_client.cc +5 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,11 @@ public: if (com::android::bluetooth::flags::hap_connect_only_requested_device()) { auto device = std::find_if(devices_.begin(), devices_.end(), HasDevice::MatchAddress(address)); if (device == devices_.end()) { log::warn("Device not connected to profile{}", address); return; } auto conn_id = device->conn_id; auto is_connecting_actively = device->is_connecting_actively; Loading
system/bta/has/has_client_test.cc +13 −0 Original line number Diff line number Diff line Loading @@ -1195,7 +1195,20 @@ TEST_F(HasClientTest, test_connect_after_remove) { Mock::VerifyAndClearExpectations(&callbacks); } TEST_F(HasClientTest, test_disconnect_non_connected_without_hap_connect_only_requested_device_flag) { com::android::bluetooth::flags::provider_->hap_connect_only_requested_device(false); const RawAddress test_address = GetTestAddress(1); /* Override the default action to prevent us sendind the connected event */ EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, _)) .WillOnce(Return()); HasClient::Get()->Connect(test_address); TestDisconnect(test_address, GATT_INVALID_CONN_ID); } TEST_F(HasClientTest, test_disconnect_non_connected) { com::android::bluetooth::flags::provider_->hap_connect_only_requested_device(true); const RawAddress test_address = GetTestAddress(1); /* Override the default action to prevent us sendind the connected event */ Loading