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

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

APM: remove unnecessary check

STREAM_DEFAULT is actually a negative value. When casting to uint it
will result in a very large number which will fail the test for having a
consistent stream value before sending to APM.

Remove this check since the conversion code before checks for stream
validity.

Flag: EXEMPT bugfix
Test: manual
Bug: 361461410
Bug: 361576207
Change-Id: Ib023bdbcba48311a906128bd7394106a01e47dee
parent 08502d83
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1124,8 +1124,12 @@ Status AudioPolicyService::setDeviceAbsoluteVolumeEnabled(const AudioDevice& dev
    ALOGI("%s: deviceAidl %s, enabled %d, streamToDriveAbsAidl %d", __func__,
          deviceAidl.toString().c_str(), enabled, streamToDriveAbsAidl);

    audio_stream_type_t streamToDriveAbs = VALUE_OR_RETURN_BINDER_STATUS(
    audio_stream_type_t streamToDriveAbs = AUDIO_STREAM_DEFAULT;
    if (enabled) {
        streamToDriveAbs = VALUE_OR_RETURN_BINDER_STATUS(
                aidl2legacy_AudioStreamType_audio_stream_type_t(streamToDriveAbsAidl));
    }

    audio_devices_t deviceType;
    std::string address;
    RETURN_BINDER_STATUS_IF_ERROR(
@@ -1139,9 +1143,7 @@ Status AudioPolicyService::setDeviceAbsoluteVolumeEnabled(const AudioDevice& dev
            : settingsAllowed())) {
        return binderStatusFromStatusT(PERMISSION_DENIED);
    }
    if (uint32_t(streamToDriveAbs) >= AUDIO_STREAM_PUBLIC_CNT) {
        return binderStatusFromStatusT(BAD_VALUE);
    }

    audio_utils::lock_guard _l(mMutex);
    AutoCallerClear acc;
    return binderStatusFromStatusT(