From 3d13f303ee23a1ce01e81a450f71bcfe0cde025a Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 10 May 2019 19:51:22 -0700 Subject: Using model-time scrolling in all apps This should solve flakes when the test thread wakes up too rarely to inject enough touch events. Change-Id: I461583d35eb4bfe0192b81c242aacf8d20e353d1 --- src/com/android/launcher3/allapps/AllAppsRecyclerView.java | 12 +++++++++++- src/com/android/launcher3/allapps/DiscoveryBounce.java | 6 +++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/com/android/launcher3/allapps') diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 180ca4816..548d5de0e 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -32,7 +32,8 @@ import com.android.launcher3.ItemInfo; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; -import com.android.launcher3.graphics.DrawableFactory; +import com.android.launcher3.Utilities; +import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; @@ -419,4 +420,13 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine public boolean hasOverlappingRendering() { return false; } + + @Override + public void onScrollStateChanged(int state) { + super.onScrollStateChanged(state); + + if (state == SCROLL_STATE_IDLE && Utilities.IS_RUNNING_IN_TEST_HARNESS) { + AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext()); + } + } } diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 7467119b5..1d62b435d 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -24,7 +24,6 @@ import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerTyp import android.animation.Animator; import android.animation.AnimatorInflater; import android.animation.AnimatorListenerAdapter; -import android.app.ActivityManager; import android.content.SharedPreferences; import android.os.Handler; import android.view.MotionEvent; @@ -32,6 +31,7 @@ import android.view.MotionEvent; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.states.InternalStateHandler; @@ -134,7 +134,7 @@ public class DiscoveryBounce extends AbstractFloatingView { && !shouldShowForWorkProfile(launcher)) || AbstractFloatingView.getTopOpenView(launcher) != null || UserManagerCompat.getInstance(launcher).isDemoUser() - || ActivityManager.isRunningInTestHarness()) { + || Utilities.IS_RUNNING_IN_TEST_HARNESS) { return; } @@ -159,7 +159,7 @@ public class DiscoveryBounce extends AbstractFloatingView { || (launcher.getSharedPrefs().getBoolean(SHELF_BOUNCE_SEEN, false) && !shouldShowForWorkProfile(launcher)) || UserManagerCompat.getInstance(launcher).isDemoUser() - || ActivityManager.isRunningInTestHarness()) { + || Utilities.IS_RUNNING_IN_TEST_HARNESS) { return; } -- cgit v1.2.3