summaryrefslogtreecommitdiff
path: root/java/com/android/incallui
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2017-10-24 17:10:06 -0700
committerEric Erfanian <erfanian@google.com>2017-10-25 16:59:31 +0000
commit6a4cebdb4ccc974d04f125847c03fddec18b2b9f (patch)
treea1baaedfe7538758e2622ee2746a6487428db1e1 /java/com/android/incallui
parent35ec9146f0f44898f2249be3e505ff7bef171e11 (diff)
Improved dagger support for executor services.
By always creating executor services via dagger, we can now bind special versions during espresso tests that can implement idling resources. We should be using idling resources during espresso tests for threads that we create ourselves, because espresso does not know about them. Hopefully this reduces some of the flakiness of espresso tests that we have today. This required converting all existing calls to DialerExecutors to pass a context used to fetch the component, and also required creating new application classes for espresso tests. Test: temporarily added a task which just slept to DialtactsActivity and verified that its integration test failed due to idling resource timeout PiperOrigin-RevId: 173334773 Change-Id: I876a93022d235d62cfc377bf5b06687e21a34758
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r--java/com/android/incallui/ContactInfoCache.java6
-rw-r--r--java/com/android/incallui/ContactsAsyncHelper.java2
-rw-r--r--java/com/android/incallui/InCallPresenter.java6
3 files changed, 9 insertions, 5 deletions
diff --git a/java/com/android/incallui/ContactInfoCache.java b/java/com/android/incallui/ContactInfoCache.java
index 272c2b776..2735461b2 100644
--- a/java/com/android/incallui/ContactInfoCache.java
+++ b/java/com/android/incallui/ContactInfoCache.java
@@ -86,8 +86,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
private final ConcurrentHashMap<String, ContactCacheEntry> mInfoMap = new ConcurrentHashMap<>();
private final Map<String, Set<ContactInfoCacheCallback>> mCallBacks = new ArrayMap<>();
private int mQueryId;
- private final DialerExecutor<CnapInformationWrapper> cachedNumberLookupExecutor =
- DialerExecutors.createNonUiTaskBuilder(new CachedNumberLookupWorker()).build();
+ private final DialerExecutor<CnapInformationWrapper> cachedNumberLookupExecutor;
private static class CachedNumberLookupWorker implements Worker<CnapInformationWrapper, Void> {
@Nullable
@@ -126,6 +125,8 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
Trace.beginSection("ContactInfoCache constructor");
mContext = context;
mPhoneNumberService = Bindings.get(context).newPhoneNumberService(context);
+ cachedNumberLookupExecutor =
+ DialerExecutors.createNonUiTaskBuilder(mContext, new CachedNumberLookupWorker()).build();
Trace.endSection();
}
@@ -718,6 +719,7 @@ public class ContactInfoCache implements OnImageLoadCompleteListener {
int queryId;
/** The phone number without any changes to display to the user (ex: cnap...) */
String originalPhoneNumber;
+
boolean shouldShowLocation;
boolean isBusiness;
diff --git a/java/com/android/incallui/ContactsAsyncHelper.java b/java/com/android/incallui/ContactsAsyncHelper.java
index 6237ca3e5..2e893b01a 100644
--- a/java/com/android/incallui/ContactsAsyncHelper.java
+++ b/java/com/android/incallui/ContactsAsyncHelper.java
@@ -94,7 +94,7 @@ public class ContactsAsyncHelper {
args.displayPhotoUri = displayPhotoUri;
args.listener = listener;
- DialerExecutors.createNonUiTaskBuilder(new Worker())
+ DialerExecutors.createNonUiTaskBuilder(context, new Worker())
.onSuccess(
output -> {
if (args.listener != null) {
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java
index b8a2baa00..8535cbc3e 100644
--- a/java/com/android/incallui/InCallPresenter.java
+++ b/java/com/android/incallui/InCallPresenter.java
@@ -45,7 +45,7 @@ import com.android.dialer.blocking.FilteredNumberCompat;
import com.android.dialer.blocking.FilteredNumbersUtil;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.common.concurrent.DefaultDialerExecutorFactory;
+import com.android.dialer.common.concurrent.DialerExecutorComponent;
import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.location.GeoUtil;
import com.android.dialer.logging.InteractionEvent;
@@ -373,7 +373,9 @@ public class InCallPresenter implements CallList.Listener {
mCallList.addListener(this);
// Create spam call list listener and add it to the list of listeners
- mSpamCallListListener = new SpamCallListListener(context, new DefaultDialerExecutorFactory());
+ mSpamCallListListener =
+ new SpamCallListListener(
+ context, DialerExecutorComponent.get(context).dialerExecutorFactory());
mCallList.addListener(mSpamCallListListener);
VideoPauseController.getInstance().setUp(this);