summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-06-28 12:41:13 -0700
committerCopybara-Service <copybara-piper@google.com>2018-06-28 16:24:08 -0700
commit96bc372701f3cf11fa197039bee6f98e09ba30eb (patch)
tree30636ce90b540fddaf9223a5a8a304aedd7fd406
parent6310dfd04e0d3561d1ef58121046e6255eac8c87 (diff)
Use ConcurrentMap to log Contacts Provider metrics in the old call log.
Bug: 80482741 Test: None PiperOrigin-RevId: 202526514 Change-Id: Ia92b95b288638ccb77d3bac16bd8c5589326bf61
-rw-r--r--java/com/android/dialer/app/calllog/CallLogAdapter.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java
index f5474eec6..485683b09 100644
--- a/java/com/android/dialer/app/calllog/CallLogAdapter.java
+++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java
@@ -100,6 +100,8 @@ import com.google.i18n.phonenumbers.Phonenumber.PhoneNumber;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
/** Adapter class to fill in data for the Call Log. */
public class CallLogAdapter extends GroupingListAdapter
@@ -158,9 +160,12 @@ public class CallLogAdapter extends GroupingListAdapter
/**
* Maps a raw input number to match info. We only log one MatchInfo per raw input number to reduce
* the amount of data logged.
+ *
+ * <p>Note that this has to be a {@link ConcurrentMap} as the match info for each row in the UI is
+ * loaded in a background thread spawned when the ViewHolder is bound.
*/
- private final Map<String, ContactsProviderMatchInfo> contactsProviderMatchInfos =
- new ArrayMap<>();
+ private final ConcurrentMap<String, ContactsProviderMatchInfo> contactsProviderMatchInfos =
+ new ConcurrentHashMap<>();
private final ActionMode.Callback actionModeCallback =
new ActionMode.Callback() {
@@ -1464,6 +1469,7 @@ public class CallLogAdapter extends GroupingListAdapter
notifyDataSetChanged();
}
+ @WorkerThread
private void logCp2Metrics(PhoneCallDetails details, ContactInfo contactInfo) {
if (details == null) {
return;