summaryrefslogtreecommitdiffstats
path: root/telecomm/java
diff options
context:
space:
mode:
authorSailesh Nepal <sail@google.com>2014-08-14 17:43:13 -0700
committerSailesh Nepal <sail@google.com>2014-08-15 01:39:45 +0000
commitf4669dffd5d604f227ceb74c6ea86ee78a882e73 (patch)
treed7854d880fe8a8954eb8aac7f6124c1f5517d87f /telecomm/java
parent8b9d3ca94189b183a2380ba5b289d9a06eb0493e (diff)
downloadframeworks_base-f4669dffd5d604f227ceb74c6ea86ee78a882e73.zip
frameworks_base-f4669dffd5d604f227ceb74c6ea86ee78a882e73.tar.gz
frameworks_base-f4669dffd5d604f227ceb74c6ea86ee78a882e73.tar.bz2
Use thread safe set for RemoteConnection.mListeners
Switch from HashSet to set backed by a ConcurrentHashMap to prevent ConcurrentModificationExceptions. (Relanding ag/521178. This got reveretd in ag/520450). Bug: 16901565 Change-Id: I997898ed94f305d9b8c57eead04e0dfe6c04a884
Diffstat (limited to 'telecomm/java')
-rw-r--r--telecomm/java/android/telecomm/RemoteConnection.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/telecomm/java/android/telecomm/RemoteConnection.java b/telecomm/java/android/telecomm/RemoteConnection.java
index 13b0834..d3972d3 100644
--- a/telecomm/java/android/telecomm/RemoteConnection.java
+++ b/telecomm/java/android/telecomm/RemoteConnection.java
@@ -24,9 +24,11 @@ import android.os.RemoteException;
import android.telephony.DisconnectCause;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
/**
* A connection provided to a {@link ConnectionService} by another {@code ConnectionService}
@@ -182,7 +184,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;