Loading flags/gap.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -63,16 +63,6 @@ flag { } } flag { name: "ble_gatt_server_use_address_type_in_connection" namespace: "bluetooth" description: "Use address type when initiating connection from BluetoothGattServer" bug: "331147673" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "scan_record_manufacturer_data_merge" namespace: "bluetooth" Loading framework/tests/bumble/src/android/bluetooth/GattServerConnectWithScanTest.java +2 −10 Original line number Diff line number Diff line Loading @@ -31,15 +31,11 @@ import android.bluetooth.le.ScanFilter; import android.bluetooth.le.ScanResult; import android.bluetooth.le.ScanSettings; import android.content.Context; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.Log; import androidx.test.core.app.ApplicationProvider; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.junit.Ignore; Loading @@ -62,14 +58,11 @@ public class GattServerConnectWithScanTest { private static final int TIMEOUT_SCANNING_MS = 2_000; private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000; @Rule(order = 2) public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 1) public final PandoraDevice mBumble = new PandoraDevice(); public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 0) public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final PandoraDevice mBumble = new PandoraDevice(); private final Context mContext = ApplicationProvider.getApplicationContext(); private final BluetoothManager mBluetoothManager = Loading Loading @@ -132,7 +125,6 @@ public class GattServerConnectWithScanTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToPublicAddress_withTransportAuto() throws Exception { String publicAddress = mBumble.getRemoteDevice().getAddress(); Loading framework/tests/bumble/src/android/bluetooth/GattServerConnectWithoutScanTest.java +2 −11 Original line number Diff line number Diff line Loading @@ -26,14 +26,10 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import android.content.Context; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import androidx.test.core.app.ApplicationProvider; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.junit.Ignore; Loading @@ -50,14 +46,11 @@ public class GattServerConnectWithoutScanTest { private static final String TAG = "GattServerConnectWithoutScanTest"; private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000; @Rule(order = 2) public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 1) public final PandoraDevice mBumble = new PandoraDevice(); public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 0) public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final PandoraDevice mBumble = new PandoraDevice(); private final Context mContext = ApplicationProvider.getApplicationContext(); private final BluetoothManager mBluetoothManager = Loading @@ -65,7 +58,6 @@ public class GattServerConnectWithoutScanTest { private final BluetoothAdapter mBluetoothAdapter = mBluetoothManager.getAdapter(); @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToRandomAddress_withTransportAuto() throws Exception { advertiseWithBumble(OwnAddressType.RANDOM); Loading @@ -92,7 +84,6 @@ public class GattServerConnectWithoutScanTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToRandomAddress_withTransportLE() throws Exception { advertiseWithBumble(OwnAddressType.RANDOM); Loading system/bta/gatt/bta_gatts_act.cc +3 −9 Original line number Diff line number Diff line Loading @@ -415,15 +415,9 @@ void bta_gatts_open(tBTA_GATTS_CB* /* p_cb */, tBTA_GATTS_DATA* p_msg) { p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_open.server_if); if (p_rcb != NULL) { /* should always get the connection ID */ bool success = false; if (com::android::bluetooth::flags::ble_gatt_server_use_address_type_in_connection()) { success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, bool success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, p_msg->api_open.remote_addr_type, p_msg->api_open.connection_type, p_msg->api_open.transport, false, LE_PHY_1M, 0); } else { success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, p_msg->api_open.connection_type, p_msg->api_open.transport, false); } if (success) { status = GATT_SUCCESS; Loading system/btif/src/btif_gatt_server.cc +2 −47 Original line number Diff line number Diff line Loading @@ -292,46 +292,6 @@ static bt_status_t btif_gatts_unregister_app(int server_if) { return do_in_jni_thread(Bind(&BTA_GATTS_AppDeregister, server_if)); } static void btif_gatts_open_impl(int server_if, const RawAddress& address, bool is_direct, tBT_TRANSPORT transport) { // Ensure device is in inquiry database tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(address, &addr_type) && btif_get_device_type(address, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(address, addr_type, device_type); } // Determine transport if (transport == BT_TRANSPORT_AUTO) { switch (device_type) { case BT_DEVICE_TYPE_BREDR: transport = BT_TRANSPORT_BR_EDR; break; case BT_DEVICE_TYPE_BLE: transport = BT_TRANSPORT_LE; break; case BT_DEVICE_TYPE_DUMO: transport = BT_TRANSPORT_BR_EDR; break; default: log::error("Unknown device type {}", DeviceTypeText(device_type)); // transport must not be AUTO for finding control blocks. Use LE for backward compatibility. transport = BT_TRANSPORT_LE; break; } } // Connect! BTA_GATTS_Open(server_if, address, BLE_ADDR_PUBLIC, is_direct, transport); } // Used instead of btif_gatts_open_impl if the flag // ble_gatt_server_use_address_type_in_connection is enabled. static void btif_gatts_open_impl_use_address_type(int server_if, const RawAddress& address, tBLE_ADDR_TYPE addr_type, bool is_direct, tBT_TRANSPORT transport) { Loading Loading @@ -369,13 +329,8 @@ static bt_status_t btif_gatts_open(int server_if, const RawAddress& bd_addr, uin bool is_direct, int transport) { CHECK_BTGATT_INIT(); if (com::android::bluetooth::flags::ble_gatt_server_use_address_type_in_connection()) { return do_in_jni_thread(Bind(&btif_gatts_open_impl_use_address_type, server_if, bd_addr, addr_type, is_direct, to_bt_transport(transport))); } else { return do_in_jni_thread( Bind(&btif_gatts_open_impl, server_if, bd_addr, is_direct, to_bt_transport(transport))); } } static void btif_gatts_close_impl(int server_if, const RawAddress& address, int conn_id) { Loading Loading
flags/gap.aconfig +0 −10 Original line number Diff line number Diff line Loading @@ -63,16 +63,6 @@ flag { } } flag { name: "ble_gatt_server_use_address_type_in_connection" namespace: "bluetooth" description: "Use address type when initiating connection from BluetoothGattServer" bug: "331147673" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "scan_record_manufacturer_data_merge" namespace: "bluetooth" Loading
framework/tests/bumble/src/android/bluetooth/GattServerConnectWithScanTest.java +2 −10 Original line number Diff line number Diff line Loading @@ -31,15 +31,11 @@ import android.bluetooth.le.ScanFilter; import android.bluetooth.le.ScanResult; import android.bluetooth.le.ScanSettings; import android.content.Context; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.Log; import androidx.test.core.app.ApplicationProvider; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.junit.Ignore; Loading @@ -62,14 +58,11 @@ public class GattServerConnectWithScanTest { private static final int TIMEOUT_SCANNING_MS = 2_000; private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000; @Rule(order = 2) public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 1) public final PandoraDevice mBumble = new PandoraDevice(); public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 0) public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final PandoraDevice mBumble = new PandoraDevice(); private final Context mContext = ApplicationProvider.getApplicationContext(); private final BluetoothManager mBluetoothManager = Loading Loading @@ -132,7 +125,6 @@ public class GattServerConnectWithScanTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToPublicAddress_withTransportAuto() throws Exception { String publicAddress = mBumble.getRemoteDevice().getAddress(); Loading
framework/tests/bumble/src/android/bluetooth/GattServerConnectWithoutScanTest.java +2 −11 Original line number Diff line number Diff line Loading @@ -26,14 +26,10 @@ import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import android.content.Context; import android.platform.test.annotations.RequiresFlagsEnabled; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import androidx.test.core.app.ApplicationProvider; import androidx.test.runner.AndroidJUnit4; import com.android.bluetooth.flags.Flags; import com.android.compatibility.common.util.AdoptShellPermissionsRule; import org.junit.Ignore; Loading @@ -50,14 +46,11 @@ public class GattServerConnectWithoutScanTest { private static final String TAG = "GattServerConnectWithoutScanTest"; private static final int TIMEOUT_GATT_CONNECTION_MS = 2_000; @Rule(order = 2) public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 1) public final PandoraDevice mBumble = new PandoraDevice(); public final AdoptShellPermissionsRule mPermissionRule = new AdoptShellPermissionsRule(); @Rule(order = 0) public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final PandoraDevice mBumble = new PandoraDevice(); private final Context mContext = ApplicationProvider.getApplicationContext(); private final BluetoothManager mBluetoothManager = Loading @@ -65,7 +58,6 @@ public class GattServerConnectWithoutScanTest { private final BluetoothAdapter mBluetoothAdapter = mBluetoothManager.getAdapter(); @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToRandomAddress_withTransportAuto() throws Exception { advertiseWithBumble(OwnAddressType.RANDOM); Loading @@ -92,7 +84,6 @@ public class GattServerConnectWithoutScanTest { } @Test @RequiresFlagsEnabled(Flags.FLAG_BLE_GATT_SERVER_USE_ADDRESS_TYPE_IN_CONNECTION) @Ignore("b/343749428: Remove hidden api's dependencies to enable the test.") public void serverConnectToRandomAddress_withTransportLE() throws Exception { advertiseWithBumble(OwnAddressType.RANDOM); Loading
system/bta/gatt/bta_gatts_act.cc +3 −9 Original line number Diff line number Diff line Loading @@ -415,15 +415,9 @@ void bta_gatts_open(tBTA_GATTS_CB* /* p_cb */, tBTA_GATTS_DATA* p_msg) { p_rcb = bta_gatts_find_app_rcb_by_app_if(p_msg->api_open.server_if); if (p_rcb != NULL) { /* should always get the connection ID */ bool success = false; if (com::android::bluetooth::flags::ble_gatt_server_use_address_type_in_connection()) { success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, bool success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, p_msg->api_open.remote_addr_type, p_msg->api_open.connection_type, p_msg->api_open.transport, false, LE_PHY_1M, 0); } else { success = GATT_Connect(p_rcb->gatt_if, p_msg->api_open.remote_bda, p_msg->api_open.connection_type, p_msg->api_open.transport, false); } if (success) { status = GATT_SUCCESS; Loading
system/btif/src/btif_gatt_server.cc +2 −47 Original line number Diff line number Diff line Loading @@ -292,46 +292,6 @@ static bt_status_t btif_gatts_unregister_app(int server_if) { return do_in_jni_thread(Bind(&BTA_GATTS_AppDeregister, server_if)); } static void btif_gatts_open_impl(int server_if, const RawAddress& address, bool is_direct, tBT_TRANSPORT transport) { // Ensure device is in inquiry database tBLE_ADDR_TYPE addr_type = BLE_ADDR_PUBLIC; int device_type = 0; if (btif_get_address_type(address, &addr_type) && btif_get_device_type(address, &device_type) && device_type != BT_DEVICE_TYPE_BREDR) { BTA_DmAddBleDevice(address, addr_type, device_type); } // Determine transport if (transport == BT_TRANSPORT_AUTO) { switch (device_type) { case BT_DEVICE_TYPE_BREDR: transport = BT_TRANSPORT_BR_EDR; break; case BT_DEVICE_TYPE_BLE: transport = BT_TRANSPORT_LE; break; case BT_DEVICE_TYPE_DUMO: transport = BT_TRANSPORT_BR_EDR; break; default: log::error("Unknown device type {}", DeviceTypeText(device_type)); // transport must not be AUTO for finding control blocks. Use LE for backward compatibility. transport = BT_TRANSPORT_LE; break; } } // Connect! BTA_GATTS_Open(server_if, address, BLE_ADDR_PUBLIC, is_direct, transport); } // Used instead of btif_gatts_open_impl if the flag // ble_gatt_server_use_address_type_in_connection is enabled. static void btif_gatts_open_impl_use_address_type(int server_if, const RawAddress& address, tBLE_ADDR_TYPE addr_type, bool is_direct, tBT_TRANSPORT transport) { Loading Loading @@ -369,13 +329,8 @@ static bt_status_t btif_gatts_open(int server_if, const RawAddress& bd_addr, uin bool is_direct, int transport) { CHECK_BTGATT_INIT(); if (com::android::bluetooth::flags::ble_gatt_server_use_address_type_in_connection()) { return do_in_jni_thread(Bind(&btif_gatts_open_impl_use_address_type, server_if, bd_addr, addr_type, is_direct, to_bt_transport(transport))); } else { return do_in_jni_thread( Bind(&btif_gatts_open_impl, server_if, bd_addr, is_direct, to_bt_transport(transport))); } } static void btif_gatts_close_impl(int server_if, const RawAddress& address, int conn_id) { Loading