diff options
author | zachh <zachh@google.com> | 2017-10-24 17:10:06 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-25 16:59:31 +0000 |
commit | 6a4cebdb4ccc974d04f125847c03fddec18b2b9f (patch) | |
tree | a1baaedfe7538758e2622ee2746a6487428db1e1 /java/com/android/dialer/callcomposer/GalleryComposerFragment.java | |
parent | 35ec9146f0f44898f2249be3e505ff7bef171e11 (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/dialer/callcomposer/GalleryComposerFragment.java')
-rw-r--r-- | java/com/android/dialer/callcomposer/GalleryComposerFragment.java | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java index 2e6a28c33..e604ec1b0 100644 --- a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java +++ b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java @@ -28,7 +28,6 @@ import android.os.Parcelable; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; import android.support.v4.app.LoaderManager.LoaderCallbacks; import android.support.v4.content.ContextCompat; import android.support.v4.content.CursorLoader; @@ -40,11 +39,9 @@ import android.view.ViewGroup; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; -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.DialerExecutor; -import com.android.dialer.common.concurrent.DialerExecutorFactory; +import com.android.dialer.common.concurrent.DialerExecutorComponent; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.util.PermissionsUtil; @@ -62,8 +59,6 @@ public class GalleryComposerFragment extends CallComposerFragment private static final int RESULT_LOAD_IMAGE = 1; private static final int RESULT_OPEN_SETTINGS = 2; - private DialerExecutorFactory executorFactory = new DefaultDialerExecutorFactory(); - private GalleryGridAdapter adapter; private GridView galleryGridView; private View permissionView; @@ -81,11 +76,6 @@ public class GalleryComposerFragment extends CallComposerFragment return new GalleryComposerFragment(); } - @VisibleForTesting - void setExecutorFactory(@NonNull DialerExecutorFactory executorFactory) { - this.executorFactory = Assert.isNotNull(executorFactory); - } - @Nullable @Override public View onCreateView( @@ -123,7 +113,8 @@ public class GalleryComposerFragment extends CallComposerFragment super.onActivityCreated(bundle); copyAndResizeImage = - executorFactory + DialerExecutorComponent.get(getContext()) + .dialerExecutorFactory() .createUiTaskBuilder( getActivity().getFragmentManager(), "copyAndResizeImage", |