From e1ec439563705d47f699a565c35eff4bc0dcbf61 Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 22 Dec 2017 16:59:32 -0800 Subject: Parameterized PhoneLookup with submessage type. This allows indvidual PhoneLookups to define and deal mostly with their own submessage type (with the exception of trivial setter and getter methods for converting from/to PhoneLookupInfo). This also simplifies the FakePhoneLookup and tests which use it a bit, I think. Bug: 34672501 Test: unit PiperOrigin-RevId: 179976215 Change-Id: I2db1fc85771621be2f2afcd6af114d82680e30d0 --- .../datasources/phonelookup/PhoneLookupDataSource.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java') diff --git a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java index 042ff30a2..56e909e84 100644 --- a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java +++ b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java @@ -65,7 +65,7 @@ import javax.inject.Inject; */ public final class PhoneLookupDataSource implements CallLogDataSource { - private final PhoneLookup phoneLookup; + private final PhoneLookup phoneLookup; private final ListeningExecutorService backgroundExecutorService; private final ListeningExecutorService lightweightExecutorService; @@ -88,7 +88,7 @@ public final class PhoneLookupDataSource implements CallLogDataSource { @Inject PhoneLookupDataSource( - PhoneLookup phoneLookup, + PhoneLookup phoneLookup, @BackgroundExecutor ListeningExecutorService backgroundExecutorService, @LightweightExecutor ListeningExecutorService lightweightExecutorService) { this.phoneLookup = phoneLookup; @@ -123,8 +123,8 @@ public final class PhoneLookupDataSource implements CallLogDataSource { * provided mutations. (Note that at this point, data may not be fully up-to-date, but the * next steps will take care of that.) *
  • Uses all of the numbers from AnnotatedCallLog to invoke (composite) {@link - * PhoneLookup#getMostRecentPhoneLookupInfo(ImmutableMap)} - *
  • Looks through the results of getMostRecentPhoneLookupInfo + * PhoneLookup#getMostRecentInfo(ImmutableMap)} + *
  • Looks through the results of getMostRecentInfo *
      *
    • For each number, checks if the original PhoneLookupInfo differs from the new one *
    • If so, it applies the update to the mutations and (in onSuccessfulFill) writes the @@ -155,9 +155,7 @@ public final class PhoneLookupDataSource implements CallLogDataSource { // Use the original info map to generate the updated info map by delegating to phoneLookup. ListenableFuture> updatedInfoMapFuture = Futures.transformAsync( - originalInfoMapFuture, - phoneLookup::getMostRecentPhoneLookupInfo, - lightweightExecutorService); + originalInfoMapFuture, phoneLookup::getMostRecentInfo, lightweightExecutorService); // This is the computation that will use the result of all of the above. Callable> computeRowsToUpdate = -- cgit v1.2.3