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

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

AudioPolicyManager: fix setStreamVolumeIndex().

am: e76f29cb

Change-Id: I6eb6dbbea93321f366bea7fa39925bcac03225c2
parents 14d81476 e76f29cb
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -1903,19 +1903,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