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

Commit 559c76db authored by Natalie Silvanovich's avatar Natalie Silvanovich
Browse files

Bounds Check in onPlaySoundEffect

Prevents system crash

Bug: 13514877
Change-Id: Id03561779611d9eb7402ff206fd877b39bb2f035
parent 4a261643
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1787,6 +1787,11 @@ public class AudioService extends IAudioService.Stub {

    /** @see AudioManager#playSoundEffect(int, float) */
    public void playSoundEffectVolume(int effectType, float volume) {
        if (effectType >= AudioManager.NUM_SOUND_EFFECTS || effectType < 0) {
            Log.w(TAG, "AudioService effectType value " + effectType + " out of range");
            return;
        }

        sendMsg(mAudioHandler, MSG_PLAY_SOUND_EFFECT, SENDMSG_QUEUE,
                effectType, (int) (volume * 1000), null, 0);
    }