diff options
author | Sailesh Nepal <sail@google.com> | 2014-08-09 16:36:35 -0700 |
---|---|---|
committer | Sailesh Nepal <sail@google.com> | 2014-08-09 16:36:35 -0700 |
commit | d5bcb68cb7208ac9766570848c42a6e44e32dc10 (patch) | |
tree | 06e41928b813c8a0150ef813bdc781ee80c267a0 | |
parent | a351ab96987381ffe7ea29a7cdec1e7fbd1497d5 (diff) | |
download | frameworks_base-d5bcb68cb7208ac9766570848c42a6e44e32dc10.zip frameworks_base-d5bcb68cb7208ac9766570848c42a6e44e32dc10.tar.gz frameworks_base-d5bcb68cb7208ac9766570848c42a6e44e32dc10.tar.bz2 |
Use thread safe set for RemoteConnection.mListeners
Switch from HashSet to set backed by a ConcurrentHashMap to prevent
ConcurrentModificationExceptions.
Bug: 16901565
Change-Id: I7666ef61e94994963b2c2634a9a250365e753888
-rw-r--r-- | telecomm/java/android/telecomm/RemoteConnection.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java index 197e480..a8636d4 100644 --- a/telecomm/java/android/telecomm/RemoteConnection.java +++ b/telecomm/java/android/telecomm/RemoteConnection.java @@ -28,6 +28,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; /** * RemoteConnection object used by RemoteConnectionService. @@ -179,7 +180,8 @@ public final class RemoteConnection { private IConnectionService mConnectionService; private final String mConnectionId; - private final Set<Listener> mListeners = new HashSet<>(); + private final Set<Listener> mListeners = Collections.newSetFromMap( + new ConcurrentHashMap<Listener, Boolean>(2)); private final Set<RemoteConnection> mConferenceableConnections = new HashSet<>(); private int mState = Connection.State.NEW; |