Merge "Fix freeform window can't resize" into rvc-dev am: db2358512e
Change-Id: Iff9dcd228eb026ad842475d56ca26289075cbd6f
This commit is contained in:
@@ -27,7 +27,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
|
||||
|
||||
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_INPUT;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
|
||||
import android.graphics.Rect;
|
||||
@@ -38,7 +37,6 @@ import android.os.Process;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.InputApplicationHandle;
|
||||
import android.view.InputChannel;
|
||||
@@ -138,18 +136,6 @@ final class InputMonitor {
|
||||
|
||||
// If there's a drag in flight, provide a pseudo-window to catch drag input
|
||||
final boolean inDrag = mService.mDragDropController.dragDropActiveLocked();
|
||||
final boolean inPositioning =
|
||||
mService.mTaskPositioningController.isPositioningLocked();
|
||||
if (inPositioning) {
|
||||
if (DEBUG_TASK_POSITIONING) {
|
||||
Log.d(TAG_WM, "Inserting window handle for repositioning");
|
||||
}
|
||||
mService.mTaskPositioningController.showInputSurface(mInputTransaction,
|
||||
mDisplayId);
|
||||
} else {
|
||||
mService.mTaskPositioningController.hideInputSurface(mInputTransaction,
|
||||
mDisplayId);
|
||||
}
|
||||
|
||||
// Add all windows on the default display.
|
||||
mUpdateInputForAllWindowsConsumer.updateInputWindows(inDrag);
|
||||
|
||||
@@ -53,7 +53,6 @@ import android.view.InputDevice;
|
||||
import android.view.InputEvent;
|
||||
import android.view.InputWindowHandle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
@@ -268,9 +267,7 @@ class TaskPositioner implements IBinder.DeathRecipient {
|
||||
mDisplayContent.getDisplayRotation().pause();
|
||||
|
||||
// Notify InputMonitor to take mDragWindowHandle.
|
||||
final SurfaceControl.Transaction t = mService.mTransactionFactory.get();
|
||||
mDisplayContent.getInputMonitor().updateInputWindowsImmediately(t);
|
||||
t.syncInputWindows().apply();
|
||||
mService.mTaskPositioningController.showInputSurface(win.getDisplayId());
|
||||
|
||||
final DisplayMetrics displayMetrics = displayContent.getDisplayMetrics();
|
||||
mMinVisibleWidth = dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP, displayMetrics);
|
||||
@@ -301,6 +298,7 @@ class TaskPositioner implements IBinder.DeathRecipient {
|
||||
return;
|
||||
}
|
||||
|
||||
mService.mTaskPositioningController.hideInputSurface(mDisplayContent.getDisplayId());
|
||||
mService.mInputManager.unregisterInputChannel(mServerChannel);
|
||||
|
||||
mInputEventReceiver.dispose();
|
||||
|
||||
@@ -55,6 +55,8 @@ class TaskPositioningController {
|
||||
return mTaskPositioner != null;
|
||||
}
|
||||
|
||||
final SurfaceControl.Transaction mTransaction;
|
||||
|
||||
InputWindowHandle getDragWindowHandleLocked() {
|
||||
return mTaskPositioner != null ? mTaskPositioner.mDragWindowHandle : null;
|
||||
}
|
||||
@@ -65,16 +67,18 @@ class TaskPositioningController {
|
||||
mInputManager = inputManager;
|
||||
mActivityManager = activityManager;
|
||||
mHandler = new Handler(looper);
|
||||
mTransaction = service.mTransactionFactory.get();
|
||||
}
|
||||
|
||||
void hideInputSurface(SurfaceControl.Transaction t, int displayId) {
|
||||
void hideInputSurface(int displayId) {
|
||||
if (mPositioningDisplay != null && mPositioningDisplay.getDisplayId() == displayId
|
||||
&& mInputSurface != null) {
|
||||
t.hide(mInputSurface);
|
||||
mTransaction.hide(mInputSurface);
|
||||
mTransaction.syncInputWindows().apply();
|
||||
}
|
||||
}
|
||||
|
||||
void showInputSurface(SurfaceControl.Transaction t, int displayId) {
|
||||
void showInputSurface(int displayId) {
|
||||
if (mPositioningDisplay == null || mPositioningDisplay.getDisplayId() != displayId) {
|
||||
return;
|
||||
}
|
||||
@@ -92,16 +96,17 @@ class TaskPositioningController {
|
||||
return;
|
||||
}
|
||||
|
||||
t.show(mInputSurface);
|
||||
t.setInputWindowInfo(mInputSurface, h);
|
||||
t.setLayer(mInputSurface, Integer.MAX_VALUE);
|
||||
mTransaction.show(mInputSurface);
|
||||
mTransaction.setInputWindowInfo(mInputSurface, h);
|
||||
mTransaction.setLayer(mInputSurface, Integer.MAX_VALUE);
|
||||
|
||||
final Display display = dc.getDisplay();
|
||||
final Point p = new Point();
|
||||
display.getRealSize(p);
|
||||
|
||||
mTmpClipRect.set(0, 0, p.x, p.y);
|
||||
t.setWindowCrop(mInputSurface, mTmpClipRect);
|
||||
mTransaction.setWindowCrop(mInputSurface, mTmpClipRect);
|
||||
mTransaction.syncInputWindows().apply();
|
||||
}
|
||||
|
||||
boolean startMovingTask(IWindow window, float startX, float startY) {
|
||||
|
||||
@@ -2490,6 +2490,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Expands the given rectangle by the region of window resize handle for freeform window.
|
||||
* @param inOutRect The rectangle to update.
|
||||
*/
|
||||
private void adjustRegionInFreefromWindowMode(Rect inOutRect) {
|
||||
if (!inFreeformWindowingMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// For freeform windows, we need the touch region to include the whole
|
||||
// surface for the shadows.
|
||||
final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
|
||||
final int delta = WindowManagerService.dipToPixel(
|
||||
RESIZE_HANDLE_WIDTH_IN_DP, displayMetrics);
|
||||
inOutRect.inset(-delta, -delta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the region for a window in an Activity that was a touch modal. This will limit
|
||||
* the outer touch to the activity stack region.
|
||||
@@ -2513,14 +2530,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
getRootTask().getDimBounds(mTmpRect);
|
||||
}
|
||||
}
|
||||
if (inFreeformWindowingMode()) {
|
||||
// For freeform windows, we need the touch region to include the whole
|
||||
// surface for the shadows.
|
||||
final DisplayMetrics displayMetrics = getDisplayContent().getDisplayMetrics();
|
||||
final int delta = WindowManagerService.dipToPixel(
|
||||
RESIZE_HANDLE_WIDTH_IN_DP, displayMetrics);
|
||||
mTmpRect.inset(-delta, -delta);
|
||||
}
|
||||
adjustRegionInFreefromWindowMode(mTmpRect);
|
||||
outRegion.set(mTmpRect);
|
||||
cropRegionToStackBoundsIfNeeded(outRegion);
|
||||
}
|
||||
@@ -3335,7 +3345,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
final ActivityStack stack = task.getStack();
|
||||
if (stack == null) {
|
||||
if (stack == null || inFreeformWindowingMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3354,6 +3364,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
}
|
||||
|
||||
stack.getDimBounds(mTmpRect);
|
||||
adjustRegionInFreefromWindowMode(mTmpRect);
|
||||
region.op(mTmpRect, Region.Op.INTERSECT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user