summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJay Shrauner <shrauner@google.com>2014-12-08 15:57:19 -0800
committerJay Shrauner <shrauner@google.com>2014-12-09 15:28:29 -0800
commit12ac1e6f15ae9e4d4e453e7f28467fdd561939a3 (patch)
tree66723d6f06573b508803e8ef769dcc7f439ceba4 /src
parentd8164c78180937384e8689e42f4e5a85759dbcd9 (diff)
downloadpackages_apps_Contacts-12ac1e6f15ae9e4d4e453e7f28467fdd561939a3.tar.gz
packages_apps_Contacts-12ac1e6f15ae9e4d4e453e7f28467fdd561939a3.tar.bz2
packages_apps_Contacts-12ac1e6f15ae9e4d4e453e7f28467fdd561939a3.zip
Fix ConcurrentModificationException
Switch from using a HashMap to a ConcurrentHashMap for the loader results map. Bug:18688436 Change-Id: Ib90f794b673d88f54fc841c0fa001866139f47c6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/contacts/quickcontact/QuickContactActivity.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 277d1bfc2..1773bb740 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -157,6 +157,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
/**
* Mostly translucent {@link Activity} that shows QuickContact dialog. It loads
@@ -307,7 +308,13 @@ public class QuickContactActivity extends ContactsActivity {
LOADER_SMS_ID,
LOADER_CALENDAR_ID,
LOADER_CALL_LOG_ID};
- private Map<Integer, List<ContactInteraction>> mRecentLoaderResults = new HashMap<>();
+ /**
+ * ConcurrentHashMap constructor params: 4 is initial table size, 0.9f is
+ * load factor before resizing, 1 means we only expect a single thread to
+ * write to the map so make only a single shard
+ */
+ private Map<Integer, List<ContactInteraction>> mRecentLoaderResults =
+ new ConcurrentHashMap<>(4, 0.9f, 1);
private static final String FRAGMENT_TAG_SELECT_ACCOUNT = "select_account_fragment";