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

Commit 2fa27915 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Apply cropping to resizing surfaces."

parents 1aba5230 51a1b875
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        }

        WindowState appWin = this;
        while (appWin.mAttachedWindow != null) {
        while (appWin.isChildWindow()) {
            appWin = appWin.mAttachedWindow;
        }
        WindowToken appToken = appWin.mToken;
@@ -854,7 +854,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    @Override
    public int getBaseType() {
        WindowState win = this;
        while (win.mAttachedWindow != null) {
        while (win.isChildWindow()) {
            win = win.mAttachedWindow;
        }
        return win.mAttrs.type;
@@ -1235,7 +1235,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    void removeLocked() {
        disposeInputChannel();

        if (mAttachedWindow != null) {
        if (isChildWindow()) {
            if (DEBUG_ADD_REMOVE) Slog.v(TAG, "Removing " + this + " from " + mAttachedWindow);
            mAttachedWindow.mChildWindows.remove(this);
        }
@@ -1682,7 +1682,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            // first frame very fast. Saving surfaces are mostly a waste of memory.
            // Don't save if the window is not the topmost window.
            mSurfaceSaved = false;
        } else if (mAttachedWindow != null) {
        } else if (isChildWindow()) {
            mSurfaceSaved = false;
        } else {
            mSurfaceSaved = mAppToken.shouldSaveSurface();
@@ -1733,7 +1733,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
    boolean isHiddenFromUserLocked() {
        // Attached windows are evaluated based on the window that they are attached to.
        WindowState win = this;
        while (win.mAttachedWindow != null) {
        while (win.isChildWindow()) {
            win = win.mAttachedWindow;
        }
        if (win.mAttrs.type < WindowManager.LayoutParams.FIRST_SYSTEM_WINDOW
@@ -1997,7 +1997,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
            pw.print(prefix); pw.print("LastRequested w="); pw.print(mLastRequestedWidth);
                    pw.print(" h="); pw.println(mLastRequestedHeight);
        }
        if (mAttachedWindow != null || mLayoutAttached) {
        if (isChildWindow() || mLayoutAttached) {
            pw.print(prefix); pw.print("mAttachedWindow="); pw.print(mAttachedWindow);
                    pw.print(" mLayoutAttached="); pw.println(mLayoutAttached);
        }
@@ -2255,4 +2255,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        // Now make sure the window fits in the overall display frame.
        Gravity.applyDisplay(mAttrs.gravity, mDisplayFrame, mFrame);
    }

    boolean isChildWindow() {
        return mAttachedWindow != null;
    }
}
+12 −10
Original line number Diff line number Diff line
@@ -1135,17 +1135,19 @@ class WindowStateAnimator {
        final boolean isFreeformResizing =
                w.isDragResizing() && w.getResizeMode() == DRAG_RESIZE_MODE_FREEFORM;
        final Rect clipRect = mTmpClipRect;
        if (isFreeformResizing) {
            // When we're doing a drag-resizing, the surface is set up to cover full screen.
            // Set the clip rect to be the same size so that we don't get any scaling.
            clipRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
        } else {

        // We use the clip rect as provided by the tranformation for non-fullscreen windows to
        // avoid premature clipping with the system decor rect.
        clipRect.set((mHasClipRect && !fullscreen) ? mClipRect : mSystemDecorRect);
        if (DEBUG_WINDOW_CROP) Slog.d(TAG, "Initial clip rect: " + clipRect + ", mHasClipRect="
                + mHasClipRect + ", fullscreen=" + fullscreen);

        if (isFreeformResizing && !w.isChildWindow()) {
            // For freeform resizing non child windows, we are using the big surface positioned
            // at 0,0. Thus we must express the crop in that coordinate space.
            clipRect.offset(w.mShownPosition.x, w.mShownPosition.y);
        }

        // Expand the clip rect for surface insets.
        final WindowManager.LayoutParams attrs = w.mAttrs;
        clipRect.left -= attrs.surfaceInsets.left;