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

Commit efb3a1fc authored by Vlad Popa's avatar Vlad Popa
Browse files

Add some improvements in abs vol sync with audio server

Also improve logging in AudioService

Flag: EXEMPT bugfix
Test: manual
Bug: 350103953
Change-Id: Ic3a9f2a9d7aea6cb82892d9943d19dc9ec8fd5c5
parent 73e56ea3
Loading
Loading
Loading
Loading
+16 −7
Original line number Diff line number Diff line
@@ -1583,8 +1583,11 @@ public class AudioService extends IAudioService.Stub
        synchronized (mCachedAbsVolDrivingStreamsLock) {
            mCachedAbsVolDrivingStreams.forEach((dev, stream) -> {
                mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", /*enabled=*/true,
                        stream);
                boolean enabled = true;
                if (dev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
                    enabled = mAvrcpAbsVolSupported;
                }
                mAudioSystem.setDeviceAbsoluteVolumeEnabled(dev, /*address=*/"", enabled, stream);
            });
        }
    }
@@ -4848,7 +4851,7 @@ public class AudioService extends IAudioService.Stub
                if (absDev == AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP) {
                    enabled = mAvrcpAbsVolSupported;
                }
                if (stream != streamType) {
                if (stream != streamType || !enabled) {
                    mAudioSystem.setDeviceAbsoluteVolumeEnabled(absDev, /*address=*/"",
                            enabled, streamType);
                }
@@ -10357,10 +10360,10 @@ public class AudioService extends IAudioService.Stub
    }
    /*package*/ void setAvrcpAbsoluteVolumeSupported(boolean support) {
        synchronized (mCachedAbsVolDrivingStreamsLock) {
            mAvrcpAbsVolSupported = support;
            if (absVolumeIndexFix()) {
                int a2dpDev = AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP;
            synchronized (mCachedAbsVolDrivingStreamsLock) {
                mCachedAbsVolDrivingStreams.compute(a2dpDev, (dev, stream) -> {
                    if (!mAvrcpAbsVolSupported) {
                        mAudioSystem.setDeviceAbsoluteVolumeEnabled(a2dpDev, /*address=*/
@@ -12423,6 +12426,12 @@ public class AudioService extends IAudioService.Stub
        pw.println("\nLoudness alignment:");
        mLoudnessCodecHelper.dump(pw);
        pw.println("\nAbsolute voume devices:");
        synchronized (mCachedAbsVolDrivingStreamsLock) {
            mCachedAbsVolDrivingStreams.forEach((dev, stream) -> pw.println(
                    "Device type: 0x" + Integer.toHexString(dev) + ", driving stream " + stream));
        }
        mAudioSystem.dump(pw);
    }