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

Commit a9a33da6 authored by Dorin Drimus's avatar Dorin Drimus Committed by Hongguang Chen
Browse files

Use the "bluetooth.core.gap.le.conn.min.limit" sysprop config

Tag: #feature
Bug: 240709612
Test: Build ADT3 with sysprop config
Change-Id: Ia51b8eeb0fc61dd6990a800f26d5d8954c363805
Merged-In: I8b2dafeaebf4fa8fae434bff0c937db9c14f3f9b
Merged-In: I99ea709fe591ca362208547051d7fd5810ed42ed
parent 52286539
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -179,9 +179,6 @@ cc_defaults {
                "libfmq",
                "libstatslog_bt",
            ],
            whole_static_libs: [
                "PlatformProperties",
            ],
            srcs: ["src/btif_avrcp_audio_track.cc"],
        },
        host: {
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ fluoride_defaults {
                "libhidlbase",
                "libstatslog_bt",
                "libutils",
                "PlatformProperties",
            ],
            cflags: [
                "-DOS_ANDROID",
+14 −0
Original line number Diff line number Diff line
@@ -27,6 +27,10 @@
#include <base/logging.h>
#include <base/strings/stringprintf.h>

#ifdef OS_ANDROID
#include <android/sysprop/BluetoothProperties.sysprop.h>
#endif

#include "bt_target.h"
#include "bta/include/bta_hearing_aid_api.h"
#include "device/include/controller.h"
@@ -35,6 +39,7 @@
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_dev.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/acl_api.h"
@@ -1582,7 +1587,16 @@ tL2CAP_LE_RESULT_CODE l2ble_sec_access_req(const RawAddress& bd_addr,
void L2CA_AdjustConnectionIntervals(uint16_t* min_interval,
                                    uint16_t* max_interval,
                                    uint16_t floor_interval) {
  // Allow for customization by systemprops for mainline
  uint16_t phone_min_interval = floor_interval;
  #ifdef OS_ANDROID
    phone_min_interval =
        android::sysprop::BluetoothProperties::getGapLeConnMinLimit().value_or(
            floor_interval);
  #else
    phone_min_interval = (uint16_t)osi_property_get_int32(
      "bluetooth.core.gap.le.conn.min.limit", (int32_t)floor_interval);
  #endif

  if (HearingAid::GetDeviceCount() > 0) {
    // When there are bonded Hearing Aid devices, we will constrained this