From 73ec1ab52956c658654a40c42f4c59806713b15e Mon Sep 17 00:00:00 2001 From: zachh Date: Tue, 9 Jan 2018 17:44:36 -0800 Subject: Changed behavior of failures in DialerFutures#firstMatching. DialerFutures#firstMatching now fails if one of its provided futures fails before a match is found. This is to accomodate the case where no source returns true for isDirty, but one or more fail; we want to be notified of the failure in that case and not silently treat that case as not dirty. Also fixed a bug in NewCallLogFragment where the failed future wasn't causing the application to crash. Also improved some related logging in RefreshAnnotatedCallLogWorker and Cp2PhoneLookup, and fixed a bug where empty numbers were not being handled correctly. Bug: 71504246 Test: unit PiperOrigin-RevId: 181401710 Change-Id: I23e207ac334ff80ac95b08a8f4f775a528a8c511 --- .../android/dialer/calllog/RefreshAnnotatedCallLogWorker.java | 11 +++++++---- java/com/android/dialer/calllog/ui/NewCallLogFragment.java | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'java/com/android/dialer/calllog') diff --git a/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java b/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java index e5cc3eb89..4c5904ef1 100644 --- a/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java +++ b/java/com/android/dialer/calllog/RefreshAnnotatedCallLogWorker.java @@ -117,10 +117,13 @@ public class RefreshAnnotatedCallLogWorker { // After determining isDirty, conditionally call rebuild. return Futures.transformAsync( isDirtyFuture, - isDirty -> - Preconditions.checkNotNull(isDirty) - ? rebuild(appContext) - : Futures.immediateFuture(null), + isDirty -> { + LogUtil.v( + "RefreshAnnotatedCallLogWorker.checkDirtyAndRebuildIfNecessary", + "isDirty: %b", + Preconditions.checkNotNull(isDirty)); + return isDirty ? rebuild(appContext) : Futures.immediateFuture(null); + }, lightweightExecutorService); } diff --git a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java index e422b5f83..d0656a433 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogFragment.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogFragment.java @@ -142,7 +142,12 @@ public final class NewCallLogFragment extends Fragment ? refreshAnnotatedCallLogWorker.refreshWithDirtyCheck() : refreshAnnotatedCallLogWorker.refreshWithoutDirtyCheck(); refreshAnnotatedCallLogListener.listen( - getContext(), future, unused -> {}, RuntimeException::new); + getContext(), + future, + unused -> {}, + throwable -> { + throw new RuntimeException(throwable); + }); }; ThreadUtil.getUiThreadHandler().postDelayed(refreshAnnotatedCallLogRunnable, WAIT_MILLIS); } -- cgit v1.2.3