When scrolling in All apps, scroll to last clickable row
Not the last row.
Also scrolling in the middle of All Apps, not at the top, because
otherwise the scroll can start on search box.
Bug: 144180777
Change-Id: I219faec165b8b403530a9c09d419cc453aea6039
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index cc92327..1ecfff7 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -29,6 +29,8 @@
import com.android.launcher3.ResourceUtils;
import com.android.launcher3.testing.TestProtocol;
+import java.util.stream.Collectors;
+
/**
* Operations on AllApps opened from Home. Also a parent for All Apps opened from Overview.
*/
@@ -67,7 +69,7 @@
return false;
}
if (iconBounds.bottom > displayBottom) {
- LauncherInstrumentation.log("hasClickableIcon: icon center bellow bottom offset");
+ LauncherInstrumentation.log("hasClickableIcon: icon bottom below bottom offset");
return false;
}
LauncherInstrumentation.log("hasClickableIcon: icon is clickable");
@@ -116,7 +118,12 @@
displayBottom)) {
mLauncher.scrollToLastVisibleRow(
allAppsContainer,
- mLauncher.getObjectsInContainer(allAppsContainer, "icon"),
+ mLauncher.getObjectsInContainer(allAppsContainer, "icon")
+ .stream()
+ .filter(object ->
+ object.getVisibleBounds().bottom
+ <= displayBottom)
+ .collect(Collectors.toList()),
searchBox.getVisibleBounds().bottom
- allAppsContainer.getVisibleBounds().top);
final int newScroll = getAllAppsScroll();
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 1c851f4..0d3938f 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -797,14 +797,15 @@
// TODO: Make the gesture steps dependent on the distance so that it can run for various
// screen sizes
+ final int totalMargin = Math.max(bottomMargin, getBottomGestureMargin(container));
scroll(
container,
Direction.DOWN,
new Rect(
0,
+ totalMargin / 2,
0,
- 0,
- Math.max(bottomMargin, getBottomGestureMargin(container))),
+ totalMargin / 2),
80);
}