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

Commit d087be5e authored by Sungsoo Lim's avatar Sungsoo Lim Committed by Automerger Merge Worker
Browse files

Merge "Activate connected a2dp devices via AudioRoutingManager" into main am:...

Merge "Activate connected a2dp devices via AudioRoutingManager" into main am: d48deae2 am: 66603f0d am: b42c21bd am: b2fda6a5

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



Change-Id: I676feb73509bdf6b80ed9f43efd9bb2448d60e37
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6296a6e1 b2fda6a5
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -17,10 +17,12 @@
package com.android.bluetooth.a2dp;

import static android.Manifest.permission.BLUETOOTH_CONNECT;

import static com.android.bluetooth.Utils.checkCallerTargetSdk;
import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission;
import static com.android.bluetooth.Utils.enforceCdmAssociation;
import static com.android.bluetooth.Utils.hasBluetoothPrivilegedPermission;

import static java.util.Objects.requireNonNull;

import android.annotation.NonNull;
@@ -57,6 +59,7 @@ import android.util.Log;

import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Flags;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.MetricsLogger;
@@ -1341,11 +1344,13 @@ public class A2dpService extends ProfileService {
        if (toState == BluetoothProfile.STATE_CONNECTED) {
            MetricsLogger.logProfileConnectionEvent(BluetoothMetricsProto.ProfileId.A2DP);
        }
        if (!Flags.audioRoutingCentralization()) {
            // Set the active device if only one connected device is supported and it was connected
            if (toState == BluetoothProfile.STATE_CONNECTED && (mMaxConnectedAudioDevices == 1)) {
                setActiveDevice(device);
            }
            // When disconnected, ActiveDeviceManager will call setActiveDevice(null)
        }

        // Check if the device is disconnected - if unbond, remove the state machine
        if (toState == BluetoothProfile.STATE_DISCONNECTED) {