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

Commit 7c9c33ab authored by Eric Laurent's avatar Eric Laurent Committed by android-build-merger
Browse files

AudioPolicyManager: fix setStreamVolumeIndex(). am: e76f29cb am: fa94796e

am: 47406b64

Change-Id: I2692aa7dc3dc206ba6aa6d30bc0064699059dad0
parents 9e75537c 47406b64
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1969,19 +1969,21 @@ status_t AudioPolicyManager::setStreamVolumeIndex(audio_stream_type_t stream,
                continue;
            }
            routing_strategy curStrategy = getStrategy((audio_stream_type_t)curStream);
            audio_devices_t curStreamDevice = getDeviceForStrategy(curStrategy, true /*fromCache*/);
            if ((curStreamDevice & device) == 0) {
            audio_devices_t curStreamDevice = getDeviceForStrategy(curStrategy, false /*fromCache*/);
            if ((device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) &&
                    ((curStreamDevice & device) == 0)) {
                continue;
            }
            bool applyDefault = false;
            bool applyVolume;
            if (device != AUDIO_DEVICE_OUT_DEFAULT_FOR_VOLUME) {
                curStreamDevice |= device;
            } else if (!mVolumeCurves->hasVolumeIndexForDevice(
                    stream, Volume::getDeviceForVolume(curStreamDevice))) {
                applyDefault = true;
                applyVolume = (curDevice & curStreamDevice) != 0;
            } else {
                applyVolume = !mVolumeCurves->hasVolumeIndexForDevice(
                        stream, Volume::getDeviceForVolume(curStreamDevice));
            }

            if (applyDefault || ((curDevice & curStreamDevice) != 0)) {
            if (applyVolume) {
                //FIXME: workaround for truncated touch sounds
                // delayed volume change for system stream to be removed when the problem is
                // handled by system UI