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

Commit 3b0515db authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicyManager: fix setStreamVolumeIndex()." into nyc-mr1-dev

parents 2b676113 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