diff options
author | vadimt <vadimt@google.com> | 2019-05-10 12:12:44 -0700 |
---|---|---|
committer | vadimt <vadimt@google.com> | 2019-05-10 12:12:44 -0700 |
commit | 732becfd664b243dea7507d568654b97efd211a6 (patch) | |
tree | de7fa2e5cdc8bf2008b52fb838b6bfc644ff2b6c /tests/tapl | |
parent | fc65c357a1e396d3ee2b9b1a90f34011e12f1f6c (diff) | |
download | android_packages_apps_Trebuchet-732becfd664b243dea7507d568654b97efd211a6.tar.gz android_packages_apps_Trebuchet-732becfd664b243dea7507d568654b97efd211a6.tar.bz2 android_packages_apps_Trebuchet-732becfd664b243dea7507d568654b97efd211a6.zip |
Tests: attempt to wait until navigation mode settles after switching
Change-Id: If2d14a062275a6cfbc81d1cb7d7ca38da302b51c
Diffstat (limited to 'tests/tapl')
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 4d8ff1bb2..0d8d92c88 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -176,17 +176,19 @@ public final class LauncherInstrumentation { // Workaround, use constructed context because both the instrumentation context and the // app context are not constructed with resources that take overlays into account final Context ctx = baseContext.createPackageContext("android", 0); - 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; - } else { - fail("Can't detect navigation mode"); + 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; + } + Thread.sleep(100); } - } catch (PackageManager.NameNotFoundException e) { + fail("Can't detect navigation mode"); + } catch (Exception e) { fail(e.toString()); } return NavigationModel.THREE_BUTTON; |