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

Commit 78e921d3 authored by Michael Sun's avatar Michael Sun
Browse files

avrcp: Add AVRCP controller profile version sysprop property

This property helps the Bluetooth stack to use different AVRCP control
profiles for different system overlays. This change will primarily
benefit Floss by allowing AVRCP Controller Profile to be qualified with
v1.5. The property also guards the Android against unnecessary uprev to
minimize the interoperability risk and only do so when ready.

Bug: 259144894
Tag: #floss
Test: bluetooth_AdapterAUHealth.au_avrcp_command_test.floss
Change-Id: Idadb91c6cb05741b167c146b371380d32c33c43f
parent 45caa7ea
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ class A2dpInterfaceImpl : public A2dpInterface {

class AvrcpInterfaceImpl : public AvrcpInterface {
 public:
  uint16_t GetAvrcpControlVersion() { return AVRC_GetControlProfileVersion(); }

  uint16_t GetAvrcpVersion() {
    return AVRC_GetProfileVersion();
  }
@@ -312,7 +314,8 @@ void AvrcpService::Init(MediaInterface* media_interface,

  avrcp_interface_.AddRecord(UUID_SERVCLASS_AV_REMOTE_CONTROL,
                             "AV Remote Control", NULL, AVRCP_SUPF_TG_CT,
                             ct_sdp_record_handle, false, AVRC_REV_1_3, 0);
                             ct_sdp_record_handle, false,
                             avrcp_interface_.GetAvrcpControlVersion(), 0);
  bta_sys_add_uuid(UUID_SERVCLASS_AV_REMOTE_CONTROL);

  media_interface_ = new MediaInterfaceWrapper(media_interface);
+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ void SyspropsModule::parse_config(std::string file_path) {
      "bluetooth.core.le.inquiry_scan_window",
      // SCO
      "bluetooth.sco.disable_enhanced_connection",
      // Profile
      "persist.bluetooth.avrcpcontrolversion",
  };

  auto config = storage::LegacyConfigFile::FromPath(file_path).Read(kDefaultCapacity);
+28 −0
Original line number Diff line number Diff line
@@ -948,6 +948,34 @@ static BT_HDR* avrc_pass_msg(tAVRC_MSG_PASS* p_msg) {
  return p_cmd;
}

/******************************************************************************
 *
 * Function         ARVC_GetControlProfileVersion
 *
 * Description      Get the AVRCP profile version
 *
 * Returns          The AVRCP control profile version
 *
 *****************************************************************************/
uint16_t AVRC_GetControlProfileVersion() {
  uint16_t profile_version = AVRC_REV_1_3;
  char avrcp_version[PROPERTY_VALUE_MAX] = {0};
  osi_property_get(AVRC_CONTROL_VERSION_PROPERTY, avrcp_version,
                   AVRC_1_3_STRING);

  if (!strncmp(AVRC_1_6_STRING, avrcp_version, sizeof(AVRC_1_6_STRING))) {
    profile_version = AVRC_REV_1_6;
  } else if (!strncmp(AVRC_1_5_STRING, avrcp_version,
                      sizeof(AVRC_1_5_STRING))) {
    profile_version = AVRC_REV_1_5;
  } else if (!strncmp(AVRC_1_4_STRING, avrcp_version,
                      sizeof(AVRC_1_4_STRING))) {
    profile_version = AVRC_REV_1_4;
  }

  return profile_version;
}

/******************************************************************************
 *
 * Function         ARVC_GetProfileVersion
+16 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@
#define AVRC_VERSION_PROPERTY "persist.bluetooth.avrcpversion"
#endif

/* Configurable avrcp control version key */
#ifndef AVRC_CONTROL_VERSION_PROPERTY
#define AVRC_CONTROL_VERSION_PROPERTY "persist.bluetooth.avrcpcontrolversion"
#endif

#ifndef AVRC_1_6_STRING
#define AVRC_1_6_STRING "avrcp16"
#endif
@@ -237,6 +242,17 @@ typedef struct {
 *  external function declarations
 ****************************************************************************/

/******************************************************************************
 *
 * Function         AVRC_GetControlProfileVersion
 *
 * Description      Get the overlaid AVRCP control profile version
 *
 * Returns          The AVRCP control profile version
 *
 *****************************************************************************/
extern uint16_t AVRC_GetControlProfileVersion();

/******************************************************************************
 *
 * Function         ARVC_GetProfileVersion
+4 −0
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@ uint16_t AVRC_CloseBrowse(uint8_t handle) {
  mock_function_count_map[__func__]++;
  return 0;
}
uint16_t AVRC_GetControlProfileVersion() {
  mock_function_count_map[__func__]++;
  return 0;
}
uint16_t AVRC_GetProfileVersion() {
  mock_function_count_map[__func__]++;
  return 0;