• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/bt


コミットメタ情報

リビジョン2acb8e2b1ce511bcf73ba131822bef592e9d5981 (tree)
日時2019-07-16 04:43:34
作者Arjun Garg <arjgarg@goog...>
コミッターArjun Garg

ログメッセージ

Revert "DO NOT MERGE Separate SDP procedure from bonding state (1/2)"

This reverts commit 669c21e17874a11394668b2a927b04d03850d237.

変更サマリ

差分

--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -191,7 +191,6 @@ typedef struct
191191 #define BTA_SERVICE_ID_TO_SERVICE_MASK(id) (1 << (id))
192192
193193 #define UUID_HUMAN_INTERFACE_DEVICE "00001124-0000-1000-8000-00805f9b34fb"
194-#define UUID_EMPTY "00000000-0000-0000-0000-000000000000"
195194
196195 #define MAX_BTIF_BOND_EVENT_ENTRIES 15
197196
@@ -271,11 +270,6 @@ static bool is_empty_128bit(uint8_t *data)
271270 return !memcmp(zero, data, sizeof(zero));
272271 }
273272
274-static bool is_bonding_or_sdp() {
275- return pairing_cb.state == BT_BOND_STATE_BONDING ||
276- (pairing_cb.state == BT_BOND_STATE_BONDED && pairing_cb.sdp_attempts);
277-}
278-
279273 static void btif_dm_data_copy(uint16_t event, char *dst, char *src)
280274 {
281275 tBTA_DM_SEC *dst_dm_sec = (tBTA_DM_SEC*)dst;
@@ -557,14 +551,15 @@ static void bond_state_changed(bt_status_t status, bt_bdaddr_t *bd_addr, bt_bond
557551
558552 HAL_CBACK(bt_hal_cbacks, bond_state_changed_cb, status, bd_addr, state);
559553
560- if (state == BT_BOND_STATE_BONDING ||
561- (state == BT_BOND_STATE_BONDED && pairing_cb.sdp_attempts > 0))
554+ if (state == BT_BOND_STATE_BONDING)
562555 {
563- // Save state for the device is bonding or SDP.
564556 pairing_cb.state = state;
565557 bdcpy(pairing_cb.bd_addr, bd_addr->address);
566558 } else {
567- memset(&pairing_cb, 0, sizeof(pairing_cb));
559+ if (!pairing_cb.sdp_attempts)
560+ memset(&pairing_cb, 0, sizeof(pairing_cb));
561+ else
562+ BTIF_TRACE_DEBUG("%s: BR-EDR service discovery active", __func__);
568563 }
569564 }
570565
@@ -1217,14 +1212,6 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
12171212
12181213 // Ensure inquiry is stopped before attempting service discovery
12191214 btif_dm_cancel_discovery();
1220- if (is_crosskey) {
1221- // If bonding occurred due to cross-key pairing, send bonding callback
1222- // for static address now
1223- LOG_INFO(LOG_TAG,
1224- "%s: send bonding state update for static address", __func__);
1225- bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
1226- }
1227- bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDED);
12281215
12291216 /* Trigger SDP on the device */
12301217 pairing_cb.sdp_attempts = 1;
@@ -1518,7 +1505,7 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
15181505 BTIF_TRACE_DEBUG("%s:(result=0x%x, services 0x%x)", __FUNCTION__,
15191506 p_data->disc_res.result, p_data->disc_res.services);
15201507 if ((p_data->disc_res.result != BTA_SUCCESS) &&
1521- (pairing_cb.state == BT_BOND_STATE_BONDED) &&
1508+ (pairing_cb.state == BT_BOND_STATE_BONDING ) &&
15221509 (pairing_cb.sdp_attempts < BTIF_DM_MAX_SDP_ATTEMPTS_AFTER_PAIRING))
15231510 {
15241511 BTIF_TRACE_WARNING("%s:SDP failed after bonding re-attempting", __FUNCTION__);
@@ -1543,37 +1530,21 @@ static void btif_dm_search_services_evt(UINT16 event, char *p_param)
15431530 /* onUuidChanged requires getBondedDevices to be populated.
15441531 ** bond_state_changed needs to be sent prior to remote_device_property
15451532 */
1546- if ((pairing_cb.state == BT_BOND_STATE_BONDED && pairing_cb.sdp_attempts) &&
1533+ if ((pairing_cb.state == BT_BOND_STATE_BONDING) &&
15471534 ((bdcmp(p_data->disc_res.bd_addr, pairing_cb.bd_addr) == 0) ||
1548- (bdcmp(p_data->disc_res.bd_addr, pairing_cb.static_bdaddr.address) == 0)))
1535+ (bdcmp(p_data->disc_res.bd_addr, pairing_cb.static_bdaddr.address) == 0)) &&
1536+ pairing_cb.sdp_attempts > 0)
15491537 {
1550- LOG_INFO(LOG_TAG, "%s Remote Service SDP done.", __FUNCTION__);
1538+ BTIF_TRACE_DEBUG("%s Remote Service SDP done. Call bond_state_changed_cb BONDED",
1539+ __FUNCTION__);
15511540 pairing_cb.sdp_attempts = 0;
15521541
1553- // Both SDP and bonding are done, clear pairing control block
1554- memset(&pairing_cb, 0, sizeof(pairing_cb));
1555-
1556- // Send one empty UUID to Java to unblock pairing intent when SDP failed
1557- // or no UUID is discovered
1558- if (p_data->disc_res.result == BTA_SUCCESS ||
1559- p_data->disc_res.num_uuids == 0) {
1560- LOG_INFO(LOG_TAG, "%s: SDP failed, send empty UUID to unblock bonding",
1561- __func__);
1562- bt_property_t prop;
1563- bt_uuid_t uuid = {};
1564- char uuid_str[128] = UUID_EMPTY;
1565-
1566- string_to_uuid(uuid_str, &uuid);
1567-
1568- prop.type = BT_PROPERTY_UUIDS;
1569- prop.val = uuid.uu;
1570- prop.len = MAX_UUID_SIZE;
1542+ // If bonding occured due to cross-key pairing, send bonding callback
1543+ // for static address now
1544+ if (bdcmp(p_data->disc_res.bd_addr, pairing_cb.static_bdaddr.address) == 0)
1545+ bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDING);
15711546
1572- /* Send the event to the BTIF */
1573- HAL_CBACK(bt_hal_cbacks, remote_device_properties_cb,
1574- BT_STATUS_SUCCESS, &bd_addr, 1, &prop);
1575- break;
1576- }
1547+ bond_state_changed(BT_STATUS_SUCCESS, &bd_addr, BT_BOND_STATE_BONDED);
15771548 }
15781549
15791550 if (p_data->disc_res.num_uuids != 0)
@@ -1797,7 +1768,7 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
17971768 break;
17981769
17991770 case BTA_DM_BOND_CANCEL_CMPL_EVT:
1800- if (is_bonding_or_sdp())
1771+ if (pairing_cb.state == BT_BOND_STATE_BONDING)
18011772 {
18021773 bdcpy(bd_addr.address, pairing_cb.bd_addr);
18031774 btm_set_bond_type_dev(pairing_cb.bd_addr, BOND_TYPE_UNKNOWN);
@@ -2464,7 +2435,7 @@ bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr)
24642435 ** 1. Restore scan modes
24652436 ** 2. special handling for HID devices
24662437 */
2467- if (is_bonding_or_sdp())
2438+ if (pairing_cb.state == BT_BOND_STATE_BONDING)
24682439 {
24692440
24702441 #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
@@ -2526,7 +2497,7 @@ bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr)
25262497
25272498 void btif_dm_hh_open_failed(bt_bdaddr_t *bdaddr)
25282499 {
2529- if (is_bonding_or_sdp() &&
2500+ if (pairing_cb.state == BT_BOND_STATE_BONDING &&
25302501 bdcmp(bdaddr->address, pairing_cb.bd_addr) == 0)
25312502 {
25322503 bond_state_changed(BT_STATUS_FAIL, bdaddr, BT_BOND_STATE_NONE);
@@ -3166,11 +3137,6 @@ static void btif_dm_ble_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
31663137 break;
31673138 }
31683139 }
3169- if (state == BT_BOND_STATE_BONDED &&
3170- (bdcmp(bd_addr.address, pairing_cb.static_bdaddr.address) != 0)) {
3171- // Report RPA bonding state to Java in crosskey paring
3172- bond_state_changed(status, &bd_addr, BT_BOND_STATE_BONDING);
3173- }
31743140 bond_state_changed(status, &bd_addr, state);
31753141 }
31763142
@@ -3521,7 +3487,7 @@ bt_status_t btif_le_test_mode(uint16_t opcode, uint8_t *buf, uint8_t len)
35213487 void btif_dm_on_disable()
35223488 {
35233489 /* cancel any pending pairing requests */
3524- if (is_bonding_or_sdp())
3490+ if (pairing_cb.state == BT_BOND_STATE_BONDING)
35253491 {
35263492 bt_bdaddr_t bd_addr;
35273493