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

Commit c7b8a100 authored by Craig Mautner's avatar Craig Mautner
Browse files

Make DimLayer size dependent on stack layout.

Only use the stack bounds for the DimLayer bounds if there is more
than one stack on a layer. Otherwise cover the entire screen (and
more) with the DimLayer. This way there are no exposed regions when
rotating.

Fixes bug 10428085.

Change-Id: I7bfff12b69d59e86610621c498dab35cf0db8eb5
parent cbf3f2cd
Loading
Loading
Loading
Loading
+27 −16
Original line number Diff line number Diff line
@@ -48,9 +48,13 @@ public class DimLayer {
    /** Time in milliseconds to take to transition from mStartAlpha to mTargetAlpha */
    long mDuration;

    DimLayer(WindowManagerService service, DisplayContent displayContent) {
        mDisplayContent = displayContent;
        final int displayId = displayContent.getDisplayId();
    /** Owning stack */
    final TaskStack mStack;

    DimLayer(WindowManagerService service, TaskStack stack) {
        mStack = stack;
        mDisplayContent = stack.getDisplayContent();
        final int displayId = mDisplayContent.getDisplayId();
        if (DEBUG) Slog.v(TAG, "Ctor: displayId=" + displayId);
        SurfaceControl.openTransaction();
        try {
@@ -160,22 +164,29 @@ public class DimLayer {
            return;
        }

        /*
        final int dw, dh;
        final float xPos, yPos;
        if (mStack.hasSibling()) {
            dw = mBounds.width();
            dh = mBounds.height();
            xPos = mBounds.left;
            yPos = mBounds.right;
        } else {
            // Set surface size to screen size.
            final DisplayInfo info = mDisplayContent.getDisplayInfo();
            // Multiply by 1.5 so that rotating a frozen surface that includes this does not expose a
            // corner.
        final int dw = (int) (info.logicalWidth * 1.5);
        final int dh = (int) (info.logicalHeight * 1.5);
            dw = (int) (info.logicalWidth * 1.5);
            dh = (int) (info.logicalHeight * 1.5);
            // back off position so 1/4 of Surface is before and 1/4 is after.
        final float xPos = -1 * dw / 6;
        final float yPos = -1 * dh / 6;
        */
            xPos = -1 * dw / 6;
            yPos = -1 * dh / 6;
        }

        if (!mLastBounds.equals(mBounds) || mLayer != layer) {
            try {
                mDimSurface.setPosition(mBounds.left, mBounds.top);
                mDimSurface.setSize(mBounds.width(), mBounds.height());
                mDimSurface.setPosition(xPos, yPos);
                mDimSurface.setSize(dw, dh);
                mDimSurface.setLayer(layer);
            } catch (RuntimeException e) {
                Slog.w(TAG, "Failure setting size or layer", e);
+2 −2
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ public class TaskStack {
        mStackId = stackId;
        mDisplayContent = displayContent;
        final int displayId = displayContent.getDisplayId();
        mDimLayer = new DimLayer(service, displayContent);
        mAnimationBackgroundSurface = new DimLayer(service, displayContent);
        mDimLayer = new DimLayer(service, this);
        mAnimationBackgroundSurface = new DimLayer(service, this);
    }

    DisplayContent getDisplayContent() {