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

Commit 7bfbfbb4 authored by Jakub Rotkiewicz's avatar Jakub Rotkiewicz
Browse files

flag: refactor avrcp_connect_a2dp_delayed

rename flag to avrcp_connect_a2dp_with_delay
and reconfigure as bugfix

Bug: 296962438
Bug: 328406945
Bug: 315241296
Test: m com.android.btservices
Change-Id: I69b42da54067db491c396aea2ff6095a98bd8f2f
parent 0ed8ea93
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ from pandora.security_pb2 import LEVEL2
from threading import Thread
from typing import Optional

AVRCP_CONNECT_A2DP_DELAYED = 'persist.device_config.aconfig_flags.bluetooth.com.android.bluetooth.flags.avrcp_connect_a2dp_delayed'
AVRCP_CONNECT_A2DP_WITH_DELAY = 'persist.device_config.aconfig_flags.bluetooth.com.android.bluetooth.flags.avrcp_connect_a2dp_with_delay'

async def initiate_pairing(device, address) -> Connection:
    """Connect and pair a remote device."""
@@ -264,7 +264,7 @@ class A2dpTest(base_test.BaseTestClass): # type: ignore[misc]
        # Enable AVRCP connect A2DP delayed feature
        for server in self.devices._servers:
            if isinstance(server, AndroidPandoraServer):
                server.device.adb.shell(['setprop', AVRCP_CONNECT_A2DP_DELAYED, 'true'])  # type: ignore
                server.device.adb.shell(['setprop', AVRCP_CONNECT_A2DP_WITH_DELAY, 'true'])  # type: ignore
                break

        # Connect and pair RD1.
+4 −1
Original line number Diff line number Diff line
@@ -2,10 +2,13 @@ package: "com.android.bluetooth.flags"
container: "com.android.btservices"

flag {
    name: "avrcp_connect_a2dp_delayed"
    name: "avrcp_connect_a2dp_with_delay"
    namespace: "bluetooth"
    description: "When peer device connects AVRCP but not A2DP we initiate A2DP connection after some time delay"
    bug: "328406945"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
+1 −1
Original line number Diff line number Diff line
@@ -2854,7 +2854,7 @@ static void btif_av_source_initiate_av_open_timer_timeout(void* data) {
  BtifAvPeer* peer = reinterpret_cast<BtifAvPeer*>(data);
  bool device_connected = false;

  if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed() && is_new_avrcp_enabled()) {
  if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay() && is_new_avrcp_enabled()) {
    // check if device is connected
    if (bluetooth::avrcp::AvrcpService::Get() != nullptr) {
      device_connected =
+1 −1
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@ void ConnectionHandler::AcceptorControlCb(uint8_t handle, uint8_t event, uint16_
      // as this one which will be closed when the device is disconnected.
      AvrcpConnect(false, RawAddress::kAny);

      if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed()) {
      if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay()) {
        // Check peer audio role: src or sink and connect A2DP after 3 seconds
        SdpLookupAudioRole(handle);
      }
+4 −4
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ TEST_F(AvrcpConnectionHandlerTest, remoteDeviceConnectionTest) {
  // device connects.
  EXPECT_CALL(mock_avrcp_, OpenBrowse(1, AVCT_ACP)).Times(1);

  if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed()) {
  if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay()) {
    // Set an expectation that SDP for audio will be performed
    EXPECT_CALL(mock_a2dp_, find_audio_sink_service(_, _)).Times(1);
  }
@@ -245,7 +245,7 @@ TEST_F(AvrcpConnectionHandlerTest, noAbsoluteVolumeTest) {
  tAVRC_FIND_CBACK sdp_cb;
  SetUpSdp(&sdp_cb, false, false);

  if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed()) {
  if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay()) {
    // Set an expectation that SDP for audio will be performed
    EXPECT_CALL(mock_a2dp_, find_audio_sink_service(_, _)).Times(1);
  }
@@ -289,7 +289,7 @@ TEST_F(AvrcpConnectionHandlerTest, absoluteVolumeTest) {
  tAVRC_FIND_CBACK sdp_cb;
  SetUpSdp(&sdp_cb, false, true);

  if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed()) {
  if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay()) {
    // Set an expectation that SDP for audio will be performed
    EXPECT_CALL(mock_a2dp_, find_audio_sink_service(_, _)).Times(1);
  }
@@ -321,7 +321,7 @@ TEST_F(AvrcpConnectionHandlerTest, disconnectTest) {
                                            &mock_volume_));
  connection_handler_ = ConnectionHandler::Get();

  if (com::android::bluetooth::flags::avrcp_connect_a2dp_delayed()) {
  if (com::android::bluetooth::flags::avrcp_connect_a2dp_with_delay()) {
    // Set an expectation that SDP for audio will be performed
    EXPECT_CALL(mock_a2dp_, find_audio_sink_service(_, _)).Times(1);
  }