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

Commit 4ea4828f authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge changes I48f2cc9c,If02f6320,I203cfe12,I04cd3781,I16c0ba82, ... into main...

Merge changes I48f2cc9c,If02f6320,I203cfe12,I04cd3781,I16c0ba82, ... into main am: ad627f36 am: 74dc2621

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/3400091



Change-Id: I343b674bf7deb2f841fd67c2af522ca344701cc3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents da655166 74dc2621
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
@@ -92,7 +92,6 @@ public class A2dpService extends ProfileService {
    private final CompanionDeviceManager mCompanionDeviceManager;
    private final Looper mLooper;
    private final Handler mHandler;
    private final HandlerThread mStateMachinesThread;
    // Upper limit of all A2DP devices that are Connected or Connecting
    private final int mMaxConnectedAudioDevices;

@@ -108,9 +107,6 @@ public class A2dpService extends ProfileService {
    // Protect setActiveDevice()/removeActiveDevice() so all invoked is handled sequentially
    private final Object mActiveSwitchingGuard = new Object();

    // Timeout for state machine thread join, to prevent potential ANR.
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    // Upper limit of all A2DP devices: Bonded or Connected
    private static final int MAX_A2DP_STATE_MACHINES = 50;
    // A2DP Offload Enabled in platform
@@ -137,13 +133,6 @@ public class A2dpService extends ProfileService {
        mMaxConnectedAudioDevices = mAdapterService.getMaxConnectedAudioDevices();
        Log.i(TAG, "Max connected audio devices set to " + mMaxConnectedAudioDevices);

        if (!Flags.a2dpServiceLooper()) {
            mStateMachinesThread = new HandlerThread("A2dpService.StateMachines");
            mStateMachinesThread.start();
        } else {
            mStateMachinesThread = null;
        }

        mA2dpCodecConfig = new A2dpCodecConfig(this, mNativeInterface);

        mNativeInterface.init(
@@ -200,15 +189,6 @@ public class A2dpService extends ProfileService {
            mStateMachines.clear();
        }

        if (mStateMachinesThread != null) {
            try {
                mStateMachinesThread.quitSafely();
                mStateMachinesThread.join(SM_THREAD_JOIN_TIMEOUT_MS);
            } catch (InterruptedException e) {
                // Do not rethrow as we are shutting down anyway
            }
        }

        mHandler.removeCallbacksAndMessages(null);
    }

@@ -1015,7 +995,7 @@ public class A2dpService extends ProfileService {
                            device,
                            mNativeInterface,
                            mA2dpOffloadEnabled,
                            Flags.a2dpServiceLooper() ? mLooper : mStateMachinesThread.getLooper());
                            mLooper);
            mStateMachines.put(device, sm);
            return sm;
        }
+4 −21
Original line number Diff line number Diff line
@@ -110,7 +110,6 @@ public class A2dpServiceTest {
    @Parameters(name = "{0}")
    public static List<FlagsParameterization> getParams() {
        return FlagsParameterization.allCombinationsOf(
                Flags.FLAG_A2DP_SERVICE_LOOPER,
                Flags.FLAG_A2DP_BROADCAST_CONNECTION_STATE_WHEN_TURNED_OFF);
    }

@@ -155,19 +154,11 @@ public class A2dpServiceTest {
        doReturn(new ParcelUuid[] {BluetoothUuid.A2DP_SINK})
                .when(mAdapterService)
                .getRemoteUuids(any(BluetoothDevice.class));

        if (!Flags.a2dpServiceLooper()) {
            mLooper.startAutoDispatch();
        }
    }

    @After
    public void tearDown() {
        if (Flags.a2dpServiceLooper()) {
        assertThat(mLooper.dispatchAll()).isEqualTo(0);
        } else {
            mLooper.stopAutoDispatchAndIgnoreExceptions();
        }
        mA2dpService.stop();
    }

@@ -333,7 +324,6 @@ public class A2dpServiceTest {

    /** Test that an outgoing connection times out */
    @Test
    @EnableFlags(Flags.FLAG_A2DP_SERVICE_LOOPER)
    public void testOutgoingConnectTimeout() {
        // Update the device priority so okToConnect() returns true
        when(mDatabaseManager.getProfileConnectionPolicy(sTestDevice, BluetoothProfile.A2DP))
@@ -654,7 +644,6 @@ public class A2dpServiceTest {
     * if the device is unbond.
     */
    @Test
    @EnableFlags(Flags.FLAG_A2DP_SERVICE_LOOPER)
    public void testDeleteStateMachineDisconnectEvents() {
        // Update the device priority so okToConnect() returns true
        when(mDatabaseManager.getProfileConnectionPolicy(sTestDevice, BluetoothProfile.A2DP))
@@ -1255,21 +1244,15 @@ public class A2dpServiceTest {
    // Dispatch messages for the A2dpService looper, and validate
    // that at least one message was handled.
    private void dispatchAtLeastOneMessage() {
        if (Flags.a2dpServiceLooper()) {
        assertThat(mLooper.dispatchAll()).isGreaterThan(0);
    }
    }

    // Validate that no messages are pending on the A2dpService looper.
    private void dispatchNoMessages() {
        if (Flags.a2dpServiceLooper()) {
        assertThat(mLooper.dispatchAll()).isEqualTo(0);
    }
    }

    private void moveTimeForward(long millis) {
        if (Flags.a2dpServiceLooper()) {
        mLooper.moveTimeForward(millis);
    }
}
}
+0 −9
Original line number Diff line number Diff line
@@ -3214,15 +3214,6 @@
    }
  },
  "flags": [
    {
      "flags": [
        "avdtp_error_codes"
      ],
      "tests": [
        "A2DP/SNK/AVP",
        "A2DP/SRC/AVP"
      ]
    },
    {
      "flags": [
        "leaudio_allow_leaudio_only_devices",
+0 −8
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ from typing import Optional, Tuple

logger = logging.getLogger(__name__)

AVRCP_CONNECT_A2DP_WITH_DELAY = 'com.android.bluetooth.flags.avrcp_connect_a2dp_with_delay'
AVDTP_HANDLE_SUSPEND_CFM_BAD_STATE = 'com.android.bluetooth.flags.avdt_handle_suspend_cfm_bad_state'


@@ -280,13 +279,6 @@ class A2dpTest(base_test.BaseTestClass): # type: ignore[misc]
        3. Check AVDTP status on RD1
        """

        # Enable AVRCP connect A2DP delayed feature
        for server in self.devices._servers:
            if isinstance(server, AndroidPandoraServer):
                server.device.adb.shell(['device_config override bluetooth', AVRCP_CONNECT_A2DP_WITH_DELAY,
                                         'true'])  # type: ignore
                break

        # Connect and pair RD1.
        ref1_dut, dut_ref1 = await asyncio.gather(
            initiate_pairing(self.ref1, self.dut.address),
+0 −1
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@ aconfig_declarations {
        "a2dp.aconfig",
        "active_device_manager.aconfig",
        "adapter.aconfig",
        "asha.aconfig",
        "avrcp.aconfig",
        "avrcp_controller.aconfig",
        "bta_dm.aconfig",
Loading