summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortwyen <twyen@google.com>2018-01-10 13:51:07 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-10 15:23:51 -0800
commit9810e261e0f52ebd5948a9efe9317fed0d19f664 (patch)
treeb2a59ce3e530daedeb244123b7298c3d8eebe8ed
parent7f5acbe82a8b4a9c27cbf2419a2dc31e9dba882e (diff)
Fix PhoneLookupDataSource ignoring inserts if history is empty
Test: Unit tests. PiperOrigin-RevId: 181512134 Change-Id: If64b4cd184c60a807541cfe8727aa03532a80cb4
-rw-r--r--java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java7
1 files 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<DialerPhoneNumber, PhoneLookupInfo> queryPhoneLookupHistoryForNumbers(
Context appContext, Set<DialerPhoneNumber> 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 =