diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java index 457df4e47689a..a3504568fa06b 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -516,9 +516,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; @@ -596,6 +596,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 04d777299ecc1..aa8581690d0b5 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -125,6 +125,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; @@ -964,6 +965,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; }