diff options
-rw-r--r-- | system/btif/src/btif_dm.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc index 6cb0bea5e0..84c7b7e1f6 100644 --- a/system/btif/src/btif_dm.cc +++ b/system/btif/src/btif_dm.cc @@ -572,7 +572,11 @@ static void bond_state_changed(bt_status_t status, const RawAddress& bd_addr, if (pairing_cb.bond_type == BOND_TYPE_TEMPORARY) { state = BT_BOND_STATE_NONE; + } else if (com::android::bluetooth::flags::reset_security_flags_on_pairing_failure() && + state == BT_BOND_STATE_NONE) { + get_security_client_interface().BTM_SecClearSecurityFlags(bd_addr); } + log::info( "Bond state changed to state={}[0:none, 1:bonding, " "2:bonded],prev_state={}, sdp_attempts={}", @@ -581,9 +585,6 @@ static void bond_state_changed(bt_status_t status, const RawAddress& bd_addr, if (state == BT_BOND_STATE_NONE) { forget_device_from_metric_id_allocator(bd_addr); btif_config_remove_device(bd_addr.ToString()); - if (com::android::bluetooth::flags::reset_security_flags_on_pairing_failure()) { - get_security_client_interface().BTM_SecClearSecurityFlags(bd_addr); - } } else if (state == BT_BOND_STATE_BONDED) { allocate_metric_id_from_metric_id_allocator(bd_addr); if (!save_metric_id_from_metric_id_allocator(bd_addr)) { |