From 9915a7c60fce897f9a450e82d5d45fec61713a63 Mon Sep 17 00:00:00 2001 From: vadimt Date: Wed, 8 Apr 2020 18:56:52 -0700 Subject: [PATCH] TAPL waits for widgets recycler to become scrollable On the Launcher side, moving setLayoutFrozen from the posted action to avoid a possible short scrollable period just after the view is shown. Bug: 152354290 Change-Id: I7319236d8a6e49a7e017fd54d593ee131dff10a9 --- src/com/android/launcher3/widget/WidgetsFullSheet.java | 2 +- tests/tapl/com/android/launcher3/tapl/Widgets.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java index b3e9734e9d..37a30af22a 100644 --- a/src/com/android/launcher3/widget/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java @@ -193,6 +193,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet .setDuration(DEFAULT_OPEN_DURATION) .setInterpolator(AnimationUtils.loadInterpolator( getContext(), android.R.interpolator.linear_out_slow_in)); + mRecyclerView.setLayoutFrozen(true); mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { @@ -202,7 +203,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet } }); post(() -> { - mRecyclerView.setLayoutFrozen(true); mOpenCloseAnimator.start(); mContent.animate().alpha(1).setDuration(FADE_IN_DURATION); }); diff --git a/tests/tapl/com/android/launcher3/tapl/Widgets.java b/tests/tapl/com/android/launcher3/tapl/Widgets.java index 5be57c6c0b..6f847e9c77 100644 --- a/tests/tapl/com/android/launcher3/tapl/Widgets.java +++ b/tests/tapl/com/android/launcher3/tapl/Widgets.java @@ -16,6 +16,8 @@ package com.android.launcher3.tapl; +import static com.android.launcher3.tapl.LauncherInstrumentation.WAIT_TIME_MS; + import android.graphics.Point; import android.graphics.Rect; @@ -23,6 +25,7 @@ import androidx.test.uiautomator.By; import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; +import androidx.test.uiautomator.Until; import com.android.launcher3.tapl.LauncherInstrumentation.GestureScope; @@ -91,6 +94,8 @@ public final class Widgets extends LauncherInstrumentation.VisibleContainer { try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "getting widget " + labelText + " in widgets list")) { final UiObject2 widgetsContainer = verifyActiveContainer(); + mLauncher.assertTrue("Widgets container didn't become scrollable", + widgetsContainer.wait(Until.scrollable(true), WAIT_TIME_MS)); final Point displaySize = mLauncher.getRealDisplaySize(); final BySelector labelSelector = By.clazz("android.widget.TextView").text(labelText);