From 4ee24a9492c7c83952f59ecc54071c31aa68fa86 Mon Sep 17 00:00:00 2001 From: zachh Date: Thu, 11 Jan 2018 14:05:10 -0800 Subject: 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 --- .../dialer/phonelookup/composite/CompositePhoneLookup.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'java/com/android/dialer/phonelookup/composite') diff --git a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java index 34f35311f..68695b7e9 100644 --- a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java +++ b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java @@ -34,6 +34,7 @@ import com.google.common.collect.Maps; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -88,7 +89,18 @@ public final class CompositePhoneLookup implements PhoneLookup public ListenableFuture isDirty(ImmutableSet phoneNumbers) { List> futures = new ArrayList<>(); for (PhoneLookup phoneLookup : phoneLookups) { - futures.add(phoneLookup.isDirty(phoneNumbers)); + futures.add( + Futures.transform( + phoneLookup.isDirty(phoneNumbers), + isDirty -> { + LogUtil.v( + "CompositePhoneLookup.isDirty", + "isDirty for %s: %b", + phoneLookup.getClass().getSimpleName(), + isDirty); + return isDirty; + }, + MoreExecutors.directExecutor())); } // Executes all child lookups (possibly in parallel), completing when the first composite lookup // which returns "true" completes, and cancels the others. -- cgit v1.2.3