Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbb0bb88 authored by Andriy Naborskyy's avatar Andriy Naborskyy
Browse files

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
parent c36b9a0b
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
@@ -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++",
+8 −3
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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",
    ],