Merge "Tests: attempt to wait until navigation mode settles after switching" into ub-launcher3-qt-dev

This commit is contained in:
Vadim Tryshev
2019-05-10 19:44:16 +00:00
committed by Android (Google) Code Review
@@ -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;