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

Commit 96016c2d authored by Eric Laurent's avatar Eric Laurent Committed by Android Git Automerger
Browse files

am 9944ff09: am 70c3507d: am 450b10c9: am d0f9dc71: am e0a65f30: am f5af3a72:...

am 9944ff09: am 70c3507d: am 450b10c9: am d0f9dc71: am e0a65f30: am f5af3a72: am 6d80b687: audio policy: validate stream type received from binder calls.

* commit '9944ff09':
  audio policy: validate stream type received from binder calls.
parents 0d83cf22 9944ff09
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -222,6 +222,9 @@ audio_io_handle_t AudioPolicyService::getOutput(audio_stream_type_t stream,
                                    audio_channel_mask_t channelMask,
                                    audio_output_flags_t flags)
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return 0;
    }
    if (mpAudioPolicy == NULL) {
        return 0;
    }
@@ -235,6 +238,9 @@ status_t AudioPolicyService::startOutput(audio_io_handle_t output,
                                         audio_stream_type_t stream,
                                         int session)
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return BAD_VALUE;
    }
    if (mpAudioPolicy == NULL) {
        return NO_INIT;
    }
@@ -247,6 +253,9 @@ status_t AudioPolicyService::stopOutput(audio_io_handle_t output,
                                        audio_stream_type_t stream,
                                        int session)
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return BAD_VALUE;
    }
    if (mpAudioPolicy == NULL) {
        return NO_INIT;
    }
@@ -422,6 +431,9 @@ status_t AudioPolicyService::getStreamVolumeIndex(audio_stream_type_t stream,

uint32_t AudioPolicyService::getStrategyForStream(audio_stream_type_t stream)
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return 0;
    }
    if (mpAudioPolicy == NULL) {
        return 0;
    }
@@ -432,6 +444,9 @@ uint32_t AudioPolicyService::getStrategyForStream(audio_stream_type_t stream)

audio_devices_t AudioPolicyService::getDevicesForStream(audio_stream_type_t stream)
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return (audio_devices_t)0;
    }
    if (mpAudioPolicy == NULL) {
        return (audio_devices_t)0;
    }
@@ -477,8 +492,11 @@ status_t AudioPolicyService::setEffectEnabled(int id, bool enabled)

bool AudioPolicyService::isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const
{
    if (uint32_t(stream) >= AUDIO_STREAM_CNT) {
        return false;
    }
    if (mpAudioPolicy == NULL) {
        return 0;
        return false;
    }
    Mutex::Autolock _l(mLock);
    return mpAudioPolicy->is_stream_active(mpAudioPolicy, stream, inPastMs);