summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Himanshu Rawat <rwt@google.com> 2025-03-07 15:42:42 -0800
committer Himanshu Rawat <rwt@google.com> 2025-03-07 15:42:42 -0800
commit9a1628bacbf0bcbb86aeecab36b8fa5544869cd6 (patch)
tree62b409dd3267e87e1ee8727d181accc1f71b705c
parentbd5c58137e348a7f0e6c60e4798a1069f9188ade (diff)
Don't reset security flags after temporary pairing
Temporary pairing also results in BOND_NONE state after successful pairing. Security flags should not be reset after temporary pairing. Test: atest pts-bot:GAP/SEC/SEM/BV-04-C Test: Manual | Initiate pairing to the keyboard, cancel the pairing, discover devices again, the keyboard should be found Flag: com.android.bluetooth.flags.reset_security_flags_on_pairing_failure Bug: 340403395 Bug: 401437333 Bug: 400586238 Change-Id: I72055d848c76994be7bddf6df95e37dba90c4870
-rw-r--r--system/btif/src/btif_dm.cc7
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)) {