Fix order of parameters to BTA_GATTC_Open
Different order of parameters in different flavours of method caused
bug in btif_gatt_client.cc, where every client would be started as
opportunistic. This issue was introduced in commit
fb052951043bec7898edc5ff7137f70e38252288
Bug: 34951749
Test: sl4a GattReadTest was flaky without this patch
Change-Id: I243b11bd8e2c0da9f01cbd3eab95dc808bd54006
diff --git a/system/bta/gatt/bta_gattc_api.cc b/system/bta/gatt/bta_gattc_api.cc
index aaf410f..01f17c9 100644
--- a/system/bta/gatt/bta_gattc_api.cc
+++ b/system/bta/gatt/bta_gattc_api.cc
@@ -134,13 +134,13 @@
void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, bool is_direct,
tBTA_GATT_TRANSPORT transport, bool opportunistic) {
uint8_t phy = controller_get_interface()->get_le_all_initiating_phys();
- BTA_GATTC_Open(client_if, remote_bda, is_direct, transport, phy,
- opportunistic);
+ BTA_GATTC_Open(client_if, remote_bda, is_direct, transport, opportunistic,
+ phy);
}
void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda, bool is_direct,
- tBTA_GATT_TRANSPORT transport, uint8_t initiating_phys,
- bool opportunistic) {
+ tBTA_GATT_TRANSPORT transport, bool opportunistic,
+ uint8_t initiating_phys) {
tBTA_GATTC_API_OPEN* p_buf =
(tBTA_GATTC_API_OPEN*)osi_malloc(sizeof(tBTA_GATTC_API_OPEN));
diff --git a/system/bta/include/bta_gatt_api.h b/system/bta/include/bta_gatt_api.h
index d850eab..40f274a 100644
--- a/system/bta/include/bta_gatt_api.h
+++ b/system/bta/include/bta_gatt_api.h
@@ -643,7 +643,7 @@
bool opportunistic);
extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda,
bool is_direct, tBTA_GATT_TRANSPORT transport,
- uint8_t initiating_phys, bool opportunistic);
+ bool opportunistic, uint8_t initiating_phys);
/*******************************************************************************
*
diff --git a/system/btif/src/btif_gatt_client.cc b/system/btif/src/btif_gatt_client.cc
index 40d1515..3ce48bd 100644
--- a/system/btif/src/btif_gatt_client.cc
+++ b/system/btif/src/btif_gatt_client.cc
@@ -310,7 +310,8 @@
// Connect!
BTIF_TRACE_DEBUG("%s Transport=%d, device type=%d, phy=%d", __func__,
transport, device_type, initiating_phys);
- BTA_GATTC_Open(client_if, address, is_direct, transport, initiating_phys);
+ BTA_GATTC_Open(client_if, address, is_direct, transport, false,
+ initiating_phys);
}
bt_status_t btif_gattc_open(int client_if, const bt_bdaddr_t* bd_addr,