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

Commit 1918671f authored by ming.lo's avatar ming.lo Committed by daren.liao
Browse files

Fix avrcp volume asynchronous

[Description]
The host side adjusts the volume,
some speaker will return the volume to the host.

However, due to the calculation deviation,
the volume on both sides is inconsistent.

Bug: 213544314
[Test Report]
Test: 1. A2DP Source: PASS
      2. AVRCP Target: PASS

Change-Id: I69a9fe83a7453c5ddea06480862a464c176c4ae1
parent bed6e09d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ class AvrcpVolumeManager extends AudioDeviceCallback {

    void setVolume(@NonNull BluetoothDevice device, int avrcpVolume) {
        int deviceVolume =
                (int) Math.floor((double) avrcpVolume * sDeviceMaxVolume / AVRCP_MAX_VOL);
                (int) Math.round((double) avrcpVolume * sDeviceMaxVolume / AVRCP_MAX_VOL);
        mVolumeEventLogger.logd(DEBUG, TAG, "setVolume:"
                        + " device=" + device
                        + " avrcpVolume=" + avrcpVolume
@@ -194,7 +194,7 @@ class AvrcpVolumeManager extends AudioDeviceCallback {
            return;
        }
        int avrcpVolume =
                (int) Math.floor((double) deviceVolume * AVRCP_MAX_VOL / sDeviceMaxVolume);
                (int) Math.round((double) deviceVolume * AVRCP_MAX_VOL / sDeviceMaxVolume);
        if (avrcpVolume > 127) avrcpVolume = 127;
        mVolumeEventLogger.logd(DEBUG, TAG, "sendVolumeChanged:"
                        + " device=" + device