summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-03-28 13:47:09 -0700
committervadimt <vadimt@google.com>2019-03-28 16:02:47 -0700
commitc5b06f4cf6feb6a71330267f4de54718d84830a6 (patch)
treea7a93a4d5de829a24d56491044cbcf6b82da1c30 /tests
parent60353faa2e796f461c9271b75b3849e070c4532f (diff)
downloadandroid_packages_apps_Trebuchet-c5b06f4cf6feb6a71330267f4de54718d84830a6.tar.gz
android_packages_apps_Trebuchet-c5b06f4cf6feb6a71330267f4de54718d84830a6.tar.bz2
android_packages_apps_Trebuchet-c5b06f4cf6feb6a71330267f4de54718d84830a6.zip
Preparing QuickstepOnOff for running in 3 navigation modes
Change-Id: I7855e756c9886a21bfc2584cf42e7921147fb256
Diffstat (limited to 'tests')
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java37
1 files changed, 23 insertions, 14 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 125deafb9..b71f790b8 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -166,23 +166,28 @@ public final class LauncherInstrumentation {
}
public NavigationModel getNavigationModel() {
- return isSwipeUpEnabled() ? NavigationModel.TWO_BUTTON : NavigationModel.THREE_BUTTON;
- }
-
- static boolean needSlowGestures() {
- return Build.MODEL.contains("Cuttlefish");
- }
-
- private boolean isSwipeUpEnabled() {
final Context baseContext = mInstrumentation.getTargetContext();
try {
// Workaround, use constructed context because both the instrumentation context and the
// app context are not constructed with resources that take overlays into account
- Context ctx = baseContext.createPackageContext(getLauncherPackageName(), 0);
- return !QuickStepContract.isLegacyMode(ctx);
+ final Context ctx = baseContext.createPackageContext("android", 0);
+ if (QuickStepContract.isGesturalMode(ctx)) {
+ return NavigationModel.ZERO_BUTTON;
+ } else if (QuickStepContract.isSwipeUpMode(ctx)) {
+ return NavigationModel.TWO_BUTTON;
+ } else if (QuickStepContract.isLegacyMode(ctx)) {
+ return NavigationModel.THREE_BUTTON;
+ } else {
+ fail("Can't detect navigation mode");
+ }
} catch (PackageManager.NameNotFoundException e) {
- return false;
+ fail(e.toString());
}
+ return NavigationModel.THREE_BUTTON;
+ }
+
+ static boolean needSlowGestures() {
+ return Build.MODEL.contains("Cuttlefish");
}
static void log(String message) {
@@ -233,9 +238,13 @@ public final class LauncherInstrumentation {
private UiObject2 verifyContainerType(ContainerType containerType) {
assertEquals("Unexpected display rotation",
mExpectedRotation, mDevice.getDisplayRotation());
- assertTrue("Presence of recents button doesn't match isSwipeUpEnabled()",
- isSwipeUpEnabled() ==
- (mDevice.findObject(By.res(SYSTEMUI_PACKAGE, "recent_apps")) == null));
+ final NavigationModel navigationModel = getNavigationModel();
+ assertTrue("Presence of recents button doesn't match the interaction mode",
+ (navigationModel == NavigationModel.THREE_BUTTON) ==
+ mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, "recent_apps")));
+ assertTrue("Presence of home button doesn't match the interaction mode",
+ (navigationModel != NavigationModel.ZERO_BUTTON) ==
+ mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, "home")));
log("verifyContainerType: " + containerType);
try (Closable c = addContextLayer(