diff options
author | 2024-04-03 21:28:10 +0000 | |
---|---|---|
committer | 2024-04-09 05:47:26 +0000 | |
commit | 6e18bacb7d005d79d4ae03684d01a99f05999c48 (patch) | |
tree | ff9ec22acaa8e58443c926c98dc6b2a1cdf5876e | |
parent | c6064cbee392436b8bfb3e144788e4816b2e417e (diff) |
Allow LE encryption while BR/EDR encryption is going on
LE encryption request was rejected if the stack was encrypting BR/EDR
transport. There is no such restriction in the specification. BT
controllers should be able to encrypt both the transports at the same
time.
Added a system property to all platforms to allow LE encryption when
BR/EDR encryption is going on.
Test: mmm packages/modules/Bluetooth
Bug: 330704060
Flag: EXEMPT guarded by system property
Change-Id: Ia501de06a1c3f37627b3ae1422ac27ba7f83353c
-rw-r--r-- | sysprop/ble.sysprop | 8 | ||||
-rw-r--r-- | system/stack/btm/btm_ble_sec.cc | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/sysprop/ble.sysprop b/sysprop/ble.sysprop index ad2208f0b1..f6667551de 100644 --- a/sysprop/ble.sysprop +++ b/sysprop/ble.sysprop @@ -24,3 +24,11 @@ prop { access: Readonly prop_name: "bluetooth.ble.random_address_rotation_interval_max" } + +prop { + api_name: "allow_enc_with_bredr" + type: Boolean + scope: Internal + access: Readonly + prop_name: "bluetooth.ble.allow_enc_with_bredr" +} diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc index d61ac51a00..347d35692e 100644 --- a/system/stack/btm/btm_ble_sec.cc +++ b/system/stack/btm/btm_ble_sec.cc @@ -19,6 +19,7 @@ #include "stack/btm/btm_ble_sec.h" +#include <android_bluetooth_sysprop.h> #include <base/strings/stringprintf.h> #include <bluetooth/log.h> @@ -1234,8 +1235,16 @@ tBTM_STATUS btm_ble_start_encrypt(const RawAddress& bda, bool use_stk, return BTM_WRONG_MODE; } - if (p_rec->sec_rec.is_security_state_encrypting()) { - log::warn("Link Encryption is active, Busy!"); + if (p_rec->sec_rec.is_security_state_le_encrypting()) { + log::warn("LE link encryption is active, Busy!"); + return BTM_BUSY; + } + + // Some controllers may not like encrypting both transports at the same time + bool allow_le_enc_with_bredr = GET_SYSPROP(Ble, allow_enc_with_bredr, false); + if (!allow_le_enc_with_bredr && + p_rec->sec_rec.is_security_state_bredr_encrypting()) { + log::warn("BR/EDR link encryption is active, Busy!"); return BTM_BUSY; } |