summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-06-17 07:51:19 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-06-17 07:51:19 -0700
commit1461f48ef21efc3be88dfac88c34a5641cf66f10 (patch)
treedf23f488acc609ac268eb2c61e0896bbf49b1b9b /tests
parent0e57817adce06277b7ae07fdc5c0d1c4e1723958 (diff)
parentf46e3956ddba136c44df97aa1997aa67b0387018 (diff)
downloadandroid_packages_apps_Trebuchet-1461f48ef21efc3be88dfac88c34a5641cf66f10.tar.gz
android_packages_apps_Trebuchet-1461f48ef21efc3be88dfac88c34a5641cf66f10.tar.bz2
android_packages_apps_Trebuchet-1461f48ef21efc3be88dfac88c34a5641cf66f10.zip
Merging ub-launcher3-qt-dev, build 5662436
Test: Manual Bug:109954539 P4 Clock widget is not adaptively changing color based on wallpaper Bug:122345781 P1 Inflation happens and a binder call during swipe up gesture, that may cause jank Bug:130687624 P1 [B1C1][B4S4][QT][CTS-Verifier]OTHER-Screen Pinning Test Bug:131698448 P2 Launcher makes a binder call to check Keygaurd.isDeviceLocked Bug:132900132 P1 Apparently, tests start running while provisioning is still in progress Bug:132906035 P1 [Metrics] add Home / Back button events even when Launcher is in the background Bug:132915522 P1 Snap the window to the bottom if touch Y is below a threshold Bug:133867119 P2 Lab-only flake: want to switch from workspace to all apps; Swipe failed to receive an event for the swipe end Bug:134172603 P1 Tracing for lab-only flakes Bug:135130011 P1 16ms delay when opening app due to dynamic icon loading Bug:135214165 P1 Quickstep slop do not respect density changes Bug:135257548 P1 Adding shortcut can crash Launcher Bug:64712476 P3 Import translations for dev branches Change-Id: I9af1d8260b45fba32841877d88bad5a53f2e5746
Diffstat (limited to 'tests')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/AllApps.java43
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java37
2 files changed, 27 insertions, 53 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index 21d763e30..9ff354a7e 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -16,8 +16,6 @@
package com.android.launcher3.tapl;
-import static com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
-
import android.graphics.Point;
import android.graphics.Rect;
import android.widget.TextView;
@@ -36,7 +34,6 @@ import com.android.launcher3.testing.TestProtocol;
*/
public class AllApps extends LauncherInstrumentation.VisibleContainer {
private static final int MAX_SCROLL_ATTEMPTS = 40;
- private static final int MIN_INTERACT_SIZE = 100;
private final int mHeight;
@@ -65,13 +62,6 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
}
final Rect iconBounds = icon.getVisibleBounds();
LauncherInstrumentation.log("hasClickableIcon: icon bounds: " + iconBounds);
- if (mLauncher.getNavigationModel() != ZERO_BUTTON) {
- final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
- if (iconBounds.bottom >= navBar.getVisibleBounds().top) {
- LauncherInstrumentation.log("hasClickableIcon: icon intersects with nav bar");
- return false;
- }
- }
if (iconCenterInSearchBox(allAppsContainer, icon)) {
LauncherInstrumentation.log("hasClickableIcon: icon center is under search box");
return false;
@@ -96,7 +86,7 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
@NonNull
public AppIcon getAppIcon(String appName) {
try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "want to get app icon " + appName + " on all apps")) {
+ "getting app icon " + appName + " on all apps")) {
final UiObject2 allAppsContainer = verifyActiveContainer();
final UiObject2 appListRecycler = mLauncher.waitForObjectInContainer(allAppsContainer,
"apps_list_view");
@@ -110,21 +100,28 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
if (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector)) {
scrollBackToBeginning();
int attempts = 0;
+ int scroll = getScroll(allAppsContainer);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer("scrolled")) {
- while (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector) &&
- allAppsContainer.scroll(Direction.DOWN, 0.8f)) {
+ while (!hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector)) {
+ mLauncher.scroll(allAppsContainer, Direction.DOWN, 0.8f, null, 50);
+ final int newScroll = getScroll(allAppsContainer);
+ if (newScroll == scroll) break;
+
mLauncher.assertTrue(
"Exceeded max scroll attempts: " + MAX_SCROLL_ATTEMPTS,
++attempts <= MAX_SCROLL_ATTEMPTS);
verifyActiveContainer();
+ scroll = newScroll;
}
}
verifyActiveContainer();
}
+ mLauncher.assertTrue("Unable to scroll to a clickable icon: " + appName,
+ hasClickableIcon(allAppsContainer, appListRecycler, appIconSelector));
+
final UiObject2 appIcon = mLauncher.getObjectInContainer(appListRecycler,
appIconSelector);
- ensureIconVisible(appIcon, allAppsContainer, appListRecycler);
return new AppIcon(mLauncher, appIcon);
}
}
@@ -162,24 +159,6 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
getInt(TestProtocol.SCROLL_Y_FIELD, -1);
}
- private void ensureIconVisible(
- UiObject2 appIcon, UiObject2 allAppsContainer, UiObject2 appListRecycler) {
- final int appHeight = appIcon.getVisibleBounds().height();
- if (appHeight < MIN_INTERACT_SIZE) {
- // Try to figure out how much percentage of the container needs to be scrolled in order
- // to reveal the app icon to have the MIN_INTERACT_SIZE
- final float pct = Math.max(((float) (MIN_INTERACT_SIZE - appHeight)) / mHeight, 0.2f);
- mLauncher.scroll(appListRecycler, Direction.DOWN, pct, null, 10);
- try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
- "scrolled an icon in all apps to make it visible - and then")) {
- mLauncher.waitForIdle();
- verifyActiveContainer();
- }
- }
- mLauncher.assertTrue("Couldn't scroll app icon to not intersect with the search box",
- !iconCenterInSearchBox(allAppsContainer, appIcon));
- }
-
private UiObject2 getSearchBox(UiObject2 allAppsContainer) {
return mLauncher.waitForObjectInContainer(allAppsContainer, "search_container_all_apps");
}
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 8ebe52565..2db9d0826 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -208,14 +208,10 @@ public final class LauncherInstrumentation {
// app context are not constructed with resources that take overlays into account
final Context ctx = baseContext.createPackageContext("android", 0);
for (int i = 0; i < 100; ++i) {
- log("Interaction mode = " + getCurrentInteractionMode(ctx));
- if (isGesturalMode(ctx)) {
- return NavigationModel.ZERO_BUTTON;
- } else if (isSwipeUpMode(ctx)) {
- return NavigationModel.TWO_BUTTON;
- } else if (isLegacyMode(ctx)) {
- return NavigationModel.THREE_BUTTON;
- }
+ final int currentInteractionMode = getCurrentInteractionMode(ctx);
+ final NavigationModel model = getNavigationModel(currentInteractionMode);
+ log("Interaction mode = " + currentInteractionMode + " (" + model + ")");
+ if (model != null) return model;
Thread.sleep(100);
}
fail("Can't detect navigation mode");
@@ -225,6 +221,17 @@ public final class LauncherInstrumentation {
return NavigationModel.THREE_BUTTON;
}
+ public static NavigationModel getNavigationModel(int currentInteractionMode) {
+ if (QuickStepContract.isGesturalMode(currentInteractionMode)) {
+ return NavigationModel.ZERO_BUTTON;
+ } else if (QuickStepContract.isSwipeUpMode(currentInteractionMode)) {
+ return NavigationModel.TWO_BUTTON;
+ } else if (QuickStepContract.isLegacyMode(currentInteractionMode)) {
+ return NavigationModel.THREE_BUTTON;
+ }
+ return null;
+ }
+
public static boolean isAvd() {
return Build.MODEL.contains("Cuttlefish");
}
@@ -748,19 +755,7 @@ public final class LauncherInstrumentation {
return currentTime;
}
- public static boolean isGesturalMode(Context context) {
- return QuickStepContract.isGesturalMode(getCurrentInteractionMode(context));
- }
-
- public static boolean isSwipeUpMode(Context context) {
- return QuickStepContract.isSwipeUpMode(getCurrentInteractionMode(context));
- }
-
- public static boolean isLegacyMode(Context context) {
- return QuickStepContract.isLegacyMode(getCurrentInteractionMode(context));
- }
-
- private static int getCurrentInteractionMode(Context context) {
+ public static int getCurrentInteractionMode(Context context) {
return getSystemIntegerRes(context, "config_navBarInteractionMode");
}