Merge "Push drag-resize mode to the client" into tm-dev
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -70,31 +70,17 @@ 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user