diff options
author | Phil Burk <philburk@google.com> | 2015-08-04 15:38:55 -0700 |
---|---|---|
committer | Phil Burk <philburk@google.com> | 2015-08-04 15:38:55 -0700 |
commit | a95faf78bf810e0b4eb3cb211c414bfbbd1a8061 (patch) | |
tree | c675f0692e11532978e9966532cc0437b45073f4 | |
parent | b83b5fa641847ee1d533253ba5e1a3e13913b9d9 (diff) | |
download | frameworks_base-a95faf78bf810e0b4eb3cb211c414bfbbd1a8061.zip frameworks_base-a95faf78bf810e0b4eb3cb211c414bfbbd1a8061.tar.gz frameworks_base-a95faf78bf810e0b4eb3cb211c414bfbbd1a8061.tar.bz2 |
MidiManager: use ConcurrentHashMap
So that adding and removing device listeners is thread-safe.
Bug: 22909752
Change-Id: I1369ab53c865b54e6e5eb8ea3e8d437fdd1d7197
Signed-off-by: Phil Burk <philburk@google.com>
-rw-r--r-- | media/java/android/media/midi/MidiManager.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/media/java/android/media/midi/MidiManager.java b/media/java/android/media/midi/MidiManager.java index 89230fe..7197dc0 100644 --- a/media/java/android/media/midi/MidiManager.java +++ b/media/java/android/media/midi/MidiManager.java @@ -24,7 +24,7 @@ import android.os.Handler; import android.os.RemoteException; import android.util.Log; -import java.util.HashMap; +import java.util.concurrent.ConcurrentHashMap; /** * This class is the public application interface to the MIDI service. @@ -61,8 +61,8 @@ public final class MidiManager { private final IMidiManager mService; private final IBinder mToken = new Binder(); - private HashMap<DeviceCallback,DeviceListener> mDeviceListeners = - new HashMap<DeviceCallback,DeviceListener>(); + private ConcurrentHashMap<DeviceCallback,DeviceListener> mDeviceListeners = + new ConcurrentHashMap<DeviceCallback,DeviceListener>(); // Binder stub for receiving device notifications from MidiService private class DeviceListener extends IMidiDeviceListener.Stub { |