diff --git a/services/core/java/com/android/server/audio/SoundEffectsHelper.java b/services/core/java/com/android/server/audio/SoundEffectsHelper.java index cf5bc8d88c73e..c4db8e9a76ec6 100644 --- a/services/core/java/com/android/server/audio/SoundEffectsHelper.java +++ b/services/core/java/com/android/server/audio/SoundEffectsHelper.java @@ -90,6 +90,10 @@ class SoundEffectsHelper { mFileName = fileName; mSampleId = EFFECT_NOT_IN_SOUND_POOL; } + void unload() { + mSampleId = EFFECT_NOT_IN_SOUND_POOL; + mLoaded = false; + } } // All the fields below are accessed by the worker thread exclusively private final List mResources = new ArrayList(); @@ -230,6 +234,7 @@ class SoundEffectsHelper { for (Resource res : mResources) { if (res.mSampleId != EFFECT_NOT_IN_SOUND_POOL) { mSoundPool.unload(res.mSampleId); + res.unload(); } } mSoundPool.release();