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

Commit a45c5f07 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 9216

* changes:
  Fix UUID typo and allow incoming AVRCP connections.
parents 77d98f4e ade40526
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
@@ -30,14 +30,13 @@ public final class BluetoothUuid {
     * The following 128 bit values are calculated as:
     *  uuid * 2^96 + BASE_UUID
     */
    public static final UUID AudioSink = UUID.fromString("0000110A-0000-1000-8000-00805F9B34FB");
    public static final UUID AudioSource = UUID.fromString("0000110B-0000-1000-8000-00805F9B34FB");
    public static final UUID AudioSink = UUID.fromString("0000110B-0000-1000-8000-00805F9B34FB");
    public static final UUID AudioSource = UUID.fromString("0000110A-0000-1000-8000-00805F9B34FB");
    public static final UUID AdvAudioDist = UUID.fromString("0000110D-0000-1000-8000-00805F9B34FB");
    public static final UUID HSP       = UUID.fromString("00001108-0000-1000-8000-00805F9B34FB");
    public static final UUID HeadsetHS = UUID.fromString("00001131-0000-1000-8000-00805F9B34FB");
    public static final UUID Handsfree  = UUID.fromString("0000111e-0000-1000-8000-00805F9B34FB");
    public static final UUID HandsfreeAudioGateway
                                          = UUID.fromString("0000111f-0000-1000-8000-00805F9B34FB");
    public static final UUID Handsfree  = UUID.fromString("0000111E-0000-1000-8000-00805F9B34FB");
    public static final UUID AvrcpController =
                                          UUID.fromString("0000110E-0000-1000-8000-00805F9B34FB");

    public static boolean isAudioSource(UUID uuid) {
        return uuid.equals(AudioSource);
@@ -56,7 +55,10 @@ public final class BluetoothUuid {
    }

    public static boolean isHeadset(UUID uuid) {
        return uuid.equals(HSP) || uuid.equals(HeadsetHS);
    }
        return uuid.equals(HSP);
    }

    public static boolean isAvrcpController(UUID uuid) {
        return uuid.equals(AvrcpController);
    }
}
+4 −3
Original line number Diff line number Diff line
@@ -402,13 +402,14 @@ class BluetoothEventLoop {

        boolean authorized = false;
        UUID uuid = UUID.fromString(deviceUuid);
        if (mBluetoothService.isEnabled() && BluetoothUuid.isAudioSink(uuid)) {
        if (mBluetoothService.isEnabled() &&
                (BluetoothUuid.isAudioSink(uuid) || BluetoothUuid.isAvrcpController(uuid))) {
            BluetoothA2dp a2dp = new BluetoothA2dp(mContext);
            authorized = a2dp.getSinkPriority(address) > BluetoothA2dp.PRIORITY_OFF;
            if (authorized) {
                Log.i(TAG, "Allowing incoming A2DP connection from " + address);
                Log.i(TAG, "Allowing incoming A2DP / AVRCP connection from " + address);
            } else {
                Log.i(TAG, "Rejecting incoming A2DP connection from " + address);
                Log.i(TAG, "Rejecting incoming A2DP / AVRCP connection from " + address);
            }
        } else {
            Log.i(TAG, "Rejecting incoming " + deviceUuid + " connection from " + address);