Merge "Removing verifying motion events in TAPL" into udc-qpr-dev am: 2cd2e2dade

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

Change-Id: I8c8d85d47253d2923c04bae29509d2a489bc863d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Vadim Tryshev
2023-09-06 23:39:05 +00:00
committed by Automerger Merge Worker
14 changed files with 62 additions and 173 deletions

View File

@@ -17,7 +17,6 @@ package com.android.launcher3.testing;
import static com.android.launcher3.allapps.AllAppsStore.DEFER_UPDATES_TEST;
import static com.android.launcher3.config.FeatureFlags.ENABLE_GRID_ONLY_OVERVIEW;
import static com.android.launcher3.config.FeatureFlags.ENABLE_TRACKPAD_GESTURE;
import static com.android.launcher3.config.FeatureFlags.FOLDABLE_SINGLE_PAGE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
@@ -236,12 +235,6 @@ public class TestInformationHandler implements ResourceBasedOverride {
return response;
}
case TestProtocol.REQUEST_IS_TRACKPAD_GESTURE_ENABLED: {
response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
ENABLE_TRACKPAD_GESTURE.get());
return response;
}
case TestProtocol.REQUEST_ALL_APPS_TOP_PADDING: {
return getLauncherUIProperty(Bundle::putInt,
l -> l.getAppsView().getActiveRecyclerView().getClipBounds().top);

View File

@@ -70,15 +70,12 @@ public final class TestLogging {
public static void recordMotionEvent(String sequence, String message, MotionEvent event) {
final int action = event.getAction();
if (Utilities.isRunningInTestHarness() && action != MotionEvent.ACTION_MOVE) {
// "Expecting" in TAPL ACTION_DOWN, UP and CANCEL events was thought to be producing
// considerable noise in tests due to failed checks for expected events. So we are not
// sending them to TAPL.
// "Expecting" in TAPL motion events was thought to be producing considerable noise in
// tests due to failed checks for expected events. So we are not sending them to TAPL.
// Other events, such as EVENT_PILFER_POINTERS produce less noise and are thought to
// be more useful.
final boolean reportToTapl = action != MotionEvent.ACTION_DOWN
&& action != MotionEvent.ACTION_UP
&& action != MotionEvent.ACTION_CANCEL;
recordEventSlow(sequence, message + ": " + event, reportToTapl);
// That's why we pass false as the value for the 'reportToTapl' parameter.
recordEventSlow(sequence, message + ": " + event, false);
registerEventNotFromTest(event);
}
}

View File

@@ -120,7 +120,6 @@ public final class TestProtocol {
"get-activities-created-count";
public static final String REQUEST_GET_ACTIVITIES = "get-activities";
public static final String REQUEST_HAS_TIS = "has-touch-interaction-service";
public static final String REQUEST_IS_TRACKPAD_GESTURE_ENABLED = "is-trackpad-gesture-enabled";
public static final String REQUEST_TASKBAR_ALL_APPS_TOP_PADDING =
"taskbar-all-apps-top-padding";
public static final String REQUEST_ALL_APPS_TOP_PADDING = "all-apps-top-padding";

View File

@@ -184,7 +184,7 @@ public final class SecondaryDisplayLauncherTest extends AbstractLauncherUiTest {
mStartPoint = icon.getVisibleCenter();
mEndPoint = new Point(mStartPoint.x, mStartPoint.y);
mLauncher.sendPointer(mDownTime, mDownTime, ACTION_DOWN, mStartPoint,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
assertThat(findObjectByResourceName("popup_container")).isNotNull();
return appName;
}
@@ -206,7 +206,7 @@ public final class SecondaryDisplayLauncherTest extends AbstractLauncherUiTest {
mStartPoint = icon.getVisibleCenter();
mEndPoint = new Point(mStartPoint.x, mStartPoint.y);
mLauncher.sendPointer(mDownTime, mDownTime, ACTION_DOWN, mStartPoint,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
assertThat(findObjectByResourceName("popup_container")).isNotNull();
return appName;
}
@@ -214,12 +214,12 @@ public final class SecondaryDisplayLauncherTest extends AbstractLauncherUiTest {
private void moveAppToCenterOfScreen() {
mEndPoint.set(mDevice.getDisplayWidth() / 2, mDevice.getDisplayHeight() / 2);
mLauncher.movePointer(mDownTime, SystemClock.uptimeMillis(), DRAG_TIME_MS, true,
mStartPoint, mEndPoint, LauncherInstrumentation.GestureScope.INSIDE);
mStartPoint, mEndPoint, LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
private void dropApp() {
mLauncher.sendPointer(mDownTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP,
mEndPoint, LauncherInstrumentation.GestureScope.INSIDE);
mEndPoint, LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
private void removeAppByName(String appName) {

View File

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

View File

@@ -66,10 +66,6 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
}
protected boolean zeroButtonToOverviewGestureStartsInLauncher() {
return mLauncher.isTablet();
}
protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
return false;
}
@@ -146,12 +142,9 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
final int centerX = mLauncher.getDevice().getDisplayWidth() / 2;
final int startY = getSwipeStartY();
final Point start = new Point(centerX, startY);
final LauncherInstrumentation.GestureScope gestureScope =
zeroButtonToOverviewGestureStartsInLauncher()
? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
: LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER;
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start, gestureScope);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, start,
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
if (!mLauncher.isLauncher3()) {
mLauncher.expectEvent(TestProtocol.SEQUENCE_PILFER,
@@ -167,10 +160,6 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
final Point start = new Point(centerX, startY);
final Point end =
new Point(centerX, startY - swipeHeight - mLauncher.getTouchSlop());
final LauncherInstrumentation.GestureScope gestureScope =
zeroButtonToOverviewGestureStartsInLauncher()
? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
: LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER;
mLauncher.movePointer(
downTime,
@@ -178,7 +167,7 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
ZERO_BUTTON_SWIPE_UP_GESTURE_DURATION,
start,
end,
gestureScope);
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
}
private void sendUpPointerToEnterOverviewToLauncher(long downTime) {
@@ -189,13 +178,9 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
final Point end =
new Point(centerX, startY - swipeHeight - mLauncher.getTouchSlop());
final LauncherInstrumentation.GestureScope gestureScope =
zeroButtonToOverviewGestureStartsInLauncher()
? LauncherInstrumentation.GestureScope.INSIDE
: LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER;
mLauncher.sendPointer(downTime, SystemClock.uptimeMillis(),
MotionEvent.ACTION_UP, end, gestureScope);
MotionEvent.ACTION_UP, end,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
/**
@@ -227,7 +212,6 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
"want to quick switch to the previous app")) {
verifyActiveContainer();
final boolean launcherWasVisible = mLauncher.isLauncherVisible();
if (mLauncher.getNavigationModel() == NavigationModel.ZERO_BUTTON
|| mLauncher.getTrackpadGestureType() == TrackpadGestureType.FOUR_FINGER) {
final int startX;
@@ -249,13 +233,10 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine
endY = startY;
}
LauncherInstrumentation.GestureScope gestureScope =
launcherWasVisible
? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
: LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER;
mLauncher.executeAndWaitForEvent(
() -> mLauncher.linearGesture(
startX, startY, endX, endY, 20, false, gestureScope),
startX, startY, endX, endY, 20, false,
LauncherInstrumentation.GestureScope.EXPECT_PILFER),
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
() -> "Quick switch gesture didn't change window state", "swiping");
} else {

View File

@@ -58,11 +58,6 @@ public abstract class Home extends Background {
}
}
@Override
protected boolean zeroButtonToOverviewGestureStartsInLauncher() {
return true;
}
@Override
protected boolean zeroButtonToOverviewGestureStateTransitionWhileHolding() {
return true;

View File

@@ -60,8 +60,8 @@ public class HomeAllApps extends AllApps {
endY,
5 /* steps */,
NORMAL_STATE_ORDINAL,
swipeDown ? LauncherInstrumentation.GestureScope.INSIDE
: LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
swipeDown ? LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER
: LauncherInstrumentation.GestureScope.EXPECT_PILFER);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped to workspace")) {

View File

@@ -152,7 +152,7 @@ public abstract class Launchable {
downTime,
MotionEvent.ACTION_DOWN,
iconCenter,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
LauncherInstrumentation.log("movePointerForStartDrag: sent down");
expectLongClickEvents.run();
waitForLongPressConfirmation();
@@ -165,7 +165,7 @@ public abstract class Launchable {
downTime,
downTime,
/* slowDown= */ true,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
private int getStartDragThreshold() {

View File

@@ -128,13 +128,13 @@ public final class LaunchedAppState extends Background {
mLauncher.getRealDisplaySize().x / 2, unstashTargetY);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, unstashTarget,
LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
LauncherInstrumentation.log("showTaskbar: sent down");
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
mLauncher.waitForSystemLauncherObject(TASKBAR_RES_ID);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, unstashTarget,
LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER);
LauncherInstrumentation.GestureScope.EXPECT_PILFER);
return new Taskbar(mLauncher);
}
@@ -183,7 +183,7 @@ public final class LaunchedAppState extends Background {
downTime,
SystemClock.uptimeMillis(),
/* slowDown= */ false,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
try (LauncherInstrumentation.Closable c3 = launcher.addContextLayer(
"moved pointer to drop point")) {
@@ -194,7 +194,7 @@ public final class LaunchedAppState extends Background {
SystemClock.uptimeMillis(),
MotionEvent.ACTION_UP,
endPoint,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
LauncherInstrumentation.log("SplitscreenDragSource.dragToSplitscreen: "
+ "after drop");
@@ -326,7 +326,7 @@ public final class LaunchedAppState extends Background {
null, InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER,
InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_BUTTON_PRESS,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
@@ -336,7 +336,7 @@ public final class LaunchedAppState extends Background {
null, InputDevice.SOURCE_MOUSE);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP,
new Point(stashedTaskbarHintArea.x, stashedTaskbarHintArea.y),
LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER,
InputDevice.SOURCE_MOUSE);
return mLauncher.getWorkspace();

View File

@@ -102,12 +102,6 @@ public final class LauncherInstrumentation {
static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers");
static final Pattern EVENT_START = Pattern.compile("start:");
static final Pattern EVENT_HOVER_ENTER_TIS = getTouchEventPatternTIS("ACTION_HOVER_ENTER");
static final Pattern EVENT_HOVER_EXIT_TIS = getTouchEventPatternTIS("ACTION_HOVER_EXIT");
static final Pattern EVENT_BUTTON_PRESS_TIS = getTouchEventPatternTIS("ACTION_BUTTON_PRESS");
static final Pattern EVENT_BUTTON_RELEASE_TIS =
getTouchEventPatternTIS("ACTION_BUTTON_RELEASE");
private static final Pattern EVENT_KEY_BACK_DOWN =
getKeyEventPattern("ACTION_DOWN", "KEYCODE_BACK");
private static final Pattern EVENT_KEY_BACK_UP =
@@ -127,12 +121,10 @@ public final class LauncherInstrumentation {
public enum NavigationModel {ZERO_BUTTON, THREE_BUTTON}
// Where the gesture happens: outside of Launcher, inside or from inside to outside and
// whether the gesture recognition triggers pilfer.
// Defines whether the gesture recognition triggers pilfer.
public enum GestureScope {
OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE,
INSIDE_TO_OUTSIDE_WITH_KEYCODE, // For gestures that will trigger a keycode from TIS.
OUTSIDE_WITH_KEYCODE,
DONT_EXPECT_PILFER,
EXPECT_PILFER,
}
public enum TrackpadGestureType {
@@ -204,28 +196,6 @@ public final class LauncherInstrumentation {
private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE;
private int mPointerCount = 0;
private static Pattern getTouchEventPatternWithPointerCount(String prefix, String action,
int pointerCount) {
return Pattern.compile(
prefix + ": MotionEvent.*?action=" + action + ".*?id\\[0\\]=0"
+ ".*?toolType\\[0\\]=TOOL_TYPE_FINGER.*?buttonState=0.*?pointerCount="
+ pointerCount);
}
private static Pattern getTouchEventPatternWithPointerCount(String action, int pointerCount) {
return getTouchEventPatternWithPointerCount("Touch event", action, pointerCount);
}
private static Pattern getTouchEventPatternTIS(String action) {
return getTouchEventPatternWithPointerCount("TouchInteractionService.onInputEvent", action,
1);
}
private static Pattern getTouchEventPatternTIS(String action, int pointerCount) {
return getTouchEventPatternWithPointerCount("TouchInteractionService.onInputEvent", action,
pointerCount);
}
private static Pattern getKeyEventPattern(String action, String keyCode) {
return Pattern.compile("Key event: KeyEvent.*action=" + action + ".*keyCode=" + keyCode);
}
@@ -973,8 +943,8 @@ public final class LauncherInstrumentation {
GestureScope gestureScope = gestureStartFromLauncher
// Without the navigation bar layer, the gesture scope on tablets remains inside the
// launcher process.
? (isTablet() ? GestureScope.INSIDE : GestureScope.INSIDE_TO_OUTSIDE)
: GestureScope.OUTSIDE_WITH_PILFER;
? (isTablet() ? GestureScope.DONT_EXPECT_PILFER : GestureScope.EXPECT_PILFER)
: GestureScope.EXPECT_PILFER;
linearGesture(
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
@@ -1046,8 +1016,7 @@ public final class LauncherInstrumentation {
displaySize.x / 2, startY,
displaySize.x / 2, endY,
ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, NORMAL_STATE_ORDINAL,
gestureStartFromLauncher ? GestureScope.INSIDE_TO_OUTSIDE
: GestureScope.OUTSIDE_WITH_PILFER);
GestureScope.EXPECT_PILFER);
}
} else {
log("Hierarchy before clicking home:");
@@ -1082,15 +1051,12 @@ public final class LauncherInstrumentation {
if (getNavigationModel() == NavigationModel.ZERO_BUTTON
|| isThreeFingerTrackpadGesture) {
final Point displaySize = getRealDisplaySize();
final GestureScope gestureScope =
launcherVisible ? GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
: GestureScope.OUTSIDE_WITH_KEYCODE;
// TODO(b/225505986): change startY and endY back to displaySize.y / 2 once the
// issue is solved.
int startX = isThreeFingerTrackpadGesture ? displaySize.x / 4 : 0;
int endX = isThreeFingerTrackpadGesture ? displaySize.x * 3 / 4 : displaySize.x / 2;
linearGesture(startX, displaySize.y / 4, endX, displaySize.y / 4,
10, false, gestureScope);
10, false, GestureScope.DONT_EXPECT_PILFER);
} else {
waitForNavigationUiObject("back").click();
}
@@ -1500,15 +1466,17 @@ public final class LauncherInstrumentation {
* animations because in some scenarios there is a playing animations when the click is
* attempted.
*/
void clickObject(UiObject2 uiObject, GestureScope gestureScope) {
void clickObject(UiObject2 uiObject) {
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);
sendPointer(clickTime, clickTime, MotionEvent.ACTION_DOWN, center,
GestureScope.DONT_EXPECT_PILFER);
sendPointer(clickTime, clickTime, MotionEvent.ACTION_UP, center,
GestureScope.DONT_EXPECT_PILFER);
}
void clickLauncherObject(UiObject2 object) {
clickObject(object, GestureScope.INSIDE);
clickObject(object);
}
void scrollToLastVisibleRow(
@@ -1601,7 +1569,8 @@ public final class LauncherInstrumentation {
executeAndWaitForLauncherEvent(
() -> linearGesture(
startX, startY, endX, endY, steps, slowDown, GestureScope.INSIDE),
startX, startY, endX, endY, steps, slowDown,
GestureScope.DONT_EXPECT_PILFER),
event -> TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()),
() -> "Didn't receive a scroll end message: " + startX + ", " + startY
+ ", " + endX + ", " + endY,
@@ -1721,11 +1690,6 @@ public final class LauncherInstrumentation {
TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
boolean isTrackpadGestureEnabled() {
return getTestInfo(TestProtocol.REQUEST_IS_TRACKPAD_GESTURE_ENABLED).getBoolean(
TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
boolean isGridOnlyOverviewEnabled() {
return getTestInfo(TestProtocol.REQUEST_FLAG_ENABLE_GRID_ONLY_OVERVIEW).getBoolean(
TestProtocol.TEST_INFO_RESPONSE_FIELD);
@@ -1743,7 +1707,6 @@ public final class LauncherInstrumentation {
int pointerCount = mPointerCount;
boolean isTrackpadGesture = mTrackpadGestureType != TrackpadGestureType.NONE;
boolean isTwoFingerTrackpadGesture = mTrackpadGestureType == TrackpadGestureType.TWO_FINGER;
switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
if (isTrackpadGesture) {
@@ -1752,59 +1715,18 @@ public final class LauncherInstrumentation {
}
break;
case MotionEvent.ACTION_UP:
if (hasTIS
&& (gestureScope == GestureScope.OUTSIDE_WITH_PILFER
|| gestureScope == GestureScope.INSIDE_TO_OUTSIDE)) {
if (hasTIS && gestureScope == GestureScope.EXPECT_PILFER) {
expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS);
}
break;
case MotionEvent.ACTION_HOVER_ENTER:
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_HOVER_ENTER_TIS);
break;
case MotionEvent.ACTION_HOVER_EXIT:
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_HOVER_EXIT_TIS);
break;
case MotionEvent.ACTION_POINTER_DOWN:
mPointerCount++;
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
&& gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE
&& (!isTrackpadGesture || isTwoFingerTrackpadGesture)) {
expectEvent(TestProtocol.SEQUENCE_MAIN, getTouchEventPatternWithPointerCount(
"ACTION_POINTER_DOWN", mPointerCount));
}
if (hasTIS && (isTrackpadGestureEnabled()
|| getNavigationModel() != NavigationModel.THREE_BUTTON)) {
expectEvent(TestProtocol.SEQUENCE_TIS, getTouchEventPatternTIS(
"ACTION_POINTER_DOWN", mPointerCount));
}
pointerCount = mPointerCount;
break;
case MotionEvent.ACTION_POINTER_UP:
if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER
&& gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER
&& gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE
&& (!isTrackpadGesture || isTwoFingerTrackpadGesture)) {
expectEvent(TestProtocol.SEQUENCE_MAIN, getTouchEventPatternWithPointerCount(
"ACTION_POINTER_UP", mPointerCount));
}
// When the gesture is handled outside, it's cancelled within launcher.
if (hasTIS && (isTrackpadGestureEnabled()
|| getNavigationModel() != NavigationModel.THREE_BUTTON)) {
if (gestureScope != GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE
&& gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE) {
expectEvent(TestProtocol.SEQUENCE_TIS, getTouchEventPatternTIS(
"ACTION_POINTER_UP", mPointerCount));
}
}
mPointerCount--;
break;
case MotionEvent.ACTION_BUTTON_PRESS:
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_BUTTON_PRESS_TIS);
break;
case MotionEvent.ACTION_BUTTON_RELEASE:
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_BUTTON_RELEASE_TIS);
break;
}
final MotionEvent event = isTrackpadGesture
@@ -1883,11 +1805,12 @@ public final class LauncherInstrumentation {
@NonNull final UiObject2 target, @NonNull String resName, Pattern longClickEvent) {
final Point targetCenter = target.getVisibleCenter();
final long downTime = SystemClock.uptimeMillis();
sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, targetCenter, GestureScope.INSIDE);
sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, targetCenter,
GestureScope.DONT_EXPECT_PILFER);
expectEvent(TestProtocol.SEQUENCE_MAIN, longClickEvent);
final UiObject2 result = waitForLauncherObject(resName);
sendPointer(downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, targetCenter,
GestureScope.INSIDE);
GestureScope.DONT_EXPECT_PILFER);
return result;
}
@@ -2168,9 +2091,9 @@ public final class LauncherInstrumentation {
final long downTime = SystemClock.uptimeMillis();
final Point tapTarget = new Point(x, y);
sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, tapTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
sendPointer(downTime, downTime, MotionEvent.ACTION_UP, tapTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
}

View File

@@ -124,7 +124,7 @@ public final class OverviewTask {
final int centerY = taskBounds.centerY();
mLauncher.executeAndWaitForLauncherEvent(
() -> mLauncher.linearGesture(centerX, centerY, centerX, 0, 10, false,
LauncherInstrumentation.GestureScope.INSIDE),
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER),
event -> TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE.equals(event.getClassName()),
() -> "Didn't receive a dismiss animation ends message: " + centerX + ", "
+ centerY, "swiping to dismiss");

View File

@@ -76,13 +76,13 @@ public final class Taskbar {
mLauncher.getRealDisplaySize().x - 1, mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, stashTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
LauncherInstrumentation.log("hideTaskbar: sent down");
try (LauncherInstrumentation.Closable c2 = mLauncher.addContextLayer("pressed down")) {
mLauncher.waitUntilSystemLauncherObjectGone(TASKBAR_RES_ID);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, stashTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
} finally {
mLauncher.getTestInfo(REQUEST_DISABLE_MANUAL_TASKBAR_STASHING);
@@ -147,9 +147,9 @@ public final class Taskbar {
mLauncher.getRealDisplaySize().y - 1);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_DOWN, tapTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
mLauncher.sendPointer(downTime, downTime, MotionEvent.ACTION_UP, tapTarget,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
}
}
}

View File

@@ -104,7 +104,8 @@ public final class Workspace extends Home {
windowCornerRadius,
startY - swipeHeight - mLauncher.getTouchSlop(),
12,
ALL_APPS_STATE_ORDINAL, LauncherInstrumentation.GestureScope.INSIDE);
ALL_APPS_STATE_ORDINAL,
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
try (LauncherInstrumentation.Closable c1 = mLauncher.addContextLayer(
"swiped to all apps")) {
@@ -386,7 +387,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, LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER);
launcher.clickObject(ok);
assertTrue("Uninstall alert is not dismissed after clicking OK", device.wait(
Until.gone(installerAlert), LauncherInstrumentation.WAIT_TIME_MS));
@@ -453,7 +454,7 @@ public final class Workspace extends Home {
launcher.runToState(
() -> launcher.sendPointer(
downTime, SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, dest,
LauncherInstrumentation.GestureScope.INSIDE),
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER),
NORMAL_STATE_ORDINAL,
"sending UP event");
if (expectedEvents != null) {
@@ -542,7 +543,7 @@ public final class Workspace extends Home {
executeAndWaitForPageScroll(launcher,
() -> launcher.movePointer(finalDragStart, screenEdge, DEFAULT_DRAG_STEPS,
true, downTime, downTime, true,
LauncherInstrumentation.GestureScope.INSIDE));
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER));
targetDest.x += displayX * (targetDest.x > 0 ? -1 : 1);
dragStart = screenEdge;
}
@@ -551,7 +552,7 @@ public final class Workspace extends Home {
// we just have to put move the icon to the destination and drop it
launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, isDecelerating,
downTime, SystemClock.uptimeMillis(), false,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
dropDraggedIcon(launcher, targetDest, downTime, expectDropEvents);
}
}
@@ -584,7 +585,7 @@ public final class Workspace extends Home {
// we just have to put move the icon to the destination and drop it
launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, isDecelerating,
downTime, SystemClock.uptimeMillis(), false,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
dropDraggedIcon(launcher, targetDest, downTime, expectDropEvents);
}
}
@@ -621,7 +622,7 @@ public final class Workspace extends Home {
executeAndWaitForPageScroll(launcher,
() -> launcher.movePointer(finalDragStart, screenEdge, DEFAULT_DRAG_STEPS,
true, downTime, downTime, true,
LauncherInstrumentation.GestureScope.INSIDE));
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER));
currentPage = Workspace.geCurrentPage(launcher);
currentPosition = screenEdge;
}
@@ -650,7 +651,7 @@ public final class Workspace extends Home {
launcher.movePointer(dragStart, targetDest, DEFAULT_DRAG_STEPS, true,
downTime, SystemClock.uptimeMillis(), false,
LauncherInstrumentation.GestureScope.INSIDE);
LauncherInstrumentation.GestureScope.DONT_EXPECT_PILFER);
dropDraggedIcon(launcher, targetDest, downTime, expectDropEvents);
}