From fe74cd537684a97df239fde462536244529fa4dd Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 12 Jan 2018 18:03:06 -0800 Subject: Added some verbose logging to Cp2LocalPhoneLookup Test: none PiperOrigin-RevId: 181816649 Change-Id: I4e951366e9458899181fb95230a2815ed5fcdaa8 --- java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'java/com/android') diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java index eede0f1b0..c6e7f5aa3 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2LocalPhoneLookup.java @@ -159,6 +159,10 @@ public final class Cp2LocalPhoneLookup implements PhoneLookup { // queries; since running this many queries is not feasible for the (lightweight) isDirty // check, simply return true. The expectation is that this should rarely be the case as the // vast majority of numbers in call logs should be valid. + LogUtil.v( + "Cp2LocalPhoneLookup.isDirty", + "returning true because too many invalid numbers (%d)", + partitionedNumbers.invalidNumbers().size()); return Futures.immediateFuture(true); } @@ -713,6 +717,10 @@ public final class Cp2LocalPhoneLookup implements PhoneLookup { for (DialerPhoneNumber dialerPhoneNumber : updatedNumbers) { map.put(dialerPhoneNumber, ImmutableSet.of()); } + LogUtil.v( + "Cp2LocalPhoneLookup.buildMapForUpdatedOrAddedContacts", + "found %d numbers that may need updating", + updatedNumbers.size()); return map; }; return Futures.whenAllSucceed(validNumbersFuture, invalidNumbersFuture) -- cgit v1.2.3 From 7f909de2ff58747e4756a1b9c0128f0602c9bb61 Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 12 Jan 2018 20:10:12 -0800 Subject: Clear the cache in RealtimeRowProcessor when there's new data. Otherwise changes to "incomplete" rows won't take effect until a new adapter is created. Test: unit and manual PiperOrigin-RevId: 181823087 Change-Id: I24e1b1b465c8d37cf794312b88b6cdd3ad394b5d --- java/com/android/dialer/calllog/ui/NewCallLogAdapter.java | 1 + java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java | 3 +-- java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) (limited to 'java/com/android') diff --git a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java index a4a67d712..24324b073 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogAdapter.java @@ -64,6 +64,7 @@ final class NewCallLogAdapter extends RecyclerView.Adapter { void updateCursor(Cursor updatedCursor) { this.cursor = updatedCursor; + this.realtimeRowProcessor.clearCache(); setHeaderPositions(); notifyDataSetChanged(); diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 5b526b49d..7c33c8721 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -33,7 +33,6 @@ import com.android.dialer.calllogutils.CallLogContactTypes; import com.android.dialer.calllogutils.CallLogEntryText; import com.android.dialer.calllogutils.CallLogIntents; import com.android.dialer.calllogutils.CallTypeIconsView; -import com.android.dialer.common.LogUtil; import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.compat.telephony.TelephonyManagerCompat; import com.android.dialer.contactphoto.ContactPhotoManager; @@ -208,7 +207,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { @Override public void onFailure(Throwable throwable) { - LogUtil.e("RealtimeRowFutureCallback.onFailure", "realtime processing failed", throwable); + throw new RuntimeException("realtime processing failed", throwable); } } } diff --git a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java index 2cfe0b4ad..393482ab0 100644 --- a/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java +++ b/java/com/android/dialer/calllog/ui/RealtimeRowProcessor.java @@ -21,6 +21,7 @@ import android.util.ArrayMap; import com.android.dialer.DialerPhoneNumber; import com.android.dialer.NumberAttributes; import com.android.dialer.calllog.model.CoalescedRow; +import com.android.dialer.common.Assert; import com.android.dialer.common.concurrent.Annotations.Ui; import com.android.dialer.phonelookup.PhoneLookupInfo; import com.android.dialer.phonelookup.PhoneLookupInfo.Cp2Info; @@ -94,6 +95,13 @@ public final class RealtimeRowProcessor { uiExecutor /* ensures the cache is updated on a single thread */); } + /** Clears the internal cache. */ + @MainThread + public void clearCache() { + Assert.isMainThread(); + cache.clear(); + } + private CoalescedRow applyCp2LocalInfoToRow(Cp2Info cp2Info, CoalescedRow row) { PhoneLookupInfo phoneLookupInfo = PhoneLookupInfo.newBuilder().setCp2LocalInfo(cp2Info).build(); // It is safe to overwrite any existing data because CP2 always has highest priority. -- cgit v1.2.3