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

Commit 04240317 authored by Jack He's avatar Jack He
Browse files

HFP: Use disableinbandringing instead of enableinbandringing

* Use disableinbandringing system property as in-band ringing is enabled
  by default so an active user choice would disable it instead of
  enabling it

Bug: 65383086
Test: make, try toggling the preference and verify in-band ringing
      behavior

Change-Id: I9b10743960c933b223481d2efb68af538689c507
Merged-In: I9b10743960c933b223481d2efb68af538689c507
(cherry picked from commit c09eec0e)
parent 04833343
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -626,12 +626,12 @@ static void bte_hf_evt(tBTA_AG_EVT event, tBTA_AG* p_data) {
  ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
}

static bool inband_ringing_property_enabled() {
  char inband_ringing_flag[PROPERTY_VALUE_MAX] = {0};
  osi_property_get("persist.bluetooth.enableinbandringing", inband_ringing_flag,
                   "true");
  if (strncmp(inband_ringing_flag, "true", 4) == 0) {
    BTIF_TRACE_DEBUG("%s: In-band ringing enabled by property", __func__);
static bool inband_ringing_property_disabled() {
  char disable_inband_ringing_flag[PROPERTY_VALUE_MAX] = {0};
  osi_property_get("persist.bluetooth.disableinbandringing",
                   disable_inband_ringing_flag, "false");
  if (strncmp(disable_inband_ringing_flag, "true", 4) == 0) {
    BTIF_TRACE_DEBUG("%s: In-band ringing disabled by property", __func__);
    return true;
  }
  return false;
@@ -737,8 +737,8 @@ class HeadsetInterface : Interface {

bt_status_t HeadsetInterface::Init(Callbacks* callbacks, int max_hf_clients,
                                   bool inband_ringing_supported) {
  bool inband_ringing_property_enable = inband_ringing_property_enabled();
  if (inband_ringing_supported && inband_ringing_property_enable) {
  bool inband_ringing_property_disable = inband_ringing_property_disabled();
  if (inband_ringing_supported && !inband_ringing_property_disable) {
    btif_hf_features |= BTA_AG_FEAT_INBAND;
  } else {
    btif_hf_features &= ~BTA_AG_FEAT_INBAND;
@@ -748,7 +748,7 @@ bt_status_t HeadsetInterface::Init(Callbacks* callbacks, int max_hf_clients,
      "%s: btif_hf_features=%zu, max_hf_clients=%d, "
      "inband_ringing=[supported=%d, enabled=%d]",
      __func__, btif_hf_features, btif_max_hf_clients, inband_ringing_supported,
      inband_ringing_property_enable);
      !inband_ringing_property_disable);
  bt_hf_callbacks = callbacks;
  for (btif_hf_cb_t& hf_cb : btif_hf_cb) {
    hf_cb = {};