Swipe from all apps from overview starts on an icon

In some configs, Overview has prediction row, in others hotseat. So
swiping from an icon in either.

Change-Id: I98db3df4f612fcd9d5b7057835c49ca58313210f
This commit is contained in:
vadimt
2019-05-14 18:55:37 -07:00
parent f5b34715b2
commit 1886245359
2 changed files with 16 additions and 3 deletions
@@ -531,6 +531,14 @@ public final class LauncherInstrumentation {
return object;
}
@NonNull
UiObject2 waitForLauncherObjectByClass(String clazz) {
final BySelector selector = getLauncherObjectSelectorByClass(clazz);
final UiObject2 object = mDevice.wait(Until.findObject(selector), WAIT_TIME_MS);
assertNotNull("Can't find a launcher object; selector: " + selector, object);
return object;
}
@NonNull
UiObject2 waitForFallbackLauncherObject(String resName) {
final BySelector selector = getFallbackLauncherObjectSelector(resName);
@@ -543,6 +551,10 @@ public final class LauncherInstrumentation {
return By.res(getLauncherPackageName(), resName);
}
BySelector getLauncherObjectSelectorByClass(String clazz) {
return By.pkg(getLauncherPackageName()).clazz(clazz);
}
BySelector getFallbackLauncherObjectSelector(String resName) {
return By.res(getOverviewPackageName(), resName);
}
@@ -49,11 +49,12 @@ public final class Overview extends BaseOverview {
"want to switch from overview to all apps")) {
verifyActiveContainer();
// Swipe from the prediction row to the top.
// Swipe from an app icon to the top.
LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
final UiObject2 predictionRow = mLauncher.waitForLauncherObject("prediction_row");
final UiObject2 appIcon = mLauncher.waitForLauncherObjectByClass(
"android.widget.TextView");
mLauncher.swipeToState(mLauncher.getDevice().getDisplayWidth() / 2,
predictionRow.getVisibleBounds().centerY(),
appIcon.getVisibleBounds().centerY(),
mLauncher.getDevice().getDisplayWidth() / 2,
0, 50, ALL_APPS_STATE_ORDINAL);