From 306c6f3d05b3fb3b7ef123599707762346da47cc Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Fri, 16 Jun 2023 23:07:20 +0000 Subject: [PATCH] Fix regression in recents animation consumer touchable region - This reverts ag/17071846. In legacy recents animation, the input consumer is placed above the top most app being controlled by recents and the touchable region is set to the bounds of the target home or recents activity to ensure it captures all touches in that area. The above CL incorrectly changes this behavior to use the bounds of the top app being controlled by the recents transition as the touchable region of the input consumer, and as a result, as launcher transforms the surface, the touchable region of the consumer is updated as well preventing touches in the non-occluded area of launcher from being handled correctly. Fixes: 287507148 Test: Ensure that the recents input consumer touchable region is not updated with the transform of the app surface during the swipe up gesture Change-Id: I1a1b9cc29f04c5149efa4f670834cb470ee77a70 --- .../core/java/com/android/server/wm/InputMonitor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index cea886ff6e873..825d38b3eed74 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -49,6 +49,7 @@ import static com.android.server.wm.WindowManagerService.LOGTAG_INPUT_FOCUS; import static java.lang.Integer.MAX_VALUE; import android.annotation.Nullable; +import android.graphics.Rect; import android.graphics.Region; import android.os.Handler; import android.os.IBinder; @@ -558,7 +559,8 @@ final class InputMonitor { private boolean mAddWallpaperInputConsumerHandle; private boolean mAddRecentsAnimationInputConsumerHandle; - boolean mInDrag; + private boolean mInDrag; + private final Rect mTmpRect = new Rect(); private void updateInputWindows(boolean inDrag) { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "updateInputWindows"); @@ -582,8 +584,11 @@ final class InputMonitor { layer = layer != null ? layer : activeRecents; // Handle edge-case for SUW where windows don't exist yet if (layer.getSurfaceControl() != null) { - mRecentsAnimationInputConsumer.mWindowHandle - .replaceTouchableRegionWithCrop(layer.getSurfaceControl()); + final WindowState targetAppMainWindow = activeRecents.findMainWindow(); + if (targetAppMainWindow != null) { + targetAppMainWindow.getBounds(mTmpRect); + mRecentsAnimationInputConsumer.mWindowHandle.touchableRegion.set(mTmpRect); + } mRecentsAnimationInputConsumer.show(mInputTransaction, layer); mAddRecentsAnimationInputConsumerHandle = false; }