summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/datasources/phonelookup
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2017-12-22 16:59:32 -0800
committerCopybara-Service <copybara-piper@google.com>2017-12-27 13:50:03 -0800
commite1ec439563705d47f699a565c35eff4bc0dcbf61 (patch)
treef77970b4b9e9682355828fc810f5271801775bfe /java/com/android/dialer/calllog/datasources/phonelookup
parent0e130eb65c12f52417c731e28330f96b8f71521d (diff)
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
Diffstat (limited to 'java/com/android/dialer/calllog/datasources/phonelookup')
-rw-r--r--java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java12
1 files changed, 5 insertions, 7 deletions
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<PhoneLookupInfo> phoneLookup;
private final ListeningExecutorService backgroundExecutorService;
private final ListeningExecutorService lightweightExecutorService;
@@ -88,7 +88,7 @@ public final class PhoneLookupDataSource implements CallLogDataSource {
@Inject
PhoneLookupDataSource(
- PhoneLookup phoneLookup,
+ PhoneLookup<PhoneLookupInfo> 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.)
* <li>Uses all of the numbers from AnnotatedCallLog to invoke (composite) {@link
- * PhoneLookup#getMostRecentPhoneLookupInfo(ImmutableMap)}
- * <li>Looks through the results of getMostRecentPhoneLookupInfo
+ * PhoneLookup#getMostRecentInfo(ImmutableMap)}
+ * <li>Looks through the results of getMostRecentInfo
* <ul>
* <li>For each number, checks if the original PhoneLookupInfo differs from the new one
* <li>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<ImmutableMap<DialerPhoneNumber, PhoneLookupInfo>> 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<ImmutableMap<Long, PhoneLookupInfo>> computeRowsToUpdate =