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

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

Merge changes I670fe942,I87eaf866,I4a729457

* changes:
  Pinned stack animation: Fix inset logic.
  Pinned stack animation: Trigger window preservation when dropping shadows.
  Pinned stack animation: Prevent window preservation during animation.
parents 30ed6d0d 7e4c90e5
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -2393,7 +2393,18 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        mWindowManager.deferSurfaceLayout();
        try {
            ActivityRecord r = stack.topRunningActivityLocked();
            stack.resize(pinnedBounds, tempPinnedTaskBounds, null);
            Rect insetBounds = null;
            if (tempPinnedTaskBounds != null) {
                // We always use 0,0 as the position for the inset rect because
                // if we are getting insets at all in the pinned stack it must mean
                // we are headed for fullscreen.
                insetBounds = tempRect;
                insetBounds.top = 0;
                insetBounds.left = 0;
                insetBounds.right = tempPinnedTaskBounds.width();
                insetBounds.bottom = tempPinnedTaskBounds.height();
            }
            stack.resize(pinnedBounds, tempPinnedTaskBounds, insetBounds);
            stack.ensureVisibleActivitiesConfigurationLocked(r, false);
        } finally {
            mWindowManager.continueSurfaceLayout();
+2 −2
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ public class BoundsAnimationController {
            // we trigger any size changes, so it can swap surfaces
            // in to appropriate modes, or do as it wishes otherwise.
            if (!mReplacement) {
                mTarget.onAnimationStart();
                mTarget.onAnimationStart(mMoveToFullScreen);
            }

            // Immediately update the task bounds if they have to become larger, but preserve
@@ -263,7 +263,7 @@ public class BoundsAnimationController {
         */
        boolean setPinnedStackSize(Rect bounds, Rect taskBounds);

        void onAnimationStart();
        void onAnimationStart(boolean toFullscreen);

        /**
         * Callback for the target to inform it that the animation has ended, so it can do some
+8 −1
Original line number Diff line number Diff line
@@ -592,8 +592,15 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
        return mStack != null && mStack.mStackId == PINNED_STACK_ID;
    }

    /**
     * When we are in a floating stack (Freeform, Pinned, ...) we calculate
     * insets differently. However if we are animating to the fullscreen stack
     * we need to begin calculating insets as if we were fullscreen, otherwise
     * we will have a jump at the end.
     */
    boolean isFloating() {
        return StackId.tasksAreFloating(mStack.mStackId);
        return StackId.tasksAreFloating(mStack.mStackId)
            && !mStack.isBoundsAnimatingToFullscreen();
    }

    WindowState getTopVisibleAppMainWindow() {
+8 −2
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
    // perfectly fit the region it would have been cropped to. We may also avoid certain logic we
    // would otherwise apply while resizing, while resizing in the bounds animating mode.
    private boolean mBoundsAnimating = false;
    private boolean mBoundsAnimatingToFullscreen = false;
    private Rect mBoundsAnimationTarget = new Rect();

    // Temporary storage for the new bounds that should be used after the configuration change.
@@ -1443,9 +1444,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
    }

    @Override  // AnimatesBounds
    public void onAnimationStart() {
    public void onAnimationStart(boolean toFullscreen) {
        synchronized (mService.mWindowMap) {
            mBoundsAnimating = true;
            mBoundsAnimatingToFullscreen = toFullscreen;
        }
    }

@@ -1486,7 +1488,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
        return StackId.hasMovementAnimations(mStackId);
    }

    public boolean getForceScaleToStack() {
    public boolean isForceScaled() {
        return mBoundsAnimating;
    }

@@ -1494,6 +1496,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
        return mBoundsAnimating;
    }

    public boolean isBoundsAnimatingToFullscreen() {
        return mBoundsAnimating && mBoundsAnimatingToFullscreen;
    }

    /** Returns true if a removal action is still being deferred. */
    boolean checkCompleteDeferredRemoval() {
        if (isAnimating()) {
+1 −64
Original line number Diff line number Diff line
@@ -2003,7 +2003,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (viewVisibility == View.VISIBLE &&
                    (win.mAppToken == null || win.mAttrs.type == TYPE_APPLICATION_STARTING
                            || !win.mAppToken.clientHidden)) {
                result = relayoutVisibleWindow(outConfig, result, win, winAnimator, attrChanges,
                result = win.relayoutVisibleWindow(outConfig, result, attrChanges,
                        oldVisibility);
                try {
                    result = createSurfaceControl(outSurface, result, win, winAnimator);
@@ -2221,69 +2221,6 @@ public class WindowManagerService extends IWindowManager.Stub
        return result;
    }

    private int relayoutVisibleWindow(Configuration outConfig, int result, WindowState win,
            WindowStateAnimator winAnimator, int attrChanges, int oldVisibility) {
        result |= !win.isVisibleLw() ? WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME : 0;
        if (win.mAnimatingExit) {
            Slog.d(TAG, "relayoutVisibleWindow: " + win + " mAnimatingExit=true, mRemoveOnExit="
                    + win.mRemoveOnExit + ", mDestroying=" + win.mDestroying);

            winAnimator.cancelExitAnimationForNextAnimationLocked();
            win.mAnimatingExit = false;
        }
        if (win.mDestroying) {
            win.mDestroying = false;
            mDestroySurface.remove(win);
        }
        if (oldVisibility == View.GONE) {
            winAnimator.mEnterAnimationPending = true;
        }

        win.mLastVisibleLayoutRotation = mRotation;

        winAnimator.mEnteringAnimation = true;
        if ((result & WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME) != 0) {
            win.prepareWindowToDisplayDuringRelayout(outConfig);
        }
        if ((attrChanges & LayoutParams.FORMAT_CHANGED) != 0) {
            // If the format can't be changed in place, preserve the old surface until the app draws
            // on the new one. This prevents blinking when we change elevation of freeform and
            // pinned windows.
            if (!winAnimator.tryChangeFormatInPlaceLocked()) {
                winAnimator.preserveSurfaceLocked();
                result |= RELAYOUT_RES_SURFACE_CHANGED
                        | WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
            }
        }

        // If we're starting a drag-resize, we'll be changing the surface size as well as
        // notifying the client to render to with an offset from the surface's top-left.
        if (win.isDragResizeChanged() || win.isResizedWhileNotDragResizing()) {
            win.setDragResizing();
            win.setResizedWhileNotDragResizing(false);
            // We can only change top level windows to the full-screen surface when
            // resizing (as we only have one full-screen surface). So there is no need
            // to preserve and destroy windows which are attached to another, they
            // will keep their surface and its size may change over time.
            if (win.mHasSurface && !win.isChildWindow()) {
                winAnimator.preserveSurfaceLocked();
                result |= WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
            }
        }
        final boolean freeformResizing = win.isDragResizing()
                && win.getResizeMode() == DRAG_RESIZE_MODE_FREEFORM;
        final boolean dockedResizing = win.isDragResizing()
                && win.getResizeMode() == DRAG_RESIZE_MODE_DOCKED_DIVIDER;
        result |= freeformResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_FREEFORM : 0;
        result |= dockedResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED : 0;
        if (win.isAnimatingWithSavedSurface()) {
            // If we're animating with a saved surface now, request client to report draw.
            // We still need to know when the real thing is drawn.
            result |= WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
        }
        return result;
    }

    public void performDeferredDestroyWindow(Session session, IWindow client) {
        long origId = Binder.clearCallingIdentity();

Loading