Loading src/com/android/launcher3/testing/TestLogging.java +20 −8 Original line number Diff line number Diff line Loading @@ -27,26 +27,29 @@ import com.android.launcher3.testing.shared.TestProtocol; import java.util.function.BiConsumer; public final class TestLogging { private static final String TAPL_EVENTS_TAG = "TaplEvents"; private static final String LAUNCHER_EVENTS_TAG = "LauncherEvents"; private static BiConsumer<String, String> sEventConsumer; public static boolean sHadEventsNotFromTest; private static void recordEventSlow(String sequence, String event) { Log.d(TestProtocol.TAPL_EVENTS_TAG, sequence + " / " + event); private static void recordEventSlow(String sequence, String event, boolean reportToTapl) { Log.d(reportToTapl ? TAPL_EVENTS_TAG : LAUNCHER_EVENTS_TAG, sequence + " / " + event); final BiConsumer<String, String> eventConsumer = sEventConsumer; if (eventConsumer != null) { if (reportToTapl && eventConsumer != null) { eventConsumer.accept(sequence, event); } } public static void recordEvent(String sequence, String event) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, event); recordEventSlow(sequence, event, true); } } public static void recordEvent(String sequence, String message, Object parameter) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, message + ": " + parameter); recordEventSlow(sequence, message + ": " + parameter, true); } } Loading @@ -59,14 +62,23 @@ public final class TestLogging { public static void recordKeyEvent(String sequence, String message, KeyEvent event) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, message + ": " + event); recordEventSlow(sequence, message + ": " + event, true); registerEventNotFromTest(event); } } public static void recordMotionEvent(String sequence, String message, MotionEvent event) { if (Utilities.isRunningInTestHarness() && event.getAction() != MotionEvent.ACTION_MOVE) { recordEventSlow(sequence, message + ": " + 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. // 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); registerEventNotFromTest(event); } } Loading tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +0 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ public final class TestProtocol { public static final int HINT_STATE_TWO_BUTTON_ORDINAL = 8; public static final int OVERVIEW_SPLIT_SELECT_ORDINAL = 9; public static final int EDIT_MODE_STATE_ORDINAL = 10; public static final String TAPL_EVENTS_TAG = "TaplEvents"; public static final String SEQUENCE_MAIN = "Main"; public static final String SEQUENCE_TIS = "TIS"; public static final String SEQUENCE_PILFER = "Pilfer"; Loading tests/tapl/com/android/launcher3/tapl/Background.java +1 −33 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.launcher3.tapl; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; import static com.android.launcher3.tapl.LauncherInstrumentation.EVENT_TOUCH_DOWN_TIS; import static com.android.launcher3.tapl.LauncherInstrumentation.EVENT_TOUCH_UP_TIS; import static com.android.launcher3.tapl.OverviewTask.TASK_START_EVENT; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; Loading Loading @@ -133,16 +131,6 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine } } } else { if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.runToState( () -> mLauncher.waitForNavigationUiObject("recent_apps").click(), Loading Loading @@ -203,7 +191,7 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine final LauncherInstrumentation.GestureScope gestureScope = zeroButtonToOverviewGestureStartsInLauncher() ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER ? LauncherInstrumentation.GestureScope.INSIDE : LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER; mLauncher.sendPointer(downTime, SystemClock.uptimeMillis(), Loading Loading @@ -273,30 +261,10 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine } else { // Double press the recents button. UiObject2 recentsButton = mLauncher.waitForNavigationUiObject("recent_apps"); if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL, "clicking Recents button for the first time"); mLauncher.getOverview(); if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.executeAndWaitForEvent( () -> recentsButton.click(), Loading tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java +1 −1 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ public final class LaunchedAppState extends Background { SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, endPoint, LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER); LauncherInstrumentation.GestureScope.INSIDE); LauncherInstrumentation.log("SplitscreenDragSource.dragToSplitscreen: " + "after drop"); Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −63 Original line number Diff line number Diff line Loading @@ -99,17 +99,9 @@ public final class LauncherInstrumentation { private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 15; private static final int GESTURE_STEP_MS = 16; static final Pattern EVENT_TOUCH_DOWN = getTouchEventPatternWithPointerCount("ACTION_DOWN"); static final Pattern EVENT_TOUCH_UP = getTouchEventPatternWithPointerCount("ACTION_UP"); private static final Pattern EVENT_TOUCH_CANCEL = getTouchEventPatternWithPointerCount( "ACTION_CANCEL"); static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers"); static final Pattern EVENT_START = Pattern.compile("start:"); static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN"); static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP"); static final Pattern EVENT_TOUCH_CANCEL_TIS = getTouchEventPattern( "TouchInteractionService.onInputEvent", "ACTION_CANCEL"); 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"); Loading Loading @@ -139,7 +131,6 @@ public final class LauncherInstrumentation { // whether the gesture recognition triggers pilfer. public enum GestureScope { OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE, INSIDE_TO_OUTSIDE_WITHOUT_PILFER, INSIDE_TO_OUTSIDE_WITH_KEYCODE, // For gestures that will trigger a keycode from TIS. OUTSIDE_WITH_KEYCODE, } Loading Loading @@ -213,12 +204,6 @@ public final class LauncherInstrumentation { private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE; private int mPointerCount = 0; private static Pattern getTouchEventPattern(String prefix, String action) { return Pattern.compile( prefix + ": MotionEvent.*?action=" + action + ".*?id\\[0\\]=0" + ".*?toolType\\[0\\]=TOOL_TYPE_FINGER.*?buttonState=0.*?"); } private static Pattern getTouchEventPatternWithPointerCount(String prefix, String action, int pointerCount) { return Pattern.compile( Loading @@ -227,10 +212,6 @@ public final class LauncherInstrumentation { + pointerCount); } private static Pattern getTouchEventPatternWithPointerCount(String action) { return getTouchEventPatternWithPointerCount("Touch event", action, 1); } private static Pattern getTouchEventPatternWithPointerCount(String action, int pointerCount) { return getTouchEventPatternWithPointerCount("Touch event", action, pointerCount); } Loading Loading @@ -1072,14 +1053,6 @@ public final class LauncherInstrumentation { log("Hierarchy before clicking home:"); dumpViewHierarchy(); action = "clicking home button"; if (isTablet()) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP); } if (isTrackpadGestureEnabled()) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } runToState( waitForNavigationUiObject("home")::click, Loading Loading @@ -1120,14 +1093,6 @@ public final class LauncherInstrumentation { 10, false, gestureScope); } else { waitForNavigationUiObject("back").click(); if (isTablet()) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP); } if (isTrackpadGestureEnabled()) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } } if (launcherVisible) { if (getContext().getApplicationInfo().isOnBackInvokedCallbackEnabled()) { Loading Loading @@ -1781,44 +1746,17 @@ public final class LauncherInstrumentation { boolean isTwoFingerTrackpadGesture = mTrackpadGestureType == TrackpadGestureType.TWO_FINGER; switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE && (!isTrackpadGesture || isTwoFingerTrackpadGesture)) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); } if (hasTIS && (isTrackpadGestureEnabled() || getNavigationModel() != NavigationModel.THREE_BUTTON)) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); } if (isTrackpadGesture) { mPointerCount = 1; pointerCount = mPointerCount; } break; case MotionEvent.ACTION_UP: if (hasTIS && gestureScope != GestureScope.INSIDE && gestureScope != GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER if (hasTIS && (gestureScope == GestureScope.OUTSIDE_WITH_PILFER || gestureScope == GestureScope.INSIDE_TO_OUTSIDE)) { expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS); } if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE && (!isTrackpadGesture || isTwoFingerTrackpadGesture)) { expectEvent(TestProtocol.SEQUENCE_MAIN, gestureScope == GestureScope.INSIDE || gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); } if (hasTIS && (isTrackpadGestureEnabled() || getNavigationModel() != NavigationModel.THREE_BUTTON)) { expectEvent(TestProtocol.SEQUENCE_TIS, gestureScope == GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE || gestureScope == GestureScope.OUTSIDE_WITH_KEYCODE ? EVENT_TOUCH_CANCEL_TIS : EVENT_TOUCH_UP_TIS); } break; case MotionEvent.ACTION_HOVER_ENTER: expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_HOVER_ENTER_TIS); Loading Loading
src/com/android/launcher3/testing/TestLogging.java +20 −8 Original line number Diff line number Diff line Loading @@ -27,26 +27,29 @@ import com.android.launcher3.testing.shared.TestProtocol; import java.util.function.BiConsumer; public final class TestLogging { private static final String TAPL_EVENTS_TAG = "TaplEvents"; private static final String LAUNCHER_EVENTS_TAG = "LauncherEvents"; private static BiConsumer<String, String> sEventConsumer; public static boolean sHadEventsNotFromTest; private static void recordEventSlow(String sequence, String event) { Log.d(TestProtocol.TAPL_EVENTS_TAG, sequence + " / " + event); private static void recordEventSlow(String sequence, String event, boolean reportToTapl) { Log.d(reportToTapl ? TAPL_EVENTS_TAG : LAUNCHER_EVENTS_TAG, sequence + " / " + event); final BiConsumer<String, String> eventConsumer = sEventConsumer; if (eventConsumer != null) { if (reportToTapl && eventConsumer != null) { eventConsumer.accept(sequence, event); } } public static void recordEvent(String sequence, String event) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, event); recordEventSlow(sequence, event, true); } } public static void recordEvent(String sequence, String message, Object parameter) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, message + ": " + parameter); recordEventSlow(sequence, message + ": " + parameter, true); } } Loading @@ -59,14 +62,23 @@ public final class TestLogging { public static void recordKeyEvent(String sequence, String message, KeyEvent event) { if (Utilities.isRunningInTestHarness()) { recordEventSlow(sequence, message + ": " + event); recordEventSlow(sequence, message + ": " + event, true); registerEventNotFromTest(event); } } public static void recordMotionEvent(String sequence, String message, MotionEvent event) { if (Utilities.isRunningInTestHarness() && event.getAction() != MotionEvent.ACTION_MOVE) { recordEventSlow(sequence, message + ": " + 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. // 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); registerEventNotFromTest(event); } } Loading
tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +0 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,6 @@ public final class TestProtocol { public static final int HINT_STATE_TWO_BUTTON_ORDINAL = 8; public static final int OVERVIEW_SPLIT_SELECT_ORDINAL = 9; public static final int EDIT_MODE_STATE_ORDINAL = 10; public static final String TAPL_EVENTS_TAG = "TaplEvents"; public static final String SEQUENCE_MAIN = "Main"; public static final String SEQUENCE_TIS = "TIS"; public static final String SEQUENCE_PILFER = "Pilfer"; Loading
tests/tapl/com/android/launcher3/tapl/Background.java +1 −33 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ package com.android.launcher3.tapl; import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED; import static com.android.launcher3.tapl.LauncherInstrumentation.EVENT_TOUCH_DOWN_TIS; import static com.android.launcher3.tapl.LauncherInstrumentation.EVENT_TOUCH_UP_TIS; import static com.android.launcher3.tapl.OverviewTask.TASK_START_EVENT; import static com.android.launcher3.testing.shared.TestProtocol.OVERVIEW_STATE_ORDINAL; Loading Loading @@ -133,16 +131,6 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine } } } else { if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.runToState( () -> mLauncher.waitForNavigationUiObject("recent_apps").click(), Loading Loading @@ -203,7 +191,7 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine final LauncherInstrumentation.GestureScope gestureScope = zeroButtonToOverviewGestureStartsInLauncher() ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER ? LauncherInstrumentation.GestureScope.INSIDE : LauncherInstrumentation.GestureScope.OUTSIDE_WITHOUT_PILFER; mLauncher.sendPointer(downTime, SystemClock.uptimeMillis(), Loading Loading @@ -273,30 +261,10 @@ public abstract class Background extends LauncherInstrumentation.VisibleContaine } else { // Double press the recents button. UiObject2 recentsButton = mLauncher.waitForNavigationUiObject("recent_apps"); if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL, "clicking Recents button for the first time"); mLauncher.getOverview(); if (mLauncher.isTablet()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_DOWN); mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_TOUCH_UP); } if (mLauncher.isTrackpadGestureEnabled()) { mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); mLauncher.expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT); mLauncher.executeAndWaitForEvent( () -> recentsButton.click(), Loading
tests/tapl/com/android/launcher3/tapl/LaunchedAppState.java +1 −1 Original line number Diff line number Diff line Loading @@ -194,7 +194,7 @@ public final class LaunchedAppState extends Background { SystemClock.uptimeMillis(), MotionEvent.ACTION_UP, endPoint, LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER); LauncherInstrumentation.GestureScope.INSIDE); LauncherInstrumentation.log("SplitscreenDragSource.dragToSplitscreen: " + "after drop"); Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +1 −63 Original line number Diff line number Diff line Loading @@ -99,17 +99,9 @@ public final class LauncherInstrumentation { private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 15; private static final int GESTURE_STEP_MS = 16; static final Pattern EVENT_TOUCH_DOWN = getTouchEventPatternWithPointerCount("ACTION_DOWN"); static final Pattern EVENT_TOUCH_UP = getTouchEventPatternWithPointerCount("ACTION_UP"); private static final Pattern EVENT_TOUCH_CANCEL = getTouchEventPatternWithPointerCount( "ACTION_CANCEL"); static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers"); static final Pattern EVENT_START = Pattern.compile("start:"); static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN"); static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP"); static final Pattern EVENT_TOUCH_CANCEL_TIS = getTouchEventPattern( "TouchInteractionService.onInputEvent", "ACTION_CANCEL"); 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"); Loading Loading @@ -139,7 +131,6 @@ public final class LauncherInstrumentation { // whether the gesture recognition triggers pilfer. public enum GestureScope { OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE, INSIDE_TO_OUTSIDE_WITHOUT_PILFER, INSIDE_TO_OUTSIDE_WITH_KEYCODE, // For gestures that will trigger a keycode from TIS. OUTSIDE_WITH_KEYCODE, } Loading Loading @@ -213,12 +204,6 @@ public final class LauncherInstrumentation { private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE; private int mPointerCount = 0; private static Pattern getTouchEventPattern(String prefix, String action) { return Pattern.compile( prefix + ": MotionEvent.*?action=" + action + ".*?id\\[0\\]=0" + ".*?toolType\\[0\\]=TOOL_TYPE_FINGER.*?buttonState=0.*?"); } private static Pattern getTouchEventPatternWithPointerCount(String prefix, String action, int pointerCount) { return Pattern.compile( Loading @@ -227,10 +212,6 @@ public final class LauncherInstrumentation { + pointerCount); } private static Pattern getTouchEventPatternWithPointerCount(String action) { return getTouchEventPatternWithPointerCount("Touch event", action, 1); } private static Pattern getTouchEventPatternWithPointerCount(String action, int pointerCount) { return getTouchEventPatternWithPointerCount("Touch event", action, pointerCount); } Loading Loading @@ -1072,14 +1053,6 @@ public final class LauncherInstrumentation { log("Hierarchy before clicking home:"); dumpViewHierarchy(); action = "clicking home button"; if (isTablet()) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP); } if (isTrackpadGestureEnabled()) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } runToState( waitForNavigationUiObject("home")::click, Loading Loading @@ -1120,14 +1093,6 @@ public final class LauncherInstrumentation { 10, false, gestureScope); } else { waitForNavigationUiObject("back").click(); if (isTablet()) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_UP); } if (isTrackpadGestureEnabled()) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS); } } if (launcherVisible) { if (getContext().getApplicationInfo().isOnBackInvokedCallbackEnabled()) { Loading Loading @@ -1781,44 +1746,17 @@ public final class LauncherInstrumentation { boolean isTwoFingerTrackpadGesture = mTrackpadGestureType == TrackpadGestureType.TWO_FINGER; switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE && (!isTrackpadGesture || isTwoFingerTrackpadGesture)) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); } if (hasTIS && (isTrackpadGestureEnabled() || getNavigationModel() != NavigationModel.THREE_BUTTON)) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS); } if (isTrackpadGesture) { mPointerCount = 1; pointerCount = mPointerCount; } break; case MotionEvent.ACTION_UP: if (hasTIS && gestureScope != GestureScope.INSIDE && gestureScope != GestureScope.INSIDE_TO_OUTSIDE_WITHOUT_PILFER if (hasTIS && (gestureScope == GestureScope.OUTSIDE_WITH_PILFER || gestureScope == GestureScope.INSIDE_TO_OUTSIDE)) { expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS); } if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER && gestureScope != GestureScope.OUTSIDE_WITH_KEYCODE && (!isTrackpadGesture || isTwoFingerTrackpadGesture)) { expectEvent(TestProtocol.SEQUENCE_MAIN, gestureScope == GestureScope.INSIDE || gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); } if (hasTIS && (isTrackpadGestureEnabled() || getNavigationModel() != NavigationModel.THREE_BUTTON)) { expectEvent(TestProtocol.SEQUENCE_TIS, gestureScope == GestureScope.INSIDE_TO_OUTSIDE_WITH_KEYCODE || gestureScope == GestureScope.OUTSIDE_WITH_KEYCODE ? EVENT_TOUCH_CANCEL_TIS : EVENT_TOUCH_UP_TIS); } break; case MotionEvent.ACTION_HOVER_ENTER: expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_HOVER_ENTER_TIS); Loading