diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/InputMonitor.java | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowState.java | 22 |
2 files changed, 21 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 835b9b1885a3..f85fdb6c3882 100644 --- a/services/core/java/com/android/server/wm/InputMonitor.java +++ b/services/core/java/com/android/server/wm/InputMonitor.java @@ -251,7 +251,7 @@ final class InputMonitor { final boolean hasFocus, final boolean hasWallpaper) { // Add a window to our list of input windows. inputWindowHandle.name = child.toString(); - flags = child.getSurfaceTouchableRegion(inputWindowHandle.touchableRegion, flags); + flags = child.getSurfaceTouchableRegion(inputWindowHandle, flags); inputWindowHandle.layoutParamsFlags = flags; inputWindowHandle.layoutParamsType = type; inputWindowHandle.dispatchingTimeoutNanos = child.getInputDispatchingTimeoutNanos(); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 11288d27fce6..08ade37c995c 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -214,7 +214,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP static final String TAG = TAG_WITH_CLASS_NAME ? "WindowState" : TAG_WM; // The minimal size of a window within the usable area of the freeform stack. - // TODO(multi-window): fix the min sizes when we have mininum width/height support, + // TODO(multi-window): fix the min sizes when we have minimum width/height support, // use hard-coded min sizes for now. static final int MINIMUM_VISIBLE_WIDTH_IN_DP = 48; static final int MINIMUM_VISIBLE_HEIGHT_IN_DP = 32; @@ -2196,8 +2196,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } } - int getSurfaceTouchableRegion(Region region, int flags) { + int getSurfaceTouchableRegion(InputWindowHandle inputWindowHandle, int flags) { final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0; + final Region region = inputWindowHandle.touchableRegion; + setTouchableRegionCropIfNeeded(inputWindowHandle); + if (mAppToken != null && !mAppToken.getResolvedOverrideBounds().isEmpty()) { // There may have touchable letterboxes around the activity, so in order to let the // letterboxes are able to receive touch event and slip to activity, the activity with @@ -2265,6 +2268,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP region.set(-dw, -dh, dw + dw, dh + dh); // Subtract the area that cannot be touched. region.op(touchExcludeRegion, Region.Op.DIFFERENCE); + inputWindowHandle.setTouchableRegionCrop(null); } touchExcludeRegion.recycle(); } else { @@ -2939,6 +2943,20 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP subtractTouchExcludeRegionIfNeeded(outRegion); } + private void setTouchableRegionCropIfNeeded(InputWindowHandle handle) { + final Task task = getTask(); + if (task == null || !task.cropWindowsToStackBounds()) { + return; + } + + final TaskStack stack = task.mStack; + if (stack == null) { + return; + } + + handle.setTouchableRegionCrop(stack.getSurfaceControl()); + } + private void cropRegionToStackBoundsIfNeeded(Region region) { final Task task = getTask(); if (task == null || !task.cropWindowsToStackBounds()) { |