diff options
author | zachh <zachh@google.com> | 2018-01-11 14:05:10 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-01-11 14:23:40 -0800 |
commit | 4ee24a9492c7c83952f59ecc54071c31aa68fa86 (patch) | |
tree | 88259dfd2edf1eefdbb367cd93bc7dfd6a7db548 /java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java | |
parent | 5dd30438fd3e4384b57cef3c7606ec20fad9b50d (diff) |
Fixed bug in handling of empty numbers in new call log.
Empty numbers were not being inserted into PhoneLookupHistory because the URI "content://.../PhoneLookupHistory/" is treated the same as "content://.../PhoneLookupHistory" (w/o the trailing slash). This caused the update (i.e. replace) operation to incorrectly update all rows in the table when it should have updated a single row.
The fix for this was to switch to a query parameter, so the empty number URI now looks like "content://.../PhoneLookupHistory?number="
Also improved some logging while debugging this problem.
Bug: 71866050
Test: unit and manual
PiperOrigin-RevId: 181659081
Change-Id: Idec4fb77e74920cd5485620b0a997db03aa8ff9b
Diffstat (limited to 'java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java')
-rw-r--r-- | java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java b/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java index f8e108496..a195926ac 100644 --- a/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java +++ b/java/com/android/dialer/phonelookup/database/contract/PhoneLookupHistoryContract.java @@ -30,10 +30,20 @@ public class PhoneLookupHistoryContract { public static final String TABLE = "PhoneLookupHistory"; + public static final String NUMBER_QUERY_PARAM = "number"; + /** The content URI for this table. */ public static final Uri CONTENT_URI = Uri.withAppendedPath(PhoneLookupHistoryContract.CONTENT_URI, TABLE); + /** Returns a URI for a specific normalized number */ + public static Uri contentUriForNumber(String normalizedNumber) { + return CONTENT_URI + .buildUpon() + .appendQueryParameter(NUMBER_QUERY_PARAM, Uri.encode(normalizedNumber)) + .build(); + } + /** The MIME type of a {@link android.content.ContentProvider#getType(Uri)} single entry. */ public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_lookup_history"; |