diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index efd9e2a9ddd2c..b49d83d93d544 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -523,9 +523,9 @@ final class InputMonitor { if (w.mInputChannelToken == null || w.mRemoved || (!w.canReceiveTouchInput() && !shouldApplyRecentsInputConsumer)) { if (w.mWinAnimator.hasSurface()) { - // Assign an InputInfo with type to the overlay window which can't receive input - // event. This is used to omit Surfaces from occlusion detection. - populateOverlayInputInfo(inputWindowHandle, w.isVisible()); + // Make sure the input info can't receive input event. It may be omitted from + // occlusion detection depending on the type or if it's a trusted overlay. + populateOverlayInputInfo(inputWindowHandle, w); setInputWindowInfoIfNeeded(mInputTransaction, w.mWinAnimator.mSurfaceController.mSurfaceControl, inputWindowHandle); return; @@ -603,6 +603,12 @@ final class InputMonitor { } } + static void populateOverlayInputInfo(InputWindowHandleWrapper inputWindowHandle, + WindowState w) { + populateOverlayInputInfo(inputWindowHandle, w.isVisible()); + inputWindowHandle.setTouchOcclusionMode(w.getTouchOcclusionMode()); + } + // This would reset InputWindowHandle fields to prevent it could be found by input event. // We need to check if any new field of InputWindowHandle could impact the result. @VisibleForTesting diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 0a8ff4dc71f5d..e99c7f92a8905 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -127,6 +127,7 @@ import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.MoveAnimationSpecProto.DURATION_MS; import static com.android.server.wm.MoveAnimationSpecProto.FROM; import static com.android.server.wm.MoveAnimationSpecProto.TO; +import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION; @@ -972,6 +973,9 @@ class WindowState extends WindowContainer implements WindowManagerP if (WindowManager.LayoutParams.isSystemAlertWindowType(mAttrs.type)) { return TouchOcclusionMode.USE_OPACITY; } + if (isAnimating(PARENTS | TRANSITION, ANIMATION_TYPE_ALL)) { + return TouchOcclusionMode.USE_OPACITY; + } return TouchOcclusionMode.BLOCK_UNTRUSTED; }