Merge "Fix bug preventing resizing of freeform apps."
diff --git a/services/core/java/com/android/server/wm/InputMonitor.java b/services/core/java/com/android/server/wm/InputMonitor.java
index 5f911c3..f999402 100644
--- a/services/core/java/com/android/server/wm/InputMonitor.java
+++ b/services/core/java/com/android/server/wm/InputMonitor.java
@@ -19,7 +19,7 @@
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static com.android.server.wm.WindowManagerService.DEBUG_FOCUS_LIGHT;
import static com.android.server.wm.WindowManagerService.DEBUG_INPUT;
-import static com.android.server.wm.WindowState.BOUNDS_FOR_TOUCH;
+
import android.app.ActivityManagerNative;
import android.graphics.Rect;
import android.os.RemoteException;
@@ -62,8 +62,6 @@
private final Object mInputDevicesReadyMonitor = new Object();
private boolean mInputDevicesReady;
- Rect mTmpRect = new Rect();
-
public InputMonitor(WindowManagerService service) {
mService = service;
}
@@ -176,27 +174,7 @@
final boolean hasFocus, final boolean hasWallpaper, DisplayContent displayContent) {
// Add a window to our list of input windows.
inputWindowHandle.name = child.toString();
- final boolean modal = (flags & (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
- | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)) == 0;
- if (modal && child.mAppToken != null) {
- // Limit the outer touch to the activity stack region.
- flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
- // If this is a modal window we need to dismiss it if it's not full screen and the touch
- // happens outside of the frame that displays the content. This means we need to
- // intercept touches outside of that window. The dim layer user associated with the
- // window (task or stack) will give us the good bounds, as they would be used to display
- // the dim layer.
- final DimLayer.DimLayerUser dimLayerUser = child.getDimLayerUser();
- if (dimLayerUser != null) {
- dimLayerUser.getBounds(mTmpRect);
- } else {
- child.getVisibleBounds(mTmpRect, BOUNDS_FOR_TOUCH);
- }
- inputWindowHandle.touchableRegion.set(mTmpRect);
- } else {
- // Not modal or full screen modal
- child.getTouchableRegion(inputWindowHandle.touchableRegion);
- }
+ flags = child.getTouchableRegion(inputWindowHandle.touchableRegion, flags, this);
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 1d2cb75..5bc329e 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1336,6 +1336,37 @@
return mAppToken != null && mAppToken.mTask != null && mAppToken.mTask.inDockedWorkspace();
}
+ int getTouchableRegion(Region region, int flags, InputMonitor inputMonitor) {
+ final boolean modal = (flags & (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
+ | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE)) == 0;
+ if (modal && mAppToken != null) {
+ // Limit the outer touch to the activity stack region.
+ flags |= WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
+ if (!inFreeformWorkspace()) {
+ // If this is a modal window we need to dismiss it if it's not full screen and the
+ // touch happens outside of the frame that displays the content. This means we
+ // need to intercept touches outside of that window. The dim layer user
+ // associated with the window (task or stack) will give us the good bounds, as
+ // they would be used to display the dim layer.
+ final DimLayer.DimLayerUser dimLayerUser = getDimLayerUser();
+ if (dimLayerUser != null) {
+ dimLayerUser.getBounds(mTmpRect);
+ } else {
+ getVisibleBounds(mTmpRect, BOUNDS_FOR_TOUCH);
+ }
+ } else {
+ // For freeform windows we the touch region to include the whole surface for the
+ // shadows.
+ getVisibleBounds(mTmpRect, BOUNDS_FOR_TOUCH);
+ }
+ region.set(mTmpRect);
+ } else {
+ // Not modal or full screen modal
+ getTouchableRegion(region);
+ }
+ return flags;
+ }
+
private class DeathRecipient implements IBinder.DeathRecipient {
@Override
public void binderDied() {