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

Commit 73dfbd09 authored by William Escande's avatar William Escande Committed by Jakub Rotkiewicz
Browse files

Sysprop: move current usage to wrapper

Test: m Bluetooth | No-op change
Fix: 310741104
Bug: 310741104
Change-Id: Iacbe948a72bec99b3be262eaca497c1bcbfaf7df
parent df834d67
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ cc_test {
    ],
    static_libs: [
        "crypto_toolbox_for_tests",
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
@@ -1195,6 +1196,7 @@ cc_test {
    ],
    static_libs: [
        "crypto_toolbox_for_tests",
        "libbase",
        "libbluetooth-types",
        "libbluetooth_gd",
        "libbluetooth_hci_pdl",
+8 −19
Original line number Diff line number Diff line
@@ -25,11 +25,9 @@

#define LOG_TAG "bt_bta_dm"

#include <android_bluetooth_sysprop.h>
#include <base/location.h>
#include <base/logging.h>
#ifdef __ANDROID__
#include <bta.sysprop.h>
#endif

#include <cstdint>

@@ -120,18 +118,6 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tHCI_STATUS result);
#define PROPERTY_PAGE_TIMEOUT "bluetooth.core.classic.page_timeout"
#endif

// Time to wait after receiving shutdown request to delay the actual shutdown
// process. This time may be zero which invokes immediate shutdown.
static uint64_t get_DisableDelayTimerInMs() {
#ifndef __ANDROID__
  return 200;
#else
  static const uint64_t kDisableDelayTimerInMs =
      android::sysprop::bluetooth::Bta::disable_delay().value_or(200);
  return kDisableDelayTimerInMs;
#endif
}

void bta_dm_disc_disable_search_and_disc();
void bta_dm_disc_discover_next_device();
void bta_dm_disc_gatt_refresh(const RawAddress& bd_addr);
@@ -334,17 +320,20 @@ void bta_dm_disable() {

  connection_manager::reset(false);

  if (BTM_GetNumAclLinks() == 0) {
  // We can shut down faster if there are no ACL links
    switch (get_DisableDelayTimerInMs()) {
  if (BTM_GetNumAclLinks() == 0) {
    // Time to wait after receiving shutdown request to delay the actual
    // shutdown process. This time may be zero which invokes immediate shutdown.
    const uint64_t disable_delay_ms = GET_SYSPROP(Bta, disable_delay, 200);
    switch (disable_delay_ms) {
      case 0:
        LOG_DEBUG("Immediately disabling device manager");
        bta_dm_disable_conn_down_timer_cback(nullptr);
        break;
      default:
        LOG_DEBUG("Set timer to delay disable initiation:%lu ms",
                  static_cast<unsigned long>(get_DisableDelayTimerInMs()));
        alarm_set_on_mloop(bta_dm_cb.disable_timer, get_DisableDelayTimerInMs(),
                  static_cast<unsigned long>(disable_delay_ms));
        alarm_set_on_mloop(bta_dm_cb.disable_timer, disable_delay_ms,
                           bta_dm_disable_conn_down_timer_cback, nullptr);
    }
  } else {
+2 −5
Original line number Diff line number Diff line
@@ -16,17 +16,14 @@

#define LOG_TAG "bt_bta_dm"

#include <base/logging.h>
#ifdef __ANDROID__
#include <bta.sysprop.h>
#endif
#include "bta/dm/bta_dm_disc.h"

#include <base/logging.h>
#include <base/strings/stringprintf.h>
#include <stddef.h>

#include <cstdint>

#include "bta/dm/bta_dm_disc.h"
#include "bta/dm/bta_dm_int.h"
#include "bta/include/bta_api.h"
#include "bta/include/bta_gatt_api.h"
+0 −3
Original line number Diff line number Diff line
@@ -17,9 +17,6 @@
#define LOG_TAG "bt_bta_dm_sec"

#include <base/logging.h>
#ifdef __ANDROID__
#include <bta.sysprop.h>
#endif

#include <cstdint>

+3 −12
Original line number Diff line number Diff line
@@ -26,11 +26,9 @@

#include "bta/include/bta_hf_client_api.h"

#include <cstdint>
#include <android_bluetooth_sysprop.h>

#ifdef __ANDROID__
#include <hfp.sysprop.h>
#endif
#include <cstdint>

#include "bt_trace.h"  // Legacy trace logging
#include "bta/hf_client/bta_hf_client_int.h"
@@ -224,12 +222,5 @@ int get_default_hf_client_features() {
   BTA_HF_CLIENT_FEAT_CLI | BTA_HF_CLIENT_FEAT_VREC | BTA_HF_CLIENT_FEAT_VOL | \
   BTA_HF_CLIENT_FEAT_ECS | BTA_HF_CLIENT_FEAT_ECC | BTA_HF_CLIENT_FEAT_CODEC)

#ifdef __ANDROID__
  static const int features =
      android::sysprop::bluetooth::Hfp::hf_client_features().value_or(
          DEFAULT_BTIF_HF_CLIENT_FEATURES);
  return features;
#else
  return DEFAULT_BTIF_HF_CLIENT_FEATURES;
#endif
  return GET_SYSPROP(Hfp, hf_client_features, DEFAULT_BTIF_HF_CLIENT_FEATURES);
}
Loading