Use ConcurrentMap to log Contacts Provider metrics in the old call log.
Bug: 80482741
Test: None
PiperOrigin-RevId: 202526514
Change-Id: Ia92b95b288638ccb77d3bac16bd8c5589326bf61
diff --git a/java/com/android/dialer/app/calllog/CallLogAdapter.java b/java/com/android/dialer/app/calllog/CallLogAdapter.java
index f5474ee..485683b 100644
--- a/java/com/android/dialer/app/calllog/CallLogAdapter.java
+++ b/java/com/android/dialer/app/calllog/CallLogAdapter.java
@@ -100,6 +100,8 @@
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 @@
/**
* 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 @@
notifyDataSetChanged();
}
+ @WorkerThread
private void logCp2Metrics(PhoneCallDetails details, ContactInfo contactInfo) {
if (details == null) {
return;