diff options
Diffstat (limited to 'tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index e45fca8c0..09df3960a 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); + log("Interaction mode = " + currentInteractionMode); + final NavigationModel model = getNavigationModel(currentInteractionMode); + 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"); } @@ -742,19 +749,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"); } |