summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andriy Naborskyy <andriyn@google.com> 2024-02-09 00:33:35 +0000
committer Andriy Naborskyy <andriyn@google.com> 2024-02-09 18:04:29 +0000
commitbbb0bb881644d4f174c3f20bad5739dae378c4ed (patch)
tree2ada2ac4ef733495029fc3309385a2657cac4bd4
parentc36b9a0b0e2223518ac738e197deb5f7345fdc4f (diff)
configurable private address rotation intervals
Bug: 322406148 Test: override on device and check address rotation frequency. Test: m com.android.btservices Flag: EXEMPT no logical change, add sysprop Change-Id: Id11194f2af59d9426c9362af6086a23eaf16e383
-rw-r--r--sysprop/ble.sysprop16
-rw-r--r--system/gd/Android.bp7
-rw-r--r--system/gd/security/internal/security_manager_impl.cc11
-rw-r--r--system/main/Android.bp2
4 files changed, 33 insertions, 3 deletions
diff --git a/sysprop/ble.sysprop b/sysprop/ble.sysprop
index 50723897c6..ad2208f0b1 100644
--- a/sysprop/ble.sysprop
+++ b/sysprop/ble.sysprop
@@ -8,3 +8,19 @@ prop {
access: Readonly
prop_name: "bluetooth.ble.vnd.included"
}
+
+prop {
+ api_name: "random_address_rotation_interval_min"
+ type: Integer
+ scope: Internal
+ access: Readonly
+ prop_name: "bluetooth.ble.random_address_rotation_interval_min"
+}
+
+prop {
+ api_name: "random_address_rotation_interval_max"
+ type: Integer
+ scope: Internal
+ access: Readonly
+ prop_name: "bluetooth.ble.random_address_rotation_interval_max"
+}
diff --git a/system/gd/Android.bp b/system/gd/Android.bp
index e3ec8eb285..46696e9bdf 100644
--- a/system/gd/Android.bp
+++ b/system/gd/Android.bp
@@ -181,6 +181,7 @@ cc_defaults {
"libbt-platform-protos-lite",
"libbt_shim_bridge",
"libbt_shim_ffi",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libosi",
"server_configurable_flags",
],
@@ -318,10 +319,12 @@ cc_binary {
"libbt_shim_bridge",
"libbt_shim_ffi",
"libchrome",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libflatbuffers-cpp",
"libosi",
],
shared_libs: [
+ "libPlatformProperties",
"libcrypto",
"libgrpc++",
"libgrpc_wrap",
@@ -449,12 +452,14 @@ cc_test {
"libbt_shim_ffi",
"libc++fs",
"libchrome",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libflagtest",
"libflatbuffers-cpp",
"libgmock",
"libosi",
],
shared_libs: [
+ "libPlatformProperties",
"libbase",
"libcrypto",
"server_configurable_flags",
@@ -583,6 +588,7 @@ cc_defaults {
"libbt_shim_bridge",
"libbt_shim_ffi",
"libchrome",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libgmock",
"libgtest",
"libosi",
@@ -592,6 +598,7 @@ cc_defaults {
"BluetoothGeneratedDumpsysDataSchema_h",
],
shared_libs: [
+ "libPlatformProperties",
"libbase",
"libcrypto",
"libgrpc++",
diff --git a/system/gd/security/internal/security_manager_impl.cc b/system/gd/security/internal/security_manager_impl.cc
index fb49d894f1..4b6d69fec8 100644
--- a/system/gd/security/internal/security_manager_impl.cc
+++ b/system/gd/security/internal/security_manager_impl.cc
@@ -17,6 +17,8 @@
*/
#include "security_manager_impl.h"
+#include <android_bluetooth_sysprop.h>
+
#include "common/bind.h"
#include "hci/address_with_type.h"
#include "hci/octets.h"
@@ -109,9 +111,12 @@ void SecurityManagerImpl::Init() {
hci::LeAddressManager::AddressPolicy address_policy = hci::LeAddressManager::AddressPolicy::USE_RESOLVABLE_ADDRESS;
hci::AddressWithType address_with_type(hci::Address{}, hci::AddressType::RANDOM_DEVICE_ADDRESS);
- /* 7 minutes minimum, 15 minutes maximum for random address refreshing */
- auto minimum_rotation_time = std::chrono::minutes(7);
- auto maximum_rotation_time = std::chrono::minutes(15);
+ /* Default to 7 minutes minimum, 15 minutes maximum for random address refreshing;
+ * device can override. */
+ auto minimum_rotation_time = std::chrono::minutes(
+ GET_SYSPROP(Ble, random_address_rotation_interval_min, 7));
+ auto maximum_rotation_time = std::chrono::minutes(
+ GET_SYSPROP(Ble, random_address_rotation_interval_max, 15));
acl_manager_->SetPrivacyPolicyForInitiatorAddress(
address_policy, address_with_type, minimum_rotation_time, maximum_rotation_time);
diff --git a/system/main/Android.bp b/system/main/Android.bp
index efcce95a30..eb7d8a6b17 100644
--- a/system/main/Android.bp
+++ b/system/main/Android.bp
@@ -219,6 +219,7 @@ cc_test {
"libbt_shim_ffi",
"libbtdevice",
"libchrome",
+ "libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libflatbuffers-cpp",
"libgmock",
@@ -226,6 +227,7 @@ cc_test {
"libosi",
],
shared_libs: [
+ "libPlatformProperties",
"libcrypto",
"server_configurable_flags",
],