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

Commit ce1d578a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "WM: Adjust TaskSnapshot for cutout layout"

parents 358b028f 98a146d3
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -236,7 +236,7 @@ class TaskSnapshotController {
            return null;
        }
        return new TaskSnapshot(buffer, top.getConfiguration().orientation,
                minRect(mainWindow.mContentInsets, mainWindow.mStableInsets),
                getInsetsFromTaskBounds(mainWindow, task),
                isLowRamDevice /* reduced */, scaleFraction /* scale */);
    }

@@ -244,11 +244,18 @@ class TaskSnapshotController {
        return mIsRunningOnWear || mIsRunningOnTv || mIsRunningOnIoT;
    }

    private Rect minRect(Rect rect1, Rect rect2) {
        return new Rect(Math.min(rect1.left, rect2.left),
                Math.min(rect1.top, rect2.top),
                Math.min(rect1.right, rect2.right),
                Math.min(rect1.bottom, rect2.bottom));
    private Rect getInsetsFromTaskBounds(WindowState state, Task task) {
        final Rect r = new Rect();
        r.set(state.getContentFrameLw());
        r.intersectUnchecked(state.getStableFrameLw());

        final Rect taskBounds = task.getBounds();

        r.set(Math.max(0, r.left - taskBounds.left),
                Math.max(0, r.top - taskBounds.top),
                Math.max(0, taskBounds.right - r.right),
                Math.max(0, taskBounds.bottom - r.bottom));
        return r;
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -349,8 +349,9 @@ class TaskSnapshotSurface implements StartingSurface {

        // Let's remove all system decorations except the status bar, but only if the task is at the
        // very top of the screen.
        final boolean isTop = mTaskBounds.top == 0 && mFrame.top == 0;
        rect.inset((int) (insets.left * mSnapshot.getScale()),
                mTaskBounds.top != 0 ? (int) (insets.top * mSnapshot.getScale()) : 0,
                isTop ? 0 : (int) (insets.top * mSnapshot.getScale()),
                (int) (insets.right * mSnapshot.getScale()),
                (int) (insets.bottom * mSnapshot.getScale()));
        return rect;