Loading quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java +14 −6 Original line number Diff line number Diff line Loading @@ -247,10 +247,7 @@ public class OrientationTouchTransformerTest { } @Test @Ignore("There's too much that goes into needing to mock a real motion event so the " + "transforms in native code get applied correctly. Once that happens then maybe we can" + " write slightly more complex unit tests") public void applyTransform_taskNotFrozen_90Rotate_inTwoRegions() { public void applyTransform_taskNotFrozen_90Rotate_withTwoRegions() { mTouchTransformer.createOrAddTouchRegion(mInfo); mTouchTransformer.enableMultipleRegions(true, mInfo); mTouchTransformer Loading @@ -262,6 +259,7 @@ public class OrientationTouchTransformerTest { // Portrait point in landscape orientation axis MotionEvent inRegion2 = generateMotionEvent(MotionEvent.ACTION_DOWN, 10, 10); mTouchTransformer.transform(inRegion1_down); // no-op mTouchTransformer.transform(inRegion2); assertTrue(mTouchTransformer.touchInValidSwipeRegions( inRegion1_down.getX(), inRegion1_down.getY())); Loading @@ -269,9 +267,19 @@ public class OrientationTouchTransformerTest { assertFalse(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY())); mTouchTransformer.transform(inRegion1_up); } // Set the new region with this MotionEvent.ACTION_DOWN inRegion2 = generateAndTransformMotionEvent(MotionEvent.ACTION_DOWN, 10, 370); @Test public void applyTransform_90Rotate_inRotatedRegion() { // Create regions for both 0 Rotation and 90 Rotation mTouchTransformer.createOrAddTouchRegion(mInfo); mTouchTransformer.enableMultipleRegions(true, mInfo); mTouchTransformer .createOrAddTouchRegion(createDisplayInfo(NORMAL_SCREEN_SIZE, Surface.ROTATION_90)); // Portrait point in landscape orientation axis float x1 = generateTouchRegionHeight(NORMAL_SCREEN_SIZE, Surface.ROTATION_0); // bottom of screen, from landscape perspective right side of screen MotionEvent inRegion2 = generateAndTransformMotionEvent(MotionEvent.ACTION_DOWN, x1, 370); assertTrue(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY())); } Loading quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +11 −8 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ import java.util.Objects; */ class OrientationTouchTransformer { class CurrentDisplay { private static class CurrentDisplay { public Point size; public int rotation; Loading @@ -67,6 +67,13 @@ class OrientationTouchTransformer { this.rotation = rotation; } @Override public String toString() { return "CurrentDisplay:" + " rotation: " + rotation + " size: " + size; } @Override public boolean equals(Object o) { if (this == o) return true; Loading @@ -86,21 +93,20 @@ class OrientationTouchTransformer { private static final String TAG = "OrientationTouchTransformer"; private static final boolean DEBUG = false; private static final int MAX_ORIENTATIONS = 4; private static final int QUICKSTEP_ROTATION_UNINITIALIZED = -1; private final Matrix mTmpMatrix = new Matrix(); private final float[] mTmpPoint = new float[2]; private Map<CurrentDisplay, OrientationRectF> mSwipeTouchRegions = private final Map<CurrentDisplay, OrientationRectF> mSwipeTouchRegions = new HashMap<CurrentDisplay, OrientationRectF>(); private final RectF mAssistantLeftRegion = new RectF(); private final RectF mAssistantRightRegion = new RectF(); private final RectF mOneHandedModeRegion = new RectF(); private CurrentDisplay mCurrentDisplay = new CurrentDisplay(); private int mNavBarGesturalHeight; private int mNavBarLargerGesturalHeight; private final int mNavBarLargerGesturalHeight; private boolean mEnableMultipleRegions; private Resources mResources; private OrientationRectF mLastRectTouched; Loading Loading @@ -374,10 +380,7 @@ class OrientationTouchTransformer { return; } for (int i = 0; i < MAX_ORIENTATIONS; i++) { CurrentDisplay display = new CurrentDisplay(mCurrentDisplay.size, i); OrientationRectF rect = mSwipeTouchRegions.get(display); for (OrientationRectF rect : mSwipeTouchRegions.values()) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.NO_SWIPE_TO_HOME, "transform:DOWN, rect=" + rect); } Loading Loading
quickstep/robolectric_tests/src/com/android/quickstep/OrientationTouchTransformerTest.java +14 −6 Original line number Diff line number Diff line Loading @@ -247,10 +247,7 @@ public class OrientationTouchTransformerTest { } @Test @Ignore("There's too much that goes into needing to mock a real motion event so the " + "transforms in native code get applied correctly. Once that happens then maybe we can" + " write slightly more complex unit tests") public void applyTransform_taskNotFrozen_90Rotate_inTwoRegions() { public void applyTransform_taskNotFrozen_90Rotate_withTwoRegions() { mTouchTransformer.createOrAddTouchRegion(mInfo); mTouchTransformer.enableMultipleRegions(true, mInfo); mTouchTransformer Loading @@ -262,6 +259,7 @@ public class OrientationTouchTransformerTest { // Portrait point in landscape orientation axis MotionEvent inRegion2 = generateMotionEvent(MotionEvent.ACTION_DOWN, 10, 10); mTouchTransformer.transform(inRegion1_down); // no-op mTouchTransformer.transform(inRegion2); assertTrue(mTouchTransformer.touchInValidSwipeRegions( inRegion1_down.getX(), inRegion1_down.getY())); Loading @@ -269,9 +267,19 @@ public class OrientationTouchTransformerTest { assertFalse(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY())); mTouchTransformer.transform(inRegion1_up); } // Set the new region with this MotionEvent.ACTION_DOWN inRegion2 = generateAndTransformMotionEvent(MotionEvent.ACTION_DOWN, 10, 370); @Test public void applyTransform_90Rotate_inRotatedRegion() { // Create regions for both 0 Rotation and 90 Rotation mTouchTransformer.createOrAddTouchRegion(mInfo); mTouchTransformer.enableMultipleRegions(true, mInfo); mTouchTransformer .createOrAddTouchRegion(createDisplayInfo(NORMAL_SCREEN_SIZE, Surface.ROTATION_90)); // Portrait point in landscape orientation axis float x1 = generateTouchRegionHeight(NORMAL_SCREEN_SIZE, Surface.ROTATION_0); // bottom of screen, from landscape perspective right side of screen MotionEvent inRegion2 = generateAndTransformMotionEvent(MotionEvent.ACTION_DOWN, x1, 370); assertTrue(mTouchTransformer.touchInValidSwipeRegions(inRegion2.getX(), inRegion2.getY())); } Loading
quickstep/src/com/android/quickstep/OrientationTouchTransformer.java +11 −8 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ import java.util.Objects; */ class OrientationTouchTransformer { class CurrentDisplay { private static class CurrentDisplay { public Point size; public int rotation; Loading @@ -67,6 +67,13 @@ class OrientationTouchTransformer { this.rotation = rotation; } @Override public String toString() { return "CurrentDisplay:" + " rotation: " + rotation + " size: " + size; } @Override public boolean equals(Object o) { if (this == o) return true; Loading @@ -86,21 +93,20 @@ class OrientationTouchTransformer { private static final String TAG = "OrientationTouchTransformer"; private static final boolean DEBUG = false; private static final int MAX_ORIENTATIONS = 4; private static final int QUICKSTEP_ROTATION_UNINITIALIZED = -1; private final Matrix mTmpMatrix = new Matrix(); private final float[] mTmpPoint = new float[2]; private Map<CurrentDisplay, OrientationRectF> mSwipeTouchRegions = private final Map<CurrentDisplay, OrientationRectF> mSwipeTouchRegions = new HashMap<CurrentDisplay, OrientationRectF>(); private final RectF mAssistantLeftRegion = new RectF(); private final RectF mAssistantRightRegion = new RectF(); private final RectF mOneHandedModeRegion = new RectF(); private CurrentDisplay mCurrentDisplay = new CurrentDisplay(); private int mNavBarGesturalHeight; private int mNavBarLargerGesturalHeight; private final int mNavBarLargerGesturalHeight; private boolean mEnableMultipleRegions; private Resources mResources; private OrientationRectF mLastRectTouched; Loading Loading @@ -374,10 +380,7 @@ class OrientationTouchTransformer { return; } for (int i = 0; i < MAX_ORIENTATIONS; i++) { CurrentDisplay display = new CurrentDisplay(mCurrentDisplay.size, i); OrientationRectF rect = mSwipeTouchRegions.get(display); for (OrientationRectF rect : mSwipeTouchRegions.values()) { if (TestProtocol.sDebugTracing) { Log.d(TestProtocol.NO_SWIPE_TO_HOME, "transform:DOWN, rect=" + rect); } Loading