From 746dba885dc50c9f723456b01cfc7dbfcc9a49b0 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Thu, 12 Jun 2014 11:29:26 -0700 Subject: Prevent existing cached normalized numbers from being overwritten. Fixed case where if a number is not in your contacts and it has a cached normalized number in the call log, viewing the call log will delete the normalized number. Bug: 15591755 Change-Id: I7111ca6a2aacaebb0adfb15ccb5e6dc0792e2016 --- src/com/android/dialer/calllog/CallLogAdapter.java | 4 +++- src/com/android/dialer/calllog/ContactInfoHelper.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java index 4b1aeabe5..249c30c41 100644 --- a/src/com/android/dialer/calllog/CallLogAdapter.java +++ b/src/com/android/dialer/calllog/CallLogAdapter.java @@ -1096,7 +1096,9 @@ public class CallLogAdapter extends GroupingListAdapter values.put(Calls.CACHED_LOOKUP_URI, UriUtils.uriToString(updatedInfo.lookupUri)); needsUpdate = true; } - if (!TextUtils.equals(updatedInfo.normalizedNumber, callLogInfo.normalizedNumber)) { + // Only replace the normalized number if the new updated normalized number isn't empty. + if (!TextUtils.isEmpty(updatedInfo.normalizedNumber) && + !TextUtils.equals(updatedInfo.normalizedNumber, callLogInfo.normalizedNumber)) { values.put(Calls.CACHED_NORMALIZED_NUMBER, updatedInfo.normalizedNumber); needsUpdate = true; } diff --git a/src/com/android/dialer/calllog/ContactInfoHelper.java b/src/com/android/dialer/calllog/ContactInfoHelper.java index 5d99ef4fb..1bebfc416 100644 --- a/src/com/android/dialer/calllog/ContactInfoHelper.java +++ b/src/com/android/dialer/calllog/ContactInfoHelper.java @@ -101,6 +101,8 @@ public class ContactInfoHelper { updatedInfo = new ContactInfo(); updatedInfo.number = number; updatedInfo.formattedNumber = formatPhoneNumber(number, null, countryIso); + updatedInfo.normalizedNumber = PhoneNumberUtils.formatNumberToE164( + number, countryIso); updatedInfo.lookupUri = createTemporaryContactUri(updatedInfo.formattedNumber); } else { updatedInfo = info; -- cgit v1.2.3