Fix bug preventing resizing of freeform apps.
Also move the calculation of the touchable region to WindowState, since it calls many methods from there. Change-Id: I7f799277f4ed8a62b1ac8240f2b21d31a095a693
This commit is contained in:
@@ -19,7 +19,7 @@ package com.android.server.wm;
|
||||
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 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
||||
private final Object mInputDevicesReadyMonitor = new Object();
|
||||
private boolean mInputDevicesReady;
|
||||
|
||||
Rect mTmpRect = new Rect();
|
||||
|
||||
public InputMonitor(WindowManagerService service) {
|
||||
mService = service;
|
||||
}
|
||||
@@ -176,27 +174,7 @@ final class InputMonitor implements InputManagerService.WindowManagerCallbacks {
|
||||
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();
|
||||
|
||||
@@ -1336,6 +1336,37 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user