Skip to content

Commit

Permalink
configurable private address rotation intervals
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andriynab committed Feb 9, 2024
1 parent c36b9a0 commit bbb0bb8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
16 changes: 16 additions & 0 deletions sysprop/ble.sysprop
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
7 changes: 7 additions & 0 deletions system/gd/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -583,6 +588,7 @@ cc_defaults {
"libbt_shim_bridge",
"libbt_shim_ffi",
"libchrome",
"libcom.android.sysprop.bluetooth.wrapped",
"libgmock",
"libgtest",
"libosi",
Expand All @@ -592,6 +598,7 @@ cc_defaults {
"BluetoothGeneratedDumpsysDataSchema_h",
],
shared_libs: [
"libPlatformProperties",
"libbase",
"libcrypto",
"libgrpc++",
Expand Down
11 changes: 8 additions & 3 deletions system/gd/security/internal/security_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions system/main/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,15 @@ cc_test {
"libbt_shim_ffi",
"libbtdevice",
"libchrome",
"libcom.android.sysprop.bluetooth.wrapped",
"libevent",
"libflatbuffers-cpp",
"libgmock",
"liblog",
"libosi",
],
shared_libs: [
"libPlatformProperties",
"libcrypto",
"server_configurable_flags",
],
Expand Down

0 comments on commit bbb0bb8

Please sign in to comment.