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

Commit 572d739e authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Add a property to enable the New AVRCP Profile (1/2)

You can now use the new AVRCP Profile by setting
persist.bluetooth.enablenewavrcp to true.

Also fix a misundestanding with connection_handler.cc. AVRCP Control
callbacks return a null address when disconnecting.

Bug: 68854188
Test: Check to see that the profile is used when property is true and is
      not used when property is false.
Change-Id: I4aa285c6bf009716cc80a80b813ba0acd3d8f9d8
(cherry picked from commit ce1a2b3f8d44a017c13a55b5e53abb51886297ad)
Merged-In: I4aa285c6bf009716cc80a80b813ba0acd3d8f9d8
parent c12821c7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ cc_library_shared {
        "android/bluetooth/IBluetoothA2dp.aidl",
        "android/bluetooth/IBluetoothA2dpSink.aidl",
        "android/bluetooth/IBluetoothAvrcpController.aidl",
        "android/bluetooth/IBluetoothAvrcpTarget.aidl",
        "android/bluetooth/IBluetoothCallback.aidl",
        "android/bluetooth/IBluetoothProfileServiceConnection.aidl",
        "android/bluetooth/IBluetoothHeadset.aidl",
@@ -87,6 +88,7 @@ filegroup {
        "android/bluetooth/IBluetoothA2dp.aidl",
        "android/bluetooth/IBluetoothA2dpSink.aidl",
        "android/bluetooth/IBluetoothAvrcpController.aidl",
        "android/bluetooth/IBluetoothAvrcpTarget.aidl",
        "android/bluetooth/IBluetoothCallback.aidl",
        "android/bluetooth/IBluetoothProfileServiceConnection.aidl",
        "android/bluetooth/IBluetoothHeadset.aidl",
+29 −0
Original line number Diff line number Diff line
/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.bluetooth;

/**
 * API for Bluetooth AVRCP Target Interface
 *
 * @hide
 */
interface IBluetoothAvrcpTarget {
    /**
     * @hide
     */
    void sendVolumeChanged(in int volume);
}
+5 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ cc_defaults {
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/btcore/include",
        "packages/modules/Bluetooth/system/btif/avrcp",
        "packages/modules/Bluetooth/system/hci/include",
        "packages/modules/Bluetooth/system/internal_include",
        "packages/modules/Bluetooth/system/stack/include",
@@ -109,7 +110,10 @@ cc_library_static {
        "sys/bta_sys_main.cc",
        "sys/utl.cc",
    ],

    static_libs: [
        "avrcp-target-service",
        "lib-bt-packets",
    ],
    whole_static_libs: [
        "libaudio-hearing-aid-hw-utils",
    ],
+7 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@

#include "a2dp_sbc.h"
#include "avdt_api.h"
#include "avrcp_service.h"
#include "bt_utils.h"
#include "bta_av_int.h"
#include "btif/include/btif_av_co.h"
@@ -2900,8 +2901,13 @@ void bta_av_open_rc(tBTA_AV_SCB* p_scb, tBTA_AV_DATA* p_data) {
      }
    } else {
      /* use main SM for AVRC SDP activities */
      if (is_new_avrcp_enabled()) {
        APPL_TRACE_WARNING("%s: Using the new AVRCP Profile", __func__);
        bluetooth::avrcp::AvrcpService::Get()->ConnectDevice(p_scb->peer_addr);
      } else {
        bta_av_rc_disc((uint8_t)(p_scb->hdi + 1));
      }
    }
  } else {
    if (BTA_AV_RC_HANDLE_NONE != p_scb->rc_handle) {
      /* the open API said that this handle does not want a RC connection.
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include <string.h>

#include "avdt_api.h"
#include "avrcp_service.h"
#include "bta_av_api.h"
#include "bta_av_int.h"
#include "l2c_api.h"
@@ -303,6 +304,12 @@ static void bta_av_rc_msg_cback(uint8_t handle, uint8_t label, uint8_t opcode,
 ******************************************************************************/
uint8_t bta_av_rc_create(tBTA_AV_CB* p_cb, uint8_t role, uint8_t shdl,
                         uint8_t lidx) {
  if (is_new_avrcp_enabled()) {
    APPL_TRACE_WARNING("%s: Skipping RC creation for the old AVRCP profile",
                       __func__);
    return BTA_AV_RC_HANDLE_NONE;
  }

  tAVRC_CONN_CB ccb;
  RawAddress bda = RawAddress::kAny;
  uint8_t status = BTA_AV_RC_ROLE_ACP;
Loading