From 9810e261e0f52ebd5948a9efe9317fed0d19f664 Mon Sep 17 00:00:00 2001 From: twyen Date: Wed, 10 Jan 2018 13:51:07 -0800 Subject: Fix PhoneLookupDataSource ignoring inserts if history is empty Test: Unit tests. PiperOrigin-RevId: 181512134 Change-Id: If64b4cd184c60a807541cfe8727aa03532a80cb4 --- .../calllog/datasources/phonelookup/PhoneLookupDataSource.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java index cdde638ee..508191cde 100644 --- a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java +++ b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java @@ -403,6 +403,7 @@ public final class PhoneLookupDataSource return idsByNumber; } + /** Returned map must have same keys as {@code uniqueDialerPhoneNumbers} */ private ImmutableMap queryPhoneLookupHistoryForNumbers( Context appContext, Set uniqueDialerPhoneNumbers) { DialerPhoneNumberUtil dialerPhoneNumberUtil = @@ -431,13 +432,9 @@ public final class PhoneLookupDataSource selection, normalizedNumbers, null)) { - if (cursor == null) { LogUtil.e("PhoneLookupDataSource.queryPhoneLookupHistoryForNumbers", "null cursor"); - return ImmutableMap.of(); - } - - if (cursor.moveToFirst()) { + } else if (cursor.moveToFirst()) { int normalizedNumberColumn = cursor.getColumnIndexOrThrow(PhoneLookupHistory.NORMALIZED_NUMBER); int phoneLookupInfoColumn = -- cgit v1.2.3