From 00ad8ee720e6abb21eaee45294f8c0e2b4db6712 Mon Sep 17 00:00:00 2001 From: vadimt Date: Fri, 17 Jul 2020 18:23:59 -0700 Subject: [PATCH] Introducing a new gesture scope Gesture may occur outside of Launcher and not trigger system gesture recognition by TIS. Change-Id: Ibbb0180d6ef3856ab652164e6f3c1c86488a4caa (cherry picked from commit a37ecee10454b3c74c87394bf58342bda541009d) --- .../android/launcher3/tapl/Background.java | 6 ++--- .../tapl/LauncherInstrumentation.java | 23 ++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java index ce94a3e723..0c4e5a9461 100644 --- a/tests/tapl/com/android/launcher3/tapl/Background.java +++ b/tests/tapl/com/android/launcher3/tapl/Background.java @@ -85,7 +85,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { final LauncherInstrumentation.GestureScope gestureScope = zeroButtonToOverviewGestureStartsInLauncher() ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE - : LauncherInstrumentation.GestureScope.OUTSIDE; + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER; // b/156044202 mLauncher.log("Hierarchy before swiping up to overview:"); @@ -130,7 +130,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { } mLauncher.swipeToState(startX, startY, endX, endY, 10, OVERVIEW_STATE_ORDINAL, - LauncherInstrumentation.GestureScope.OUTSIDE); + LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); break; } @@ -194,7 +194,7 @@ public class Background extends LauncherInstrumentation.VisibleContainer { mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState, launcherWasVisible && isZeroButton ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE - : LauncherInstrumentation.GestureScope.OUTSIDE); + : LauncherInstrumentation.GestureScope.OUTSIDE_WITH_PILFER); break; } diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 5cf5d0fa88..94c75b0bea 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -112,9 +112,10 @@ public final class LauncherInstrumentation { public enum NavigationModel {ZERO_BUTTON, TWO_BUTTON, THREE_BUTTON} - // Where the gesture happens: outside of Launcher, inside or from inside to outside. + // Where the gesture happens: outside of Launcher, inside or from inside to outside and + // whether the gesture recognition triggers pilfer. public enum GestureScope { - OUTSIDE, INSIDE, INSIDE_TO_OUTSIDE + OUTSIDE_WITHOUT_PILFER, OUTSIDE_WITH_PILFER, INSIDE, INSIDE_TO_OUTSIDE } ; @@ -693,7 +694,7 @@ public final class LauncherInstrumentation { ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, NORMAL_STATE_ORDINAL, launcherWasVisible ? GestureScope.INSIDE_TO_OUTSIDE - : GestureScope.OUTSIDE); + : GestureScope.OUTSIDE_WITH_PILFER); } } } else { @@ -1159,7 +1160,8 @@ public final class LauncherInstrumentation { final boolean notLauncher3 = !isLauncher3(); switch (action) { case MotionEvent.ACTION_DOWN: - if (gestureScope != GestureScope.OUTSIDE) { + if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER + && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) { expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_TOUCH_DOWN); } if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) { @@ -1167,12 +1169,17 @@ public final class LauncherInstrumentation { } break; case MotionEvent.ACTION_UP: - if (notLauncher3 && gestureScope != GestureScope.INSIDE) { + if (notLauncher3 && gestureScope != GestureScope.INSIDE + && (gestureScope == GestureScope.OUTSIDE_WITH_PILFER + || gestureScope == GestureScope.INSIDE_TO_OUTSIDE)) { expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS); } - if (gestureScope != GestureScope.OUTSIDE) { - expectEvent(TestProtocol.SEQUENCE_MAIN, gestureScope == GestureScope.INSIDE - ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); + if (gestureScope != GestureScope.OUTSIDE_WITH_PILFER + && gestureScope != GestureScope.OUTSIDE_WITHOUT_PILFER) { + expectEvent(TestProtocol.SEQUENCE_MAIN, + gestureScope == GestureScope.INSIDE + || gestureScope == GestureScope.OUTSIDE_WITHOUT_PILFER + ? EVENT_TOUCH_UP : EVENT_TOUCH_CANCEL); } if (notLauncher3 && getNavigationModel() != NavigationModel.THREE_BUTTON) { expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);