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

Commit d623175b authored by Vlad Popa's avatar Vlad Popa Committed by Android (Google) Code Review
Browse files

Merge "Improve robustness when deleting abs volume device" into main

parents a41bb27a a536eb3e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -3507,6 +3507,11 @@ status_t AudioPolicyManager::setDeviceAbsoluteVolumeEnabled(audio_devices_t devi
                                                            bool enabled,
                                                            audio_stream_type_t streamToDriveAbs)
{
    if (!enabled) {
        mAbsoluteVolumeDrivingStreams.erase(deviceType);
        return NO_ERROR;
    }

    audio_attributes_t attributesToDriveAbs = mEngine->getAttributesForStreamType(streamToDriveAbs);
    if (attributesToDriveAbs == AUDIO_ATTRIBUTES_INITIALIZER) {
        ALOGW("%s: no attributes for stream %s, bailing out", __func__,
@@ -3514,12 +3519,7 @@ status_t AudioPolicyManager::setDeviceAbsoluteVolumeEnabled(audio_devices_t devi
        return BAD_VALUE;
    }

    if (enabled) {
    mAbsoluteVolumeDrivingStreams[deviceType] = attributesToDriveAbs;
    } else {
        mAbsoluteVolumeDrivingStreams.erase(deviceType);
    }

    return NO_ERROR;
}