diff options
author | Vadim Tryshev <vadimt@google.com> | 2019-03-28 23:50:25 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-28 23:50:25 +0000 |
commit | 09b91447467ad401e994e6e215d9a5b770dbe2c3 (patch) | |
tree | e14c0ad917f6cf6f1cf2fe46ccb2913db8c02f21 /tests | |
parent | ae775276ac4c4ae1a89b388a3e422d93d5487d7d (diff) | |
parent | c5b06f4cf6feb6a71330267f4de54718d84830a6 (diff) | |
download | android_packages_apps_Trebuchet-09b91447467ad401e994e6e215d9a5b770dbe2c3.tar.gz android_packages_apps_Trebuchet-09b91447467ad401e994e6e215d9a5b770dbe2c3.tar.bz2 android_packages_apps_Trebuchet-09b91447467ad401e994e6e215d9a5b770dbe2c3.zip |
Merge "Preparing QuickstepOnOff for running in 3 navigation modes" into ub-launcher3-master
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 37 |
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( |