summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/common
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-01-22 14:43:03 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-22 16:11:07 -0800
commit05838b54c2ba81e74e205141c436ad8e9900b933 (patch)
tree5d47efb6820dfa5ba605de5f425be6165e977c10 /java/com/android/dialer/common
parent861d8cd2dc75f80e5a6480145bbe29a1f5156acf (diff)
Changed PhoneLookup#lookup to accept a DialerPhoneNumber.
There's a problem with the existing implementation of RealtimeRowProcessor; when CP2 information is not present, data from other sources can potentially be erased. This CL fixes the problem by fetching the latest data from all sources, instead of just CP2. This requires being able to fetch PhoneLookup info without a Call, using only a number, so I changed PhoneLookup#lookup to accept a DialerPhoneNumber rather than a Call. (The reason that it accepted a Call was to support CNAP so we'll need a revised solution for that later.) There is a potential concern with performance in RealtimeRowProcessor due to performing a full [Composite]PhoneLookup vs. a CP2 lookup, because the full lookup includes network requests. However, it's anticipated that the real time lookups will very rarely have changes to apply so this might be OK as-is. If not, a mitigation strategy could be improving the performance of CompositePhoneLookup#lookup by short-circutiing slower sources when faster, higher priority sources have already completed. A follow-up CL will write the result of RealtimeRowProcessor queries to PhoneLookupHistory to further reduce how frequently real time updates need to be applied. Bug: 72229553 Test: existing unit PiperOrigin-RevId: 182839130 Change-Id: I8cb26827b4f4dc4702fb416234c8938179cd5ac5
Diffstat (limited to 'java/com/android/dialer/common')
-rw-r--r--java/com/android/dialer/common/concurrent/DialerExecutorComponent.java16
-rw-r--r--java/com/android/dialer/common/concurrent/UiListener.java2
2 files changed, 13 insertions, 5 deletions
diff --git a/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java b/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
index 28abf96fd..734891430 100644
--- a/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
+++ b/java/com/android/dialer/common/concurrent/DialerExecutorComponent.java
@@ -18,6 +18,8 @@ package com.android.dialer.common.concurrent;
import android.app.FragmentManager;
import android.content.Context;
+import com.android.dialer.common.concurrent.Annotations.BackgroundExecutor;
+import com.android.dialer.common.concurrent.Annotations.LightweightExecutor;
import com.android.dialer.common.concurrent.Annotations.NonUiParallel;
import com.android.dialer.common.concurrent.Annotations.Ui;
import com.android.dialer.inject.HasRootComponent;
@@ -31,17 +33,23 @@ public abstract class DialerExecutorComponent {
public abstract DialerExecutorFactory dialerExecutorFactory();
+ @NonUiParallel
+ public abstract ExecutorService lowPriorityThreadPool();
+
@Ui
- public abstract ListeningExecutorService uiExecutorService();
+ public abstract ListeningExecutorService uiExecutor();
+
+ @BackgroundExecutor
+ public abstract ListeningExecutorService backgroundExecutor();
+
+ @LightweightExecutor
+ public abstract ListeningExecutorService lightweightExecutor();
public <OutputT> UiListener<OutputT> createUiListener(
FragmentManager fragmentManager, String taskId) {
return UiListener.create(fragmentManager, taskId);
}
- @NonUiParallel
- public abstract ExecutorService lowPriorityThreadPool();
-
public static DialerExecutorComponent get(Context context) {
return ((DialerExecutorComponent.HasComponent)
((HasRootComponent) context.getApplicationContext()).component())
diff --git a/java/com/android/dialer/common/concurrent/UiListener.java b/java/com/android/dialer/common/concurrent/UiListener.java
index df791301f..b5922f9c8 100644
--- a/java/com/android/dialer/common/concurrent/UiListener.java
+++ b/java/com/android/dialer/common/concurrent/UiListener.java
@@ -96,7 +96,7 @@ public class UiListener<OutputT> extends Fragment {
Futures.addCallback(
Assert.isNotNull(future),
callbackWrapper,
- DialerExecutorComponent.get(context).uiExecutorService());
+ DialerExecutorComponent.get(context).uiExecutor());
}
private static class CallbackWrapper<OutputT> implements FutureCallback<OutputT> {