From f9c76eb959adee5650306ec4851b50eb2b424bb5 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Mon, 17 Mar 2025 13:27:52 +0100 Subject: Remove flag improve_create_connection_for_already_connecting_device Bug: 356594223 Bug: 356593752 Test: atest bluetooth_gd_unit_test Flag: com.android.bluetooth.flags.improve_create_connection_for_already_connecting_device Change-Id: I5a8219605f3cc8c1b955ce8c5fa689a15d5861b9 --- flags/connectivity.aconfig | 10 - system/gd/hci/acl_manager/le_impl.h | 15 +- system/gd/hci/acl_manager/le_impl_test.cc | 303 +++++++++++++----------------- 3 files changed, 133 insertions(+), 195 deletions(-) diff --git a/flags/connectivity.aconfig b/flags/connectivity.aconfig index 482c7e68e8..35af7382ec 100644 --- a/flags/connectivity.aconfig +++ b/flags/connectivity.aconfig @@ -15,16 +15,6 @@ flag { bug: "302054609" } -flag { - name: "improve_create_connection_for_already_connecting_device" - namespace: "bluetooth" - description: "Make sure to not stop controller with create connection cancel when not needed" - bug: "356593752" - metadata { - purpose: PURPOSE_BUGFIX - } -} - flag { name: "allow_gatt_connect_from_the_apps_without_making_leaudio_device_active" namespace: "bluetooth" diff --git a/system/gd/hci/acl_manager/le_impl.h b/system/gd/hci/acl_manager/le_impl.h index ce93f46e7e..aba894ba21 100644 --- a/system/gd/hci/acl_manager/le_impl.h +++ b/system/gd/hci/acl_manager/le_impl.h @@ -1063,15 +1063,12 @@ public: add_device_to_accept_list(address_with_type); } - if (com::android::bluetooth::flags:: - improve_create_connection_for_already_connecting_device()) { - bool in_accept_list_due_to_direct_connect = - direct_connections_.find(address_with_type) != direct_connections_.end(); - - if (already_in_accept_list && (in_accept_list_due_to_direct_connect || !is_direct)) { - log::info("Device {} already in accept list. Stop here.", address_with_type); - return; - } + bool in_accept_list_due_to_direct_connect = + direct_connections_.find(address_with_type) != direct_connections_.end(); + + if (already_in_accept_list && (in_accept_list_due_to_direct_connect || !is_direct)) { + log::info("Device {} already in accept list. Stop here.", address_with_type); + return; } if (is_direct) { diff --git a/system/gd/hci/acl_manager/le_impl_test.cc b/system/gd/hci/acl_manager/le_impl_test.cc index 66bc16bbd8..6ff069ad74 100644 --- a/system/gd/hci/acl_manager/le_impl_test.cc +++ b/system/gd/hci/acl_manager/le_impl_test.cc @@ -284,164 +284,6 @@ protected: hci_layer_->IncomingEvent(LeSetRandomAddressCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); } - void test_direct_connection_after_background_connection() { - set_random_device_address_policy(); - - hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, - AddressType::PUBLIC_DEVICE_ADDRESS); - - // arrange: Create background connection. Remember that acl_manager adds device background list - le_impl_->add_device_to_background_connection_list(address); - le_impl_->create_le_connection(address, true, /* is_direct */ false); - hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST); - hci_layer_->IncomingEvent( - LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - auto raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); - hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); - sync_handler(); - - // act: Create direct connection - le_impl_->create_le_connection(address, true, /* is_direct */ true); - auto cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); - if (cancel_connection.IsValid()) { - hci_layer_->IncomingEvent( - LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( - ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, - AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, - ClockAccuracy::PPM_30)); - } - auto raw_direct_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); - - // assert - auto bg_create_connection = - LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( - AclCommandView::Create(raw_bg_create_connection))); - EXPECT_TRUE(bg_create_connection.IsValid()); - auto direct_create_connection = - LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( - AclCommandView::Create(raw_direct_create_connection))); - EXPECT_TRUE(direct_create_connection.IsValid()); - log::info("Scan Interval {}", direct_create_connection.GetLeScanInterval()); - ASSERT_NE(direct_create_connection.GetLeScanInterval(), - bg_create_connection.GetLeScanInterval()); - - hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); - sync_handler(); - - // Check state is ARMED - ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); - - // Simulate timeout on direct connect. Verify background connect is still in place - EXPECT_CALL(mock_le_connection_callbacks_, - OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT)) - .Times(1); - le_impl_->on_create_connection_timeout(address); - sync_handler(); - cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); - hci_layer_->IncomingEvent( - LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( - ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, - AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, - ClockAccuracy::PPM_30)); - EXPECT_TRUE(cancel_connection.IsValid()); - raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); - bg_create_connection = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( - AclCommandView::Create(raw_bg_create_connection))); - EXPECT_TRUE(bg_create_connection.IsValid()); - sync_handler(); - ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty()); - - hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); - sync_handler(); - - // Check state is ARMED - ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); - } - - void test_direct_connect_after_direct_connect() { - set_random_device_address_policy(); - - hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, - AddressType::PUBLIC_DEVICE_ADDRESS); - - // Create first direct connection - le_impl_->create_le_connection(address, true, /* is_direct */ true); - hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST); - hci_layer_->IncomingEvent( - LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - auto raw_direct_1_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); - hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); - sync_handler(); - - // Check state is ARMED - ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); - - // assert - auto direct_1_create_connection = - LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( - AclCommandView::Create(raw_direct_1_create_connection))); - EXPECT_TRUE(direct_1_create_connection.IsValid()); - - log::info("Second direct connect to the same device"); - - // Create second direct connection - le_impl_->create_le_connection(address, true, /* is_direct */ true); - sync_handler(); - - CommandView cancel_connection = CommandView::Create( - PacketView(std::make_shared>())); - - if (!com::android::bluetooth::flags:: - improve_create_connection_for_already_connecting_device()) { - cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); - if (cancel_connection.IsValid()) { - hci_layer_->IncomingEvent( - LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( - ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, - AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, - ClockAccuracy::PPM_30)); - } - - auto raw_direct_2_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); - - auto direct_2_create_connection = - LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( - AclCommandView::Create(raw_direct_2_create_connection))); - EXPECT_TRUE(direct_2_create_connection.IsValid()); - hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); - sync_handler(); - } else { - hci_layer_->AssertNoQueuedCommand(); - } - - log::info("Simulate timeout"); - - EXPECT_CALL(mock_le_connection_callbacks_, - OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT)) - .Times(1); - le_impl_->on_create_connection_timeout(address); - sync_handler(); - cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); - EXPECT_TRUE(cancel_connection.IsValid()); - hci_layer_->IncomingEvent( - LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( - ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, - AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, - ClockAccuracy::PPM_30)); - sync_handler(); - ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty()); - - hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST); - hci_layer_->IncomingEvent( - LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); - hci_layer_->AssertNoQueuedCommand(); - ASSERT_EQ(ConnectabilityState::DISARMED, le_impl_->connectability_state_); - } - // Need to store the LeAclConnection so it is not immediately dropped => disconnected std::unique_ptr create_enhanced_connection(std::string remote_address_string, int handle) { @@ -1716,29 +1558,138 @@ TEST_F(LeImplTest, DisconnectionAcceptlistCallback) { } TEST_F(LeImplTest, direct_connection_after_background_connection) { - // TODO b/356593752 - remove when test removing flag - com::android::bluetooth::flags::provider_ - ->improve_create_connection_for_already_connecting_device(false); - test_direct_connection_after_background_connection(); -} + set_random_device_address_policy(); + + hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, + AddressType::PUBLIC_DEVICE_ADDRESS); + + // arrange: Create background connection. Remember that acl_manager adds device background list + le_impl_->add_device_to_background_connection_list(address); + le_impl_->create_le_connection(address, true, /* is_direct */ false); + hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST); + hci_layer_->IncomingEvent( + LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + auto raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); + hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); + sync_handler(); -TEST_F(LeImplTest, direct_connection_after_background_connection_with_improvement) { - com::android::bluetooth::flags::provider_ - ->improve_create_connection_for_already_connecting_device(true); - test_direct_connection_after_background_connection(); + // act: Create direct connection + le_impl_->create_le_connection(address, true, /* is_direct */ true); + auto cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); + if (cancel_connection.IsValid()) { + hci_layer_->IncomingEvent( + LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( + ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, + AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, + ClockAccuracy::PPM_30)); + } + auto raw_direct_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); + + // assert + auto bg_create_connection = + LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( + AclCommandView::Create(raw_bg_create_connection))); + EXPECT_TRUE(bg_create_connection.IsValid()); + auto direct_create_connection = + LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( + AclCommandView::Create(raw_direct_create_connection))); + EXPECT_TRUE(direct_create_connection.IsValid()); + log::info("Scan Interval {}", direct_create_connection.GetLeScanInterval()); + ASSERT_NE(direct_create_connection.GetLeScanInterval(), bg_create_connection.GetLeScanInterval()); + + hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); + sync_handler(); + + // Check state is ARMED + ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); + + // Simulate timeout on direct connect. Verify background connect is still in place + EXPECT_CALL(mock_le_connection_callbacks_, + OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT)) + .Times(1); + le_impl_->on_create_connection_timeout(address); + sync_handler(); + cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); + hci_layer_->IncomingEvent( + LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( + ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, + AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, + ClockAccuracy::PPM_30)); + EXPECT_TRUE(cancel_connection.IsValid()); + raw_bg_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); + bg_create_connection = LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( + AclCommandView::Create(raw_bg_create_connection))); + EXPECT_TRUE(bg_create_connection.IsValid()); + sync_handler(); + ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty()); + + hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); + sync_handler(); + + // Check state is ARMED + ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); } TEST_F(LeImplTest, direct_connection_after_direct_connection) { - // TODO b/356593752 - remove when test removing flag - com::android::bluetooth::flags::provider_ - ->improve_create_connection_for_already_connecting_device(false); - test_direct_connect_after_direct_connect(); -} + set_random_device_address_policy(); -TEST_F(LeImplTest, direct_connection_after_direct_connection_with_improvement) { - com::android::bluetooth::flags::provider_ - ->improve_create_connection_for_already_connecting_device(true); - test_direct_connect_after_direct_connect(); + hci::AddressWithType address({0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, + AddressType::PUBLIC_DEVICE_ADDRESS); + + // Create first direct connection + le_impl_->create_le_connection(address, true, /* is_direct */ true); + hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST); + hci_layer_->IncomingEvent( + LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + auto raw_direct_1_create_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION); + hci_layer_->IncomingEvent(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01)); + sync_handler(); + + // Check state is ARMED + ASSERT_EQ(ConnectabilityState::ARMED, le_impl_->connectability_state_); + + // assert + auto direct_1_create_connection = + LeCreateConnectionView::Create(LeConnectionManagementCommandView::Create( + AclCommandView::Create(raw_direct_1_create_connection))); + EXPECT_TRUE(direct_1_create_connection.IsValid()); + + log::info("Second direct connect to the same device"); + + // Create second direct connection + le_impl_->create_le_connection(address, true, /* is_direct */ true); + sync_handler(); + + CommandView cancel_connection = CommandView::Create( + PacketView(std::make_shared>())); + + hci_layer_->AssertNoQueuedCommand(); + + log::info("Simulate timeout"); + + EXPECT_CALL(mock_le_connection_callbacks_, + OnLeConnectFail(_, ErrorCode::CONNECTION_ACCEPT_TIMEOUT)) + .Times(1); + le_impl_->on_create_connection_timeout(address); + sync_handler(); + cancel_connection = hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION_CANCEL); + EXPECT_TRUE(cancel_connection.IsValid()); + hci_layer_->IncomingEvent( + LeCreateConnectionCancelCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + hci_layer_->IncomingLeMetaEvent(LeConnectionCompleteBuilder::Create( + ErrorCode::UNKNOWN_CONNECTION, kHciHandle, Role::CENTRAL, + AddressType::PUBLIC_DEVICE_ADDRESS, Address::kEmpty, 0x0000, 0x0000, 0x0000, + ClockAccuracy::PPM_30)); + sync_handler(); + ASSERT_TRUE(le_impl_->create_connection_timeout_alarms_.empty()); + + hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST); + hci_layer_->IncomingEvent( + LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS)); + hci_layer_->AssertNoQueuedCommand(); + ASSERT_EQ(ConnectabilityState::DISARMED, le_impl_->connectability_state_); } TEST_F(LeImplTest, direct_connection_cancel_but_connected) { -- cgit v1.2.3-59-g8ed1b From 719980a593b841bf46f623ec3937272bd9b5033a Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Mon, 17 Mar 2025 13:30:58 +0100 Subject: Remove flag api_get_connection_state_using_identity_address Bug: 319471537 Test: mma -j32 Change-Id: I2ca7f3e2eacf6e8b0baf5718fa20cd6e5da16a5a --- .../com/android/bluetooth/btservice/AdapterService.java | 15 ++++++--------- flags/connectivity.aconfig | 7 ------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java index 9bec63769d..cf061a49e9 100644 --- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java +++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java @@ -3119,16 +3119,13 @@ public class AdapterService extends Service { public int getConnectionState(BluetoothDevice device) { final String address = device.getAddress(); - if (Flags.apiGetConnectionStateUsingIdentityAddress()) { - int connectionState = mNativeInterface.getConnectionState(getBytesFromAddress(address)); - final String identityAddress = getIdentityAddress(address); - if (identityAddress != null) { - connectionState |= - mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress)); - } - return connectionState; + int connectionState = mNativeInterface.getConnectionState(getBytesFromAddress(address)); + final String identityAddress = getIdentityAddress(address); + if (identityAddress != null) { + connectionState |= + mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress)); } - return mNativeInterface.getConnectionState(getBytesFromAddress(address)); + return connectionState; } int getConnectionHandle(BluetoothDevice device, int transport) { diff --git a/flags/connectivity.aconfig b/flags/connectivity.aconfig index 35af7382ec..c9b3c4c352 100644 --- a/flags/connectivity.aconfig +++ b/flags/connectivity.aconfig @@ -1,13 +1,6 @@ package: "com.android.bluetooth.flags" container: "com.android.bt" -flag { - name: "api_get_connection_state_using_identity_address" - namespace: "bluetooth" - description: "Use identity address to check current connection state" - bug: "319471537" -} - flag { name: "use_le_shim_connection_map_guard" namespace: "bluetooth" -- cgit v1.2.3-59-g8ed1b From c49841d398b997ccb9d7bc68d8ec77d3a2f92ac6 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowski Date: Mon, 17 Mar 2025 13:31:45 +0100 Subject: Remove flag use_le_shim_connection_map_guard Bug: 321813275 Test: mma -j32 Change-Id: I432620f08856b2ea96aeef9e8004dd8120668e03 --- flags/connectivity.aconfig | 7 ------- 1 file changed, 7 deletions(-) diff --git a/flags/connectivity.aconfig b/flags/connectivity.aconfig index c9b3c4c352..738c294078 100644 --- a/flags/connectivity.aconfig +++ b/flags/connectivity.aconfig @@ -1,13 +1,6 @@ package: "com.android.bluetooth.flags" container: "com.android.bt" -flag { - name: "use_le_shim_connection_map_guard" - namespace: "bluetooth" - description: "Guard the le shim connection map with a mutex" - bug: "302054609" -} - flag { name: "allow_gatt_connect_from_the_apps_without_making_leaudio_device_active" namespace: "bluetooth" -- cgit v1.2.3-59-g8ed1b From 6614e665aa67cd6415192a8c6da1257a175d3d5f Mon Sep 17 00:00:00 2001 From: Bill Yi Date: Tue, 18 Mar 2025 14:30:30 -0700 Subject: Import translations. DO NOT MERGE ANYWHERE Auto-generated-cl: translation import Change-Id: Ibafb79b71fbc95299db4be4759a03b367c9544ab --- android/app/res/values-as/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/res/values-as/strings.xml b/android/app/res/values-as/strings.xml index 2776941946..c53ee123e2 100644 --- a/android/app/res/values-as/strings.xml +++ b/android/app/res/values-as/strings.xml @@ -35,7 +35,7 @@ "অন্তৰ্গামী ফাইল গ্ৰহণ কৰিবনে?" "প্ৰত্যাখ্যান কৰক" "গ্ৰহণ কৰক" - "ঠিক" + "ঠিক আছে" "\"%1$s\"ৰ পৰা লাভ কৰা ফাইলটো গ্ৰহণ কৰোঁতে সময় ওকলিছে" "অন্তৰ্গামী ফাইল" "%1$s এটা ফাইল পঠিয়াবলৈ সাজু: %2$s" @@ -58,18 +58,18 @@ "ফাইল লাভ কৰা নহ\'ল" "ফাইল: %1$s" "কাৰণ: %1$s" - "ঠিক" + "ঠিক আছে" "ফাইল লাভ কৰা হ’ল" "খোলক" "প্ৰতি: \"%1$s\"" "ফাইলৰ প্ৰকাৰ: %1$s (%2$s)" "ফাইল প্ৰেৰণ কৰি থকা হৈছে…" "ফাইল প্ৰেৰণ কৰা হ’ল" - "ঠিক" + "ঠিক আছে" "\"%1$s\"লৈ ফাইলটো পঠিয়াব পৰা নগ\'ল।" "ফাইল: %1$s" "বন্ধ কৰক" - "ঠিক" + "ঠিক আছে" "অজ্ঞাত ফাইল" "এইধৰণৰ ফাইল পৰিচালনা কৰিবলৈ কোনো এপ্ নাই। \n" "কোনো ফাইল নাই" -- cgit v1.2.3-59-g8ed1b From e613a029675f467f15cb4d84eb2c37f093e7ff1a Mon Sep 17 00:00:00 2001 From: Gopi Sakshihally Bhuthaiah Date: Wed, 12 Mar 2025 01:04:56 -0700 Subject: Removed HID Disconnecting state verification when transport switch handleMessageSetPreferredTransport() is modified to update the connection state to disconnected immediately Bug: 399286751 Bug: 374641230 Test: atest -v HidHeadTrackerTest Test: atest -v HidHostDualModeTest Flag: com.android.bluetooth.flags.ignore_unselected_hid_transport_states Change-Id: Icc6d7cd3e436cfc2ccbdcfd15e8f151f19b13725 --- .../tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java | 7 +++++-- .../bumble/src/android/bluetooth/hid/HidHostDualModeTest.java | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java index 38527362ba..82821af1cc 100644 --- a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java +++ b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java @@ -64,6 +64,7 @@ import android.util.Log; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; +import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.hamcrest.CustomTypeSafeMatcher; @@ -490,8 +491,10 @@ public class HidHeadTrackerTest { */ private void verifyTransportSwitch(BluetoothDevice device, int fromTransport, int toTransport) { assertThat(fromTransport).isNotEqualTo(toTransport); - verifyConnectionState(mBumbleDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING)); - + if (!Flags.ignoreUnselectedHidTransportStates()) { + verifyConnectionState( + mBumbleDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING)); + } // Capture the next intent with filter // Filter is necessary as otherwise it will corrupt all other unordered verifications final Intent[] savedIntent = {null}; diff --git a/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java b/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java index fb89c738ad..45c329e460 100644 --- a/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java +++ b/framework/tests/bumble/src/android/bluetooth/hid/HidHostDualModeTest.java @@ -66,6 +66,7 @@ import android.util.Log; import androidx.test.ext.junit.runners.AndroidJUnit4; import androidx.test.platform.app.InstrumentationRegistry; +import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.hamcrest.CustomTypeSafeMatcher; @@ -503,8 +504,9 @@ public class HidHostDualModeTest { */ private void verifyTransportSwitch(BluetoothDevice device, int fromTransport, int toTransport) { assertThat(fromTransport).isNotEqualTo(toTransport); - verifyConnectionState(mDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING)); - + if (!Flags.ignoreUnselectedHidTransportStates()) { + verifyConnectionState(mDevice, equalTo(fromTransport), equalTo(STATE_DISCONNECTING)); + } // Capture the next intent with filter // Filter is necessary as otherwise it will corrupt all other unordered verifications final Intent[] savedIntent = {null}; -- cgit v1.2.3-59-g8ed1b From 57c48c41798b0f5aa6250aba8b7f0491fac31be5 Mon Sep 17 00:00:00 2001 From: Gopi Sakshihally Bhuthaiah Date: Wed, 19 Mar 2025 10:32:44 +0000 Subject: Unregistered HID connection change intent Bug: 399286751 Test: atest -v HidHeadTrackerTest Flag: TEST_ONLY Change-Id: Iadfa76bedc34c96c49dde57ddf8d76e9da3c30dc --- .../tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java index 38527362ba..29de59ed69 100644 --- a/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java +++ b/framework/tests/bumble/src/android/bluetooth/hid/HidHeadTrackerTest.java @@ -353,6 +353,7 @@ public class HidHeadTrackerTest { BluetoothDevice.ACTION_UUID, BluetoothDevice.ACTION_ACL_CONNECTED, BluetoothDevice.ACTION_ACL_DISCONNECTED, + BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED, BluetoothDevice.ACTION_FOUND); } @@ -405,6 +406,7 @@ public class HidHeadTrackerTest { unregisterIntentActions( BluetoothDevice.ACTION_UUID, BluetoothDevice.ACTION_ACL_CONNECTED, + BluetoothHidHost.ACTION_CONNECTION_STATE_CHANGED, BluetoothDevice.ACTION_FOUND); } -- cgit v1.2.3-59-g8ed1b From b484726f4e110660e0ad68f7b27303a207ccd77f Mon Sep 17 00:00:00 2001 From: Łukasz Rymanowski Date: Wed, 19 Mar 2025 17:43:44 +0000 Subject: leaudio: Clear data path state when it is failed to be created Make sure that stack has valid data path state when it is failed to be set (usually due to controller issue). If the state is incorrect, stack will try to remove data path when CIS is disconnected which will lead to assert in btm_iso layer. Bug: 404423428 Flag: Exempt, day to day fix Test: atest bluetooth_le_audio_test Change-Id: I311a86cfe54ccba39ae697bdc85a53ff254e44af --- system/bta/le_audio/state_machine.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/system/bta/le_audio/state_machine.cc b/system/bta/le_audio/state_machine.cc index e5ce67cf9d..b3f20fba39 100644 --- a/system/bta/le_audio/state_machine.cc +++ b/system/bta/le_audio/state_machine.cc @@ -681,8 +681,16 @@ public: kLogHciEvent, group->group_id_, leAudioDevice->address_, kLogSetDataPathOp + "cis_h:" + loghex(conn_handle) + " STATUS=" + loghex(status)); + /* Find ASE and later update state for the given cis.*/ + auto ase = leAudioDevice->GetFirstActiveAseByCisAndDataPathState(CisState::CONNECTED, + DataPathState::CONFIGURING); + if (status) { - log::error("failed to setup data path"); + log::error("Failed to setup data path for {}, cis handle: {:#x}, error: {:#x}", + leAudioDevice->address_, conn_handle, status); + if (ase && ase->cis_conn_hdl == conn_handle) { + ase->data_path_state = DataPathState::IDLE; + } StopStream(group); return; @@ -696,10 +704,6 @@ public: return; } - /* Update state for the given cis.*/ - auto ase = leAudioDevice->GetFirstActiveAseByCisAndDataPathState(CisState::CONNECTED, - DataPathState::CONFIGURING); - if (!ase || ase->cis_conn_hdl != conn_handle) { log::error("Cannot find ase by handle {}", conn_handle); return; -- cgit v1.2.3-59-g8ed1b From c2478d33cad777cf629151ce14dab91a211ddf43 Mon Sep 17 00:00:00 2001 From: Ludvig Hansson Date: Wed, 19 Mar 2025 14:48:31 -0700 Subject: flag: hfp_volume_control_property Add flag to check system property before making hands-free volume UI request. Test: flag only Flag: com.android.bluetooth.flags.hfp_volume_control_property Bug: 404152232 Bug: 315241296 Change-Id: If3a420f32849a4fd57b97b070026492e5561ecea --- flags/hfp.aconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/flags/hfp.aconfig b/flags/hfp.aconfig index c1611242aa..9e3bd50b5d 100644 --- a/flags/hfp.aconfig +++ b/flags/hfp.aconfig @@ -132,3 +132,13 @@ flag { purpose: PURPOSE_BUGFIX } } + +flag { + name: "hfp_volume_control_property" + namespace: "bluetooth" + description: "Check system property before hands-free volume UI request." + bug: "404152232" + metadata { + purpose: PURPOSE_BUGFIX + } +} -- cgit v1.2.3-59-g8ed1b From 4a412913201d50b27658c0db65b00a13ccf3ef74 Mon Sep 17 00:00:00 2001 From: Łukasz Rymanowski Date: Mon, 17 Mar 2025 17:23:25 +0000 Subject: flag: Remove gatt_disconnect_fix flag Flag has been delivered Bug: 361538527 Test: mmm packages/modules/Bluetooth Flag: EXEMPT, flag cleanup Change-Id: I592acc88752e6f2b70b2702356667b904d29f710 --- flags/gap.aconfig | 10 ---------- system/stack/eatt/eatt_impl.h | 6 +----- system/stack/gatt/gatt_main.cc | 2 +- system/stack/test/eatt/eatt_test.cc | 1 - 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/flags/gap.aconfig b/flags/gap.aconfig index edc7874fb5..3af167d050 100644 --- a/flags/gap.aconfig +++ b/flags/gap.aconfig @@ -96,16 +96,6 @@ flag { } } -flag { - name: "gatt_disconnect_fix" - namespace: "bluetooth" - description: "Fix GATT disconnect handling" - bug: "361538527" - metadata { - purpose: PURPOSE_BUGFIX - } -} - flag { name: "gatt_server_requests_fix" namespace: "bluetooth" diff --git a/system/stack/eatt/eatt_impl.h b/system/stack/eatt/eatt_impl.h index 0d27726af4..b602636f0d 100644 --- a/system/stack/eatt/eatt_impl.h +++ b/system/stack/eatt/eatt_impl.h @@ -723,11 +723,7 @@ struct eatt_impl { tGATT_TCB* p_tcb = gatt_find_tcb_by_addr(channel->bda_, BT_TRANSPORT_LE); log::warn("disconnecting channel {:#x} for {}", channel->cid_, channel->bda_); - if (com::android::bluetooth::flags::gatt_disconnect_fix()) { - EattExtension::GetInstance()->Disconnect(channel->bda_, channel->cid_); - } else { - gatt_disconnect(p_tcb); - } + EattExtension::GetInstance()->Disconnect(channel->bda_, channel->cid_); } void start_indication_confirm_timer(const RawAddress& bd_addr, uint16_t cid) { diff --git a/system/stack/gatt/gatt_main.cc b/system/stack/gatt/gatt_main.cc index 56d268422c..8934ff62de 100644 --- a/system/stack/gatt/gatt_main.cc +++ b/system/stack/gatt/gatt_main.cc @@ -282,7 +282,7 @@ bool gatt_disconnect(tGATT_TCB* p_tcb) { return true; } - if (com::android::bluetooth::flags::gatt_disconnect_fix() && p_tcb->eatt) { + if (p_tcb->eatt) { /* ATT is fixed channel and it is expected to drop ACL. * Make sure all EATT channels are disconnected before doing that. */ diff --git a/system/stack/test/eatt/eatt_test.cc b/system/stack/test/eatt/eatt_test.cc index 5d7a2eeea8..17f4908b3e 100644 --- a/system/stack/test/eatt/eatt_test.cc +++ b/system/stack/test/eatt/eatt_test.cc @@ -660,7 +660,6 @@ TEST_F(EattTest, ChannelUnavailableWhileReconfiguring) { } TEST_F(EattTest, DisconnectChannelOnIndicationConfirmationTimeout) { - com::android::bluetooth::flags::provider_->gatt_disconnect_fix(true); ConnectDeviceEattSupported(1); eatt_instance_->StartIndicationConfirmationTimer(test_address, test_local_cids[0]); -- cgit v1.2.3-59-g8ed1b From 32d67d13788a4ef6b3c53217bbf384033cb19d9d Mon Sep 17 00:00:00 2001 From: Łukasz Rymanowski Date: Mon, 17 Mar 2025 17:27:00 +0000 Subject: flag: Remove gatt_server_requests_fix flag Flag has been delivered Bug: 361331170 Test: mmm packages/modules/Bluetooth Flag: EXEMPT, flag cleanup Change-Id: Iab7d7b676eaf626834ceea43e1b549e87ee2d39b --- .../src/com/android/bluetooth/gatt/GattService.java | 19 ++++++------------- flags/gap.aconfig | 10 ---------- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/android/app/src/com/android/bluetooth/gatt/GattService.java b/android/app/src/com/android/bluetooth/gatt/GattService.java index 6e5faefa9f..e81e184b4a 100644 --- a/android/app/src/com/android/bluetooth/gatt/GattService.java +++ b/android/app/src/com/android/bluetooth/gatt/GattService.java @@ -2320,21 +2320,14 @@ public class GattService extends ProfileService { int handle = 0; Integer connId = 0; - if (!Flags.gattServerRequestsFix()) { - HandleMap.Entry entry = mHandleMap.getByRequestId(requestId); - if (entry != null) { - handle = entry.mHandle; - } - connId = mServerMap.connIdByAddress(serverIf, address); + HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); + if (requestData != null) { + handle = requestData.handle(); + connId = requestData.connId(); } else { - HandleMap.RequestData requestData = mHandleMap.getRequestDataByRequestId(requestId); - if (requestData != null) { - handle = requestData.handle(); - connId = requestData.connId(); - } else { - connId = mServerMap.connIdByAddress(serverIf, address); - } + connId = mServerMap.connIdByAddress(serverIf, address); } + mNativeInterface.gattServerSendResponse( serverIf, connId != null ? connId : 0, diff --git a/flags/gap.aconfig b/flags/gap.aconfig index 3af167d050..a7ae204f14 100644 --- a/flags/gap.aconfig +++ b/flags/gap.aconfig @@ -96,16 +96,6 @@ flag { } } -flag { - name: "gatt_server_requests_fix" - namespace: "bluetooth" - description: "Fix GATT server handling" - bug: "361331170" - metadata { - purpose: PURPOSE_BUGFIX - } -} - flag { name: "le_scan_msft_support" namespace: "bluetooth" -- cgit v1.2.3-59-g8ed1b