From 96bc372701f3cf11fa197039bee6f98e09ba30eb Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 28 Jun 2018 12:41:13 -0700 Subject: Use ConcurrentMap to log Contacts Provider metrics in the old call log. Bug: 80482741 Test: None PiperOrigin-RevId: 202526514 Change-Id: Ia92b95b288638ccb77d3bac16bd8c5589326bf61 --- java/com/android/dialer/app/calllog/CallLogAdapter.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'java/com') 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. + * + *

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 contactsProviderMatchInfos = - new ArrayMap<>(); + private final ConcurrentMap 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; -- cgit v1.2.3