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

Commit b06269c1 authored by Ugo Yu's avatar Ugo Yu Committed by William Escande
Browse files

Use system property for sniff idle time in HS

Notifications take longer time to enter sniff mode if HFC is connected.
Use bluetooth.bta_hs_sniff_delay_ms.config to replace the hardcoded
7000ms so we can adjust the sniff time

Bug: 263323082
Bug: 229316487
Test: Connect, enter sniff mode
Change-Id: I200ad8b402814115d0460c5f627aa3becf3c0d62
(cherry picked from commit a6f472f1eea71517188d0849897949f7bb6739d7)
parent 91e97e17
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -26,12 +26,12 @@
#include <cstdint>

#include "bt_target.h"  // Must be first to define build configuration

#include "bta/dm/bta_dm_int.h"
#include "bta/include/bta_api.h"
#include "bta/include/bta_hh_api.h"
#include "bta/include/bta_jv_api.h"
#include "bta/sys/bta_sys.h"
#include "osi/include/properties.h"
#include "types/raw_address.h"

/* page timeout in 625uS */
@@ -127,6 +127,9 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_CFG
};

tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC* get_bta_dm_pm_spec() {
  static uint16_t hs_sniff_delay = uint16_t(
      osi_property_get_int32("bluetooth.bta_hs_sniff_delay_ms.config", 7000));

  static tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC
      bta_dm_pm_spec[BTA_DM_NUM_PM_SPEC] = {
          /* AG : 0 */
@@ -405,7 +408,7 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC* get_bta_dm_pm_spec() {
          {(BTA_DM_PM_SNIFF | BTA_DM_PM_PARK), /* allow park & sniff */
           (BTA_DM_PM_SSR2),                   /* the SSR entry */
           {
               {{BTA_DM_PM_SNIFF, 7000},
               {{BTA_DM_PM_SNIFF, hs_sniff_delay},
                {BTA_DM_PM_NO_ACTION, 0}}, /* conn open sniff  */
               {{BTA_DM_PM_NO_PREF, 0},
                {BTA_DM_PM_NO_ACTION, 0}}, /* conn close  */
@@ -417,7 +420,8 @@ tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC* get_bta_dm_pm_spec() {
                {BTA_DM_PM_NO_ACTION, 0}}, /* sco open, active */
               {{BTA_DM_PM_SNIFF, 7000},
                {BTA_DM_PM_NO_ACTION, 0}}, /* sco close sniff  */
               {{BTA_DM_PM_SNIFF, 7000}, {BTA_DM_PM_NO_ACTION, 0}}, /* idle */
               {{BTA_DM_PM_SNIFF, hs_sniff_delay},
                {BTA_DM_PM_NO_ACTION, 0}},                        /* idle */
               {{BTA_DM_PM_ACTIVE, 0}, {BTA_DM_PM_NO_ACTION, 0}}, /* busy */
               {{BTA_DM_PM_RETRY, 7000},
                {BTA_DM_PM_NO_ACTION, 0}} /* mode change retry */