From 2930bb2d47be279dd228ba8c749c1e39e5da8be1 Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Fri, 9 Apr 2010 19:27:58 -0700 Subject: [PATCH] Fix monkey bug 2586534 java.util.ConcurrentModificationException Unlike the other audio focus and media button stack handling methods, abandonAudioFocus() and unregisterAudioFocusClient() were not synchronized around their focus stack. This CL corrects this. Change-Id: I5ada574e4e163fa95da9dad2fefe610b48303320 --- media/java/android/media/AudioService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java index 2b7683ad3a1c1..45497e97e150d 100644 --- a/media/java/android/media/AudioService.java +++ b/media/java/android/media/AudioService.java @@ -2090,14 +2090,18 @@ public class AudioService extends IAudioService.Stub { Log.i(TAG, " AudioFocus abandonAudioFocus() from " + clientId); // this will take care of notifying the new focus owner if needed - removeFocusStackEntry(clientId, true); + synchronized(mFocusStack) { + removeFocusStackEntry(clientId, true); + } return AudioManager.AUDIOFOCUS_REQUEST_GRANTED; } public void unregisterAudioFocusClient(String clientId) { - removeFocusStackEntry(clientId, false); + synchronized(mFocusStack) { + removeFocusStackEntry(clientId, false); + } }