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

Commit 599cd9c8 authored by Vlad Popa's avatar Vlad Popa Committed by Android Build Coastguard Worker
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
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:e2c5138e59eed434264898e93f6b145113baa674)
Merged-In: Ib023bdbcba48311a906128bd7394106a01e47dee
Change-Id: Ib023bdbcba48311a906128bd7394106a01e47dee
parent 2a781c32
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -1121,8 +1121,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(
@@ -1136,9 +1140,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(