Dialer: Fix crash in CallLog
* CallLogAdapter calls (via other methods) into this and causes a
concurrent modification
* Prevent this by synchronizing the block
Change-Id: I24ff5aeda9af636b3a0c6b8b1c32b12ee0b7bf42
diff --git a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
index e118543..4bd74fd 100644
--- a/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
+++ b/java/com/android/dialer/app/calllog/PhoneCallDetailsHelper.java
@@ -201,24 +201,27 @@
* @return The call location and date string.
*/
public CharSequence getCallLocationAndDate(PhoneCallDetails details) {
- descriptionItems.clear();
+ synchronized (this) {
+ descriptionItems.clear();
- if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) {
- // Get type of call (ie mobile, home, etc) if known, or the caller's location.
- CharSequence callTypeOrLocation = getCallTypeOrLocation(details);
+ if (details.callTypes[0] != Calls.VOICEMAIL_TYPE) {
+ // Get type of call (ie mobile, home, etc) if known, or the caller's location.
+ CharSequence callTypeOrLocation = getCallTypeOrLocation(details);
- // Only add the call type or location if its not empty. It will be empty for unknown
- // callers.
- if (!TextUtils.isEmpty(callTypeOrLocation)) {
- descriptionItems.add(callTypeOrLocation);
+ // Only add the call type or location if its not empty. It will be empty for unknown
+ // callers.
+ if (!TextUtils.isEmpty(callTypeOrLocation)) {
+ descriptionItems.add(callTypeOrLocation);
+ }
}
+
+ // The date of this call
+ descriptionItems.add(getCallDate(details));
+
+ // Create a comma separated list from the call type or location, and call date.
+
+ return DialerUtils.join(descriptionItems);
}
-
- // The date of this call
- descriptionItems.add(getCallDate(details));
-
- // Create a comma separated list from the call type or location, and call date.
- return DialerUtils.join(descriptionItems);
}
/**