Merge "Not waiting for animations for Launcher clicks" into tm-qpr-dev am: e74238d233

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/20790706

Change-Id: Ie2a1435654da87834384deaf4e46f3b17af2f5a6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vadim Tryshev
2022-12-20 22:26:32 +00:00
committed by Automerger Merge Worker
3 changed files with 16 additions and 12 deletions

View File

@@ -45,7 +45,8 @@ public class AddToHomeScreenPrompt {
mLauncher.clickObject(
mLauncher.waitForObjectInContainer(
mWidgetCell.getParent().getParent().getParent().getParent(),
By.text(ADD_AUTOMATICALLY)));
By.text(ADD_AUTOMATICALLY)),
LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
mLauncher.waitUntilLauncherObjectGone(getSelector());
}
}

View File

@@ -1466,19 +1466,22 @@ public final class LauncherInstrumentation {
return getRealDisplaySize().x - getWindowInsets().right - 1;
}
void clickObject(UiObject2 object) {
waitForObjectEnabled(object, "clickObject");
if (!isLauncher3() && getNavigationModel() != NavigationModel.THREE_BUTTON) {
expectEvent(TestProtocol.SEQUENCE_TIS, LauncherInstrumentation.EVENT_TOUCH_DOWN_TIS);
expectEvent(TestProtocol.SEQUENCE_TIS, LauncherInstrumentation.EVENT_TOUCH_UP_TIS);
}
object.click();
/**
* Click on the ui object right away without waiting for animation.
*
* [UiObject2.click] would wait for all animations finished before clicking. Not waiting for
* animations because in some scenarios there is a playing animations when the click is
* attempted.
*/
void clickObject(UiObject2 uiObject, GestureScope gestureScope) {
final long clickTime = SystemClock.uptimeMillis();
final Point center = uiObject.getVisibleCenter();
sendPointer(clickTime, clickTime, MotionEvent.ACTION_DOWN, center, gestureScope);
sendPointer(clickTime, clickTime, MotionEvent.ACTION_UP, center, gestureScope);
}
void clickLauncherObject(UiObject2 object) {
expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN);
expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP);
clickObject(object);
clickObject(object, GestureScope.INSIDE);
}
void scrollToLastVisibleRow(

View File

@@ -385,7 +385,7 @@ public final class Workspace extends Home {
Until.hasObject(installerAlert), LauncherInstrumentation.WAIT_TIME_MS));
final UiObject2 ok = device.findObject(By.text("OK"));
assertNotNull("OK button is not shown", ok);
launcher.clickObject(ok);
launcher.clickObject(ok, LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
assertTrue("Uninstall alert is not dismissed after clicking OK", device.wait(
Until.gone(installerAlert), LauncherInstrumentation.WAIT_TIME_MS));