OSDN Git Service

Fix order of parameters to BTA_GATTC_Open
authorJakub Pawlowski <jpawlowski@google.com>
Sat, 3 Jun 2017 23:39:04 +0000 (16:39 -0700)
committerJakub Pawlowski <jpawlowski@google.com>
Sat, 3 Jun 2017 23:51:50 +0000 (16:51 -0700)
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
16bb48b320cde54a1a06a525f4d9be1421689649

Bug: 34951749
Test: sl4a GattReadTest was flaky without this patch
Change-Id: I243b11bd8e2c0da9f01cbd3eab95dc808bd54006

bta/gatt/bta_gattc_api.cc
bta/include/bta_gatt_api.h
btif/src/btif_gatt_client.cc

index aaf410f..01f17c9 100644 (file)
@@ -134,13 +134,13 @@ void BTA_GATTC_AppDeregister(tBTA_GATTC_IF client_if) {
 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));
 
index d850eab..40f274a 100644 (file)
@@ -643,7 +643,7 @@ extern void BTA_GATTC_Open(tBTA_GATTC_IF client_if, BD_ADDR remote_bda,
                            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);
 
 /*******************************************************************************
  *
index 40d1515..3ce48bd 100644 (file)
@@ -310,7 +310,8 @@ void btif_gattc_open_impl(int client_if, BD_ADDR address, bool is_direct,
   // 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,