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

Commit 7e249edb authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Gerrit Code Review
Browse files

Merge "McpService: Align with AVRCP behavior." into main

parents 65da211f a1be3556
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
 * Copyright 2021 HIMSA II K/S - www.himsa.com.
 * Represented by EHIMA - www.ehima.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * Licensed under the Apache License,mu Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
@@ -129,6 +129,17 @@ public class MediaControlGattService implements MediaControlGattServiceInterface

    private static final int INTERVAL_UNAVAILABLE = 0xFFFFFFFF;

    /* This is to match AVRCP behavior */
    @VisibleForTesting
    static final int INITIAL_SUPPORTED_OPCODES =
            Request.SupportedOpcodes.PLAY
                    | Request.SupportedOpcodes.STOP
                    | Request.SupportedOpcodes.PAUSE
                    | Request.SupportedOpcodes.FAST_REWIND
                    | Request.SupportedOpcodes.FAST_FORWARD
                    | Request.SupportedOpcodes.NEXT_TRACK
                    | Request.SupportedOpcodes.PREVIOUS_TRACK;

    private final int mCcid;
    private Map<String, Map<UUID, Short>> mCccDescriptorValues = new HashMap<>();
    private long mFeatures;
@@ -1034,7 +1045,7 @@ public class MediaControlGattService implements MediaControlGattServiceInterface
        updateSeekingSpeedChar(1, notify);
        updatePlayingOrderSupportedChar(SupportedPlayingOrder.SINGLE_ONCE);
        updatePlayingOrderChar(PlayingOrder.SINGLE_ONCE, notify);
        updateSupportedOpcodesChar(Request.SupportedOpcodes.NONE, notify);
        updateSupportedOpcodesChar(INITIAL_SUPPORTED_OPCODES, notify);
    }

    private void setInitialCharacteristicValues() {
+4 −2
Original line number Diff line number Diff line
@@ -355,8 +355,10 @@ public class MediaControlGattServiceTest {
        Assert.assertEquals(characteristic.getProperties(),
                BluetoothGattCharacteristic.PROPERTY_READ
                        | BluetoothGattCharacteristic.PROPERTY_NOTIFY);
        Assert.assertEquals(Request.SupportedOpcodes.NONE,
                characteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 0)
        Assert.assertEquals(
                MediaControlGattService.INITIAL_SUPPORTED_OPCODES,
                characteristic
                        .getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 0)
                        .intValue());

        characteristic = service.getCharacteristic(