Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 883190cd authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Push drag-resize mode to the client" into tm-dev

parents d45ad7ba 3e194cc9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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.
+16 −20
Original line number Diff line number Diff line
@@ -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,10 +7979,8 @@ 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);
@@ -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);
            }
        }

+15 −3
Original line number Diff line number Diff line
@@ -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.
+2 −16
Original line number Diff line number Diff line
@@ -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
Loading