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

Commit b9d0c19d authored by William Escande's avatar William Escande Committed by Android (Google) Code Review
Browse files

Merge changes from topic "cherrypicker-L13700000958927953:N69400001343558341" into tm-qpr-dev

* changes:
  Add hfp sysprop for hf services
  Add bta sysprop for disable delay
parents 41bd8a06 7728654b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ sysprop_library {
  host_supported: true,
  srcs: [
    "avrcp.sysprop",
    "bta.sysprop",
    "hfp.sysprop",
  ],
  property_owner: "Platform",
  api_packages: ["android.sysprop"],

sysprop/bta.sysprop

0 → 100644
+12 −0
Original line number Diff line number Diff line
module: "android.sysprop.bluetooth.Bta"
owner: Platform

prop {
    api_name: "disable_delay"
    type: Integer
    scope: Internal
    access: Readonly
    prop_name: "bluetooth.bta.disable_delay.millis"
}

sysprop/hfp.sysprop

0 → 100644
+12 −0
Original line number Diff line number Diff line
module: "android.sysprop.bluetooth.Hfp"
owner: Platform

prop {
    api_name: "hf_services"
    type: Integer
    scope: Internal
    access: Readonly
    prop_name: "bluetooth.hfp.hf_services_mask.config"
}

+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ cc_library_static {
    static_libs: [
        "avrcp-target-service",
        "lib-bt-packets",
        "libcom.android.sysprop.bluetooth",
    ],
    generated_headers: [
        "LeAudioSetConfigSchemas_h",
@@ -297,6 +298,7 @@ cc_test {
        "libbt-common",
        "libbt-protos-lite",
        "libbtcore",
        "libcom.android.sysprop.bluetooth",
        "libflatbuffers-cpp",
        "libgmock",
    ],
+14 −9
Original line number Diff line number Diff line
@@ -26,6 +26,9 @@
#define LOG_TAG "bt_bta_dm"

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

#include <cstdint>

@@ -157,16 +160,18 @@ static void bta_dm_ctrl_features_rd_cmpl_cback(tHCI_STATUS result);
#define BTA_DM_SWITCH_DELAY_TIMER_MS 500
#endif

namespace {

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

struct WaitForAllAclConnectionsToDrain {
  uint64_t time_to_wait_in_ms;
@@ -450,15 +455,15 @@ void bta_dm_disable() {

  if (BTM_GetNumAclLinks() == 0) {
    // We can shut down faster if there are no ACL links
    switch (kDisableDelayTimerInMs) {
    switch (get_DisableDelayTimerInMs()) {
      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>(kDisableDelayTimerInMs));
        alarm_set_on_mloop(bta_dm_cb.disable_timer, kDisableDelayTimerInMs,
                  static_cast<unsigned long>(get_DisableDelayTimerInMs()));
        alarm_set_on_mloop(bta_dm_cb.disable_timer, get_DisableDelayTimerInMs(),
                           bta_dm_disable_conn_down_timer_cback, nullptr);
    }
  } else {
Loading