From 6d66ad20cffe782b98a7a5f2ed454a40a450581c Mon Sep 17 00:00:00 2001 From: Xiaowen Lei Date: Wed, 16 Nov 2022 19:36:05 +0000 Subject: [PATCH] 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 --- src/com/android/launcher3/Workspace.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 191d063f34..4f2f093bbd 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -1074,13 +1074,14 @@ public class Workspace extends PagedView 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; }