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

Commit 1b0f811d authored by Sandeep Samdaria's avatar Sandeep Samdaria Committed by Gerrit Code Review
Browse files

Merge "Replace a2dp co-exist check with inidividual a2dp sysprop check" into main

parents aa532159 c225fee4
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -63,6 +63,10 @@
#include "stack/include/main_thread.h"
#include "types/raw_address.h"

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

using namespace bluetooth;

/*****************************************************************************
@@ -3465,7 +3469,27 @@ bool btif_av_both_enable(void) {
  return (btif_av_sink.Enabled() && btif_av_source.Enabled());
}

bool is_a2dp_source_property_enabled(void) {
#ifdef __ANDROID__
  return android::sysprop::BluetoothProperties::isProfileA2dpSourceEnabled()
      .value_or(false);
#else
  return false;
#endif
}

bool is_a2dp_sink_property_enabled(void) {
#ifdef __ANDROID__
  return android::sysprop::BluetoothProperties::isProfileA2dpSinkEnabled()
      .value_or(false);
#else
  return false;
#endif
}
bool btif_av_src_sink_coexist_enabled(void) {
  if (IS_FLAG_ENABLED(a2dp_concurrent_source_sink)) {
    return is_a2dp_sink_property_enabled() && is_a2dp_source_property_enabled();
  }
  return GET_SYSPROP(A2dp, src_sink_coexist, false);
}

+1 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@ cc_library_static {
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/bta/sys",
        "packages/modules/Bluetooth/system/btif/include",
        "packages/modules/Bluetooth/system/device/include",
        "packages/modules/Bluetooth/system/gd",
        "packages/modules/Bluetooth/system/gd/hal",
+2 −2
Original line number Diff line number Diff line
@@ -27,13 +27,13 @@

#define LOG_TAG "bluetooth"

#include <android_bluetooth_sysprop.h>
#include <bluetooth/log.h>
#include <string.h>

#include "avct_api.h"
#include "avct_int.h"
#include "bta/include/bta_sec_api.h"
#include "btif/include/btif_av.h"
#include "internal_include/bt_target.h"
#include "osi/include/allocator.h"
#include "osi/include/osi.h"
@@ -550,7 +550,7 @@ void avct_bcb_msg_ind(tAVCT_BCB* p_bcb, tAVCT_LCB_EVT* p_data) {
  }

  bool bind = false;
  if (GET_SYSPROP(A2dp, src_sink_coexist, false)) {
  if (btif_av_src_sink_coexist_enabled()) {
    bind = avct_msg_ind_for_src_sink_coexist(p_lcb, p_data, label, cr_ipid);
    osi_free_and_reset((void**)&p_data->p_buf);
    if (bind) return;
+2 −2
Original line number Diff line number Diff line
@@ -23,11 +23,11 @@
 ******************************************************************************/
#define LOG_TAG "avctp"

#include <android_bluetooth_sysprop.h>
#include <bluetooth/log.h>

#include "avct_api.h"
#include "avct_int.h"
#include "btif/include/btif_av.h"
#include "internal_include/bt_target.h"
#include "l2c_api.h"
#include "l2cdefs.h"
@@ -146,7 +146,7 @@ void avct_l2c_connect_ind_cback(const RawAddress& bd_addr, uint16_t lcid,

  /* if result ok, proceed with connection */
  if (result == L2CAP_CONN_OK) {
    if (GET_SYSPROP(A2dp, src_sink_coexist, false)) {
    if (btif_av_src_sink_coexist_enabled()) {
      tAVCT_CCB* p_ccb = &avct_cb.ccb[0];
      for (int i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
        if (p_ccb && p_ccb->allocated && (p_ccb->p_lcb == NULL) &&
+3 −3
Original line number Diff line number Diff line
@@ -22,13 +22,13 @@
 *
 ******************************************************************************/
#include <android_bluetooth_flags.h>
#include <android_bluetooth_sysprop.h>
#include <bluetooth/log.h>
#include <string.h>

#include "avct_api.h"
#include "avct_int.h"
#include "bta/include/bta_sec_api.h"
#include "btif/include/btif_av.h"
#include "device/include/device_iot_config.h"
#include "internal_include/bt_target.h"
#include "osi/include/allocator.h"
@@ -227,7 +227,7 @@ void avct_lcb_open_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) {
  int i;
  bool bind = false;

  if (GET_SYSPROP(A2dp, src_sink_coexist, false)) {
  if (btif_av_src_sink_coexist_enabled()) {
    bool is_originater = false;

    for (i = 0; i < AVCT_NUM_CONN; i++, p_ccb++) {
@@ -680,7 +680,7 @@ void avct_lcb_msg_ind(tAVCT_LCB* p_lcb, tAVCT_LCB_EVT* p_data) {
  }

  bool bind = false;
  if (GET_SYSPROP(A2dp, src_sink_coexist, false)) {
  if (btif_av_src_sink_coexist_enabled()) {
    bind = avct_msg_ind_for_src_sink_coexist(p_lcb, p_data, label, cr_ipid);
    osi_free_and_reset((void**)&p_data->p_buf);
    if (bind) return;
Loading