diff options
author | Vadim Tryshev <vadimt@google.com> | 2019-05-10 19:44:16 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-05-10 19:44:16 +0000 |
commit | a36ace25470c0ef4d8120325acc587822a9cdf89 (patch) | |
tree | a7e621324e3b665f60e67ea2dd860651d8691790 /tests | |
parent | b35b7dee18be3f2715e75a2aafe6bfaaa3815f65 (diff) | |
parent | 732becfd664b243dea7507d568654b97efd211a6 (diff) | |
download | android_packages_apps_Trebuchet-a36ace25470c0ef4d8120325acc587822a9cdf89.tar.gz android_packages_apps_Trebuchet-a36ace25470c0ef4d8120325acc587822a9cdf89.tar.bz2 android_packages_apps_Trebuchet-a36ace25470c0ef4d8120325acc587822a9cdf89.zip |
Merge "Tests: attempt to wait until navigation mode settles after switching" into ub-launcher3-qt-dev
Diffstat (limited to 'tests')
-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; |