diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-13 06:00:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-13 06:00:21 +0000 |
commit | 4af5bf57c2e9c848dc3d7e00b3dad807a0d5bcf4 (patch) | |
tree | fb9cff639a2c0233f119edeb3352672e39a15c97 /java/com/android | |
parent | e953507051228ead255b0f694801d6087c62bb20 (diff) | |
parent | 7f909de2ff58747e4756a1b9c0128f0602c9bb61 (diff) |
Merge changes I24e1b1b4,I4e951366
* changes:
Clear the cache in RealtimeRowProcessor when there's new data.
Added some verbose logging to Cp2LocalPhoneLookup
Diffstat (limited to 'java/com/android')
4 files changed, 18 insertions, 2 deletions
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<ViewHolder> { 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. 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<Cp2Info> { // 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<Cp2Info> { 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) |