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

Commit 5c289646 authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by Android Git Automerger
Browse files
parents fe5d9f52 7f74d534
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public final class BluetoothUuid {
    }

    public static boolean isHandsfree(UUID uuid) {
        return uuid.equals(Handsfree) || uuid.equals(HandsfreeAudioGateway);
        return uuid.equals(Handsfree);
    }

    public static boolean isHeadset(UUID uuid) {
+14 −1
Original line number Diff line number Diff line
@@ -104,7 +104,8 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
                    break;
                }
            } else if (action.equals(BluetoothIntent.REMOTE_DEVICE_CONNECTED_ACTION)) {
                if (getSinkPriority(address) > BluetoothA2dp.PRIORITY_OFF) {
                if (getSinkPriority(address) > BluetoothA2dp.PRIORITY_OFF &&
                        isSinkDevice(address)) {
                    // This device is a preferred sink. Make an A2DP connection
                    // after a delay. We delay to avoid connection collisions,
                    // and to give other profiles such as HFP a chance to
@@ -185,6 +186,18 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
        return -1;
    }

    private boolean isSinkDevice(String address) {
        String uuids[] = mBluetoothService.getRemoteUuids(address);
        UUID uuid;
        for (String deviceUuid: uuids) {
            uuid = UUID.fromString(deviceUuid);
            if (BluetoothUuid.isAudioSink(uuid)) {
                return true;
            }
        }
        return false;
    }

    private synchronized boolean addAudioSink (String address) {
        String path = mBluetoothService.getObjectPathFromAddress(address);
        String propValues[] = (String []) getSinkPropertiesNative(path);
+1 −3
Original line number Diff line number Diff line
@@ -371,9 +371,7 @@ class BluetoothEventLoop {

        boolean authorized = false;
        UUID uuid = UUID.fromString(deviceUuid);
        if (mBluetoothService.isEnabled() && (BluetoothUuid.isAudioSink(uuid) ||
                                              BluetoothUuid.isAudioSource(uuid) ||
                                              BluetoothUuid.isAdvAudioDist(uuid))) {
        if (mBluetoothService.isEnabled() && BluetoothUuid.isAudioSink(uuid)) {
            BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
            authorized = a2dp.getSinkPriority(address) > BluetoothA2dp.PRIORITY_OFF;
            if (authorized) {