Hopefully reducing flakes by waiting for SysUI objects
Looks like when orientation change is involved, it takes some time for SysUI object to reappear. Change-Id: Id08d385ea1a535d8bcd87b123f0373cd28d90a92
This commit is contained in:
parent
9893578356
commit
2ec9f290bf
|
@ -71,7 +71,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
|||
|
||||
mLauncher.swipe(centerX, startY, centerX, startY - swipeHeight - slop, expectedState);
|
||||
} else {
|
||||
mLauncher.getSystemUiObject("recent_apps").click();
|
||||
mLauncher.waitForSystemUiObject("recent_apps").click();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
|
|||
}
|
||||
|
||||
protected int getSwipeStartY() {
|
||||
return mLauncher.getSystemUiObject("home").getVisibleBounds().centerY();
|
||||
return mLauncher.waitForSystemUiObject("home").getVisibleBounds().centerY();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ public final class LauncherInstrumentation {
|
|||
executeAndWaitForEvent(
|
||||
() -> {
|
||||
log("LauncherInstrumentation.pressHome before clicking");
|
||||
getSystemUiObject("home").click();
|
||||
waitForSystemUiObject("home").click();
|
||||
},
|
||||
event -> true,
|
||||
"Pressing Home didn't produce any events");
|
||||
|
@ -298,7 +298,7 @@ public final class LauncherInstrumentation {
|
|||
executeAndWaitForEvent(
|
||||
() -> {
|
||||
log("LauncherInstrumentation.pressHome before clicking");
|
||||
getSystemUiObject("home").click();
|
||||
waitForSystemUiObject("home").click();
|
||||
},
|
||||
event -> true,
|
||||
"Pressing Home didn't produce any events");
|
||||
|
@ -394,8 +394,9 @@ public final class LauncherInstrumentation {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
UiObject2 getSystemUiObject(String resId) {
|
||||
final UiObject2 object = mDevice.findObject(By.res(SYSTEMUI_PACKAGE, resId));
|
||||
UiObject2 waitForSystemUiObject(String resId) {
|
||||
final UiObject2 object = mDevice.wait(
|
||||
Until.findObject(By.res(SYSTEMUI_PACKAGE, resId)), WAIT_TIME_MS);
|
||||
assertNotNull("Can't find a systemui object with id: " + resId, object);
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public final class Overview extends BaseOverview {
|
|||
verifyActiveContainer();
|
||||
|
||||
// Swipe from navbar to the top.
|
||||
final UiObject2 navBar = mLauncher.getSystemUiObject("navigation_bar_frame");
|
||||
final UiObject2 navBar = mLauncher.waitForSystemUiObject("navigation_bar_frame");
|
||||
final Point start = navBar.getVisibleCenter();
|
||||
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
|
||||
mLauncher.swipe(start.x, start.y, start.x, 0, ALL_APPS_STATE_ORDINAL);
|
||||
|
|
Loading…
Reference in New Issue