Bounds Check in onPlaySoundEffect

Prevents system crash

Bug: 13514877
Change-Id: Id03561779611d9eb7402ff206fd877b39bb2f035
This commit is contained in:
Natalie Silvanovich
2014-05-01 10:16:24 -07:00
parent 4a26164316
commit 559c76dbc3

View File

@ -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);
}