summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java2
-rw-r--r--core/java/android/view/IWindow.aidl2
-rw-r--r--core/java/android/view/ViewRootImpl.java36
-rw-r--r--core/java/android/view/WindowCallbacks.java18
-rw-r--r--core/java/android/view/WindowManagerGlobal.java18
-rw-r--r--core/java/com/android/internal/view/BaseIWindow.java2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java2
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java35
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/TestIWindow.java2
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java2
11 files changed, 62 insertions, 59 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index ef792d4c5e64..317408387526 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -392,7 +392,7 @@ public abstract class WallpaperService extends Service {
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int syncSeqId) {
+ boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED,
reportDraw ? 1 : 0,
mergedConfiguration);
diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl
index 1f6cee6267b7..5dcf3931ecd6 100644
--- a/core/java/android/view/IWindow.aidl
+++ b/core/java/android/view/IWindow.aidl
@@ -56,7 +56,7 @@ oneway interface IWindow {
void resized(in ClientWindowFrames frames, boolean reportDraw,
in MergedConfiguration newMergedConfiguration,
boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId,
- int syncSeqId);
+ int syncSeqId, int resizeMode);
/**
* Called when the window insets configuration has changed.
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b90f54bf36a3..d15b2a457bfb 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -53,8 +53,8 @@ import static android.view.ViewRootImplProto.WIDTH;
import static android.view.ViewRootImplProto.WINDOW_ATTRIBUTES;
import static android.view.ViewRootImplProto.WIN_FRAME;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
-import static android.view.WindowCallbacks.RESIZE_MODE_DOCKED_DIVIDER;
import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;
+import static android.view.WindowCallbacks.RESIZE_MODE_INVALID;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
@@ -85,8 +85,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_ADDITIONAL
import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
-import static android.view.WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED;
-import static android.view.WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_FREEFORM;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER;
import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER;
@@ -503,9 +501,10 @@ public final class ViewRootImpl implements ViewParent,
public boolean mIsAnimating;
private boolean mUseMTRenderer;
+ private boolean mPendingDragResizing;
private boolean mDragResizing;
private boolean mInvalidateRootRequested;
- private int mResizeMode;
+ private int mResizeMode = RESIZE_MODE_INVALID;
private int mCanvasOffsetX;
private int mCanvasOffsetY;
private boolean mActivityRelaunched;
@@ -1711,17 +1710,22 @@ public final class ViewRootImpl implements ViewParent,
final MergedConfiguration mergedConfiguration = (MergedConfiguration) args.arg2;
final boolean forceNextWindowRelayout = args.argi1 != 0;
final int displayId = args.argi3;
+ final int resizeMode = args.argi5;
final Rect backdropFrame = frames.backdropFrame;
final boolean frameChanged = !mWinFrame.equals(frames.frame);
final boolean backdropFrameChanged = !mPendingBackDropFrame.equals(backdropFrame);
final boolean configChanged = !mLastReportedMergedConfiguration.equals(mergedConfiguration);
final boolean displayChanged = mDisplay.getDisplayId() != displayId;
+ final boolean resizeModeChanged = mResizeMode != resizeMode;
if (msg == MSG_RESIZED && !frameChanged && !backdropFrameChanged && !configChanged
- && !displayChanged && !forceNextWindowRelayout) {
+ && !displayChanged && !resizeModeChanged && !forceNextWindowRelayout) {
return;
}
+ mPendingDragResizing = resizeMode != RESIZE_MODE_INVALID;
+ mResizeMode = resizeMode;
+
if (configChanged) {
// If configuration changed - notify about that and, maybe, about move to display.
performConfigurationChange(mergedConfiguration, false /* force */,
@@ -2920,11 +2924,7 @@ public final class ViewRootImpl implements ViewParent,
mViewFrameInfo.flags |= FrameInfo.FLAG_WINDOW_VISIBILITY_CHANGED;
}
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);
- final boolean freeformResizing = (relayoutResult
- & RELAYOUT_RES_DRAG_RESIZING_FREEFORM) != 0;
- final boolean dockedResizing = (relayoutResult
- & RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
- final boolean dragResizing = freeformResizing || dockedResizing;
+ final boolean dragResizing = mPendingDragResizing;
if (mSyncSeqId > mLastSyncSeqId) {
mLastSyncSeqId = mSyncSeqId;
if (DEBUG_BLAST) {
@@ -3065,9 +3065,6 @@ public final class ViewRootImpl implements ViewParent,
if (mDragResizing != dragResizing) {
if (dragResizing) {
- mResizeMode = freeformResizing
- ? RESIZE_MODE_FREEFORM
- : RESIZE_MODE_DOCKED_DIVIDER;
final boolean backdropSizeMatchesFrame =
mWinFrame.width() == mPendingBackDropFrame.width()
&& mWinFrame.height() == mPendingBackDropFrame.height();
@@ -7982,11 +7979,9 @@ public final class ViewRootImpl implements ViewParent,
(mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
final WindowConfiguration winConfig = getConfiguration().windowConfiguration;
- final boolean dragResizing = (relayoutResult
- & (RELAYOUT_RES_DRAG_RESIZING_DOCKED | RELAYOUT_RES_DRAG_RESIZING_FREEFORM)) != 0;
WindowLayout.computeSurfaceSize(mWindowAttributes, winConfig.getMaxBounds(), requestedWidth,
- requestedHeight, mTmpFrames.frame, dragResizing, mSurfaceSize);
-
+ requestedHeight, mTmpFrames.frame, mPendingDragResizing, mSurfaceSize);
+
final boolean transformHintChanged = transformHint != mLastTransformHint;
final boolean sizeChanged = !mLastSurfaceSize.equals(mSurfaceSize);
final boolean surfaceControlChanged =
@@ -8476,7 +8471,7 @@ public final class ViewRootImpl implements ViewParent,
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private void dispatchResized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int seqId) {
+ boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
final Rect frame = frames.frame;
final Rect backDropFrame = frames.backdropFrame;
if (DEBUG_LAYOUT) Log.v(mTag, "Resizing " + this + ": frame=" + frame.toShortString()
@@ -8508,6 +8503,7 @@ public final class ViewRootImpl implements ViewParent,
args.argi2 = alwaysConsumeSystemBars ? 1 : 0;
args.argi3 = displayId;
args.argi4 = seqId;
+ args.argi5 = resizeMode;
msg.obj = args;
mHandler.sendMessage(msg);
}
@@ -9897,11 +9893,11 @@ public final class ViewRootImpl implements ViewParent,
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int seqId) {
+ boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
viewAncestor.dispatchResized(frames, reportDraw, mergedConfiguration, forceLayout,
- alwaysConsumeSystemBars, displayId, seqId);
+ alwaysConsumeSystemBars, displayId, seqId, resizeMode);
}
}
diff --git a/core/java/android/view/WindowCallbacks.java b/core/java/android/view/WindowCallbacks.java
index a99730205136..a7f0ef0a0324 100644
--- a/core/java/android/view/WindowCallbacks.java
+++ b/core/java/android/view/WindowCallbacks.java
@@ -28,9 +28,21 @@ import android.graphics.Rect;
*/
public interface WindowCallbacks {
- public static final int RESIZE_MODE_INVALID = -1;
- public static final int RESIZE_MODE_FREEFORM = 0;
- public static final int RESIZE_MODE_DOCKED_DIVIDER = 1;
+ int RESIZE_MODE_INVALID = -1;
+
+ /**
+ * The window is being resized by dragging one of the window corners,
+ * in this case the surface would be fullscreen-sized. The client should
+ * render to the actual frame location (instead of (0,curScrollY)).
+ */
+ int RESIZE_MODE_FREEFORM = 0;
+
+ /**
+ * The window is being resized by dragging on the docked divider. The client should render
+ * at (0, 0) and extend its background to the background frame passed into
+ * {@link IWindow#resized}.
+ */
+ int RESIZE_MODE_DOCKED_DIVIDER = 1;
/**
* Called by the system when the window got changed by the user, before the layouter got called.
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index 55c9f0f96151..29a9926aeb9f 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -71,30 +71,16 @@ public final class WindowManagerGlobal {
public static final int RELAYOUT_RES_SURFACE_CHANGED = 1 << 1;
/**
- * The window is being resized by dragging on the docked divider. The client should render
- * at (0, 0) and extend its background to the background frame passed into
- * {@link IWindow#resized}.
- */
- public static final int RELAYOUT_RES_DRAG_RESIZING_DOCKED = 1 << 2;
-
- /**
- * The window is being resized by dragging one of the window corners,
- * in this case the surface would be fullscreen-sized. The client should
- * render to the actual frame location (instead of (0,curScrollY)).
- */
- public static final int RELAYOUT_RES_DRAG_RESIZING_FREEFORM = 1 << 3;
-
- /**
* The window manager has changed the size of the surface from the last call.
*/
- public static final int RELAYOUT_RES_SURFACE_RESIZED = 1 << 4;
+ public static final int RELAYOUT_RES_SURFACE_RESIZED = 1 << 2;
/**
* In multi-window we force show the system bars. Because we don't want that the surface size
* changes in this mode, we instead have a flag whether the system bar sizes should always be
* consumed, so the app is treated like there is no virtual system bars at all.
*/
- public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 5;
+ public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 3;
/**
* Flag for relayout: the client will be later giving
diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java
index 842d72a226b2..52f0fb578e3d 100644
--- a/core/java/com/android/internal/view/BaseIWindow.java
+++ b/core/java/com/android/internal/view/BaseIWindow.java
@@ -51,7 +51,7 @@ public class BaseIWindow extends IWindow.Stub {
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int seqId) {
+ boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
if (reportDraw) {
try {
mSession.finishDrawing(this, null /* postDrawTransaction */, seqId);
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java
index 45833898e7c4..8d1afa4a1304 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java
@@ -344,7 +344,7 @@ public class SystemWindows {
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration newMergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int syncSeqId) {}
+ boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {}
@Override
public void insetsChanged(InsetsState insetsState, boolean willMove, boolean willResize) {}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
index 49f907b0a8ca..0d46199bde77 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java
@@ -535,7 +535,7 @@ public class TaskSnapshotWindow {
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
- boolean alwaysConsumeSystemBars, int displayId, int seqId) {
+ boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
if (mOuter != null) {
mOuter.mSplashScreenExecutor.execute(() -> {
if (mergedConfiguration != null
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 0ee8820be464..f8b9453c1d62 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -37,6 +37,9 @@ import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_FRAME;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION;
import static android.view.ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_VISIBLE;
+import static android.view.WindowCallbacks.RESIZE_MODE_DOCKED_DIVIDER;
+import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;
+import static android.view.WindowCallbacks.RESIZE_MODE_INVALID;
import static android.view.WindowInsets.Type.systemBars;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowLayout.UNSPECIFIED_LENGTH;
@@ -98,8 +101,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST;
import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType;
-import static android.view.WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED;
-import static android.view.WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_FREEFORM;
import static android.view.WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
import static android.view.WindowManagerPolicyConstants.TYPE_LAYER_MULTIPLIER;
import static android.view.WindowManagerPolicyConstants.TYPE_LAYER_OFFSET;
@@ -3943,17 +3944,34 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
true /* useLatestConfig */, false /* relayoutVisible */);
final boolean syncRedraw = shouldSendRedrawForSync();
final boolean reportDraw = syncRedraw || drawPending;
- final boolean forceRelayout = syncRedraw || reportOrientation || isDragResizeChanged();
+ final boolean isDragResizeChanged = isDragResizeChanged();
+ final boolean forceRelayout = syncRedraw || reportOrientation || isDragResizeChanged;
final DisplayContent displayContent = getDisplayContent();
final boolean alwaysConsumeSystemBars =
displayContent.getDisplayPolicy().areSystemBarsForcedShownLw();
final int displayId = displayContent.getDisplayId();
+ if (isDragResizeChanged) {
+ setDragResizing();
+ }
+ int resizeMode = RESIZE_MODE_INVALID;
+ if (isDragResizing()) {
+ switch (getResizeMode()) {
+ case DRAG_RESIZE_MODE_FREEFORM:
+ resizeMode = RESIZE_MODE_FREEFORM;
+ break;
+ case DRAG_RESIZE_MODE_DOCKED_DIVIDER:
+ resizeMode = RESIZE_MODE_DOCKED_DIVIDER;
+ break;
+ }
+ }
+
markRedrawForSyncReported();
try {
mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
- forceRelayout, alwaysConsumeSystemBars, displayId, Integer.MAX_VALUE);
+ forceRelayout, alwaysConsumeSystemBars, displayId, Integer.MAX_VALUE,
+ resizeMode);
if (drawPending && reportOrientation && mOrientationChanging) {
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
ProtoLog.v(WM_DEBUG_ORIENTATION,
@@ -5217,15 +5235,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
}
- if (isDragResizeChanged()) {
- setDragResizing();
- }
- final boolean freeformResizing = isDragResizing()
- && getResizeMode() == DRAG_RESIZE_MODE_FREEFORM;
- final boolean dockedResizing = isDragResizing()
- && getResizeMode() == DRAG_RESIZE_MODE_DOCKED_DIVIDER;
- result |= freeformResizing ? RELAYOUT_RES_DRAG_RESIZING_FREEFORM : 0;
- result |= dockedResizing ? RELAYOUT_RES_DRAG_RESIZING_DOCKED : 0;
return result;
}
diff --git a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java
index 4f35d55bc2d0..7cf4b2ebe924 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java
@@ -44,7 +44,7 @@ public class TestIWindow extends IWindow.Stub {
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfig, boolean forceLayout, boolean alwaysConsumeSystemBars,
- int displayId, int seqId) throws RemoteException {
+ int displayId, int seqId, int resizeMode) throws RemoteException {
}
@Override
diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
index 6a3aa78fc632..91bde7b31a48 100644
--- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java
@@ -693,7 +693,7 @@ public class WindowStateTests extends WindowTestsBase {
doThrow(new RemoteException("test")).when(win.mClient).resized(any() /* frames */,
anyBoolean() /* reportDraw */, any() /* mergedConfig */,
anyBoolean() /* forceLayout */, anyBoolean() /* alwaysConsumeSystemBars */,
- anyInt() /* displayId */, anyInt() /* seqId */);
+ anyInt() /* displayId */, anyInt() /* seqId */, anyInt() /* resizeMode */);
} catch (RemoteException ignored) {
}
win.reportResized();