Fix issue in RTL where swipes on Launcher Smartspace are intercepted.
The `+ getScrollX()` translation is a duplicate, because
`mapCoordInSelfToDescendant` also does it internally. Same for the `+
getScrollY()`.
This wasn't an issue in LTR because the top left corner of the root view
is the same as the top left corner of the first page. `getScrollX()`
returns 0 in that case.
In RTL, the second page is to the left of the first page. If the touch
is on the first page, `+ getScrollX()` translates it outside of the
first page. This incorrectly sets mIsEventOverFirstPagePinnedItem to
false, leading to the swipe being intercepted.
Bug: 240380590
Fix: 240380590
Test: manual
Change-Id: I51f534695401ce527da8d2158130a4d54b086f3d
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 191d063..4f2f093 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -1074,13 +1074,14 @@
mXDown = ev.getX();
mYDown = ev.getY();
if (mFirstPagePinnedItem != null) {
- mTempFXY[0] = mXDown + getScrollX();
- mTempFXY[1] = mYDown + getScrollY();
- Utilities.mapCoordInSelfToDescendant(mFirstPagePinnedItem, this, mTempFXY);
- mIsEventOverFirstPagePinnedItem = mFirstPagePinnedItem.getLeft() <= mTempFXY[0]
- && mFirstPagePinnedItem.getRight() >= mTempFXY[0]
- && mFirstPagePinnedItem.getTop() <= mTempFXY[1]
- && mFirstPagePinnedItem.getBottom() >= mTempFXY[1];
+ final float[] tempFXY = new float[2];
+ tempFXY[0] = mXDown;
+ tempFXY[1] = mYDown;
+ Utilities.mapCoordInSelfToDescendant(mFirstPagePinnedItem, this, tempFXY);
+ mIsEventOverFirstPagePinnedItem = mFirstPagePinnedItem.getLeft() <= tempFXY[0]
+ && mFirstPagePinnedItem.getRight() >= tempFXY[0]
+ && mFirstPagePinnedItem.getTop() <= tempFXY[1]
+ && mFirstPagePinnedItem.getBottom() >= tempFXY[1];
} else {
mIsEventOverFirstPagePinnedItem = false;
}