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

Commit b3eba814 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Fixed issue with artifacts during scale-up transition animation

It is possible to get some artifacts during scale-up transition
animation of some fullscreen activities like Chrome. This is
caused by the clip rect specified by the transformation extending
outside the sys decor rect. We now contain the clip rect within
the system decor rect.

Also note that we don't want to do this for none-fullscreen
activities as it might cause some premature clipping.

Bug: 22830775
Bug: 21727851
Bug: 20652683
Bug: 19523205
Bug: 15046646
https://code.google.com/p/android/issues/detail?id=161362

Change-Id: I33827caaa256ad8fdc0eb3650ef34e95c48a6988
parent 60261137
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -1277,6 +1277,7 @@ class WindowStateAnimator {
        if (displayContent == null) {
            return;
        }
        final DisplayInfo displayInfo = displayContent.getDisplayInfo();

        // Need to recompute a new system decor rect each time.
        if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
@@ -1286,7 +1287,6 @@ class WindowStateAnimator {
        } else if (!w.isDefaultDisplay()) {
            // On a different display there is no system decor.  Crop the window
            // by the screen boundaries.
            final DisplayInfo displayInfo = displayContent.getDisplayInfo();
            w.mSystemDecorRect.set(0, 0, w.mCompatFrame.width(), w.mCompatFrame.height());
            w.mSystemDecorRect.intersect(-w.mCompatFrame.left, -w.mCompatFrame.top,
                    displayInfo.logicalWidth - w.mCompatFrame.left,
@@ -1308,9 +1308,11 @@ class WindowStateAnimator {
            applyDecorRect(w.mDecorFrame);
        }

        // By default, the clip rect is the system decor if the transformation doesn't specify one.
        final boolean fullscreen = w.isFullscreen(displayInfo.appWidth, displayInfo.appHeight);
        final Rect clipRect = mTmpClipRect;
        clipRect.set((mHasClipRect) ? mClipRect : w.mSystemDecorRect);
        // 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 : w.mSystemDecorRect);

        // Expand the clip rect for surface insets.
        final WindowManager.LayoutParams attrs = w.mAttrs;
@@ -1319,6 +1321,13 @@ class WindowStateAnimator {
        clipRect.right += attrs.surfaceInsets.right;
        clipRect.bottom += attrs.surfaceInsets.bottom;

        if (mHasClipRect && fullscreen) {
            // We intersect the clip rect specified by the transformation with the expanded system
            // decor rect to prevent artifacts from drawing during animation if the transformation
            // clip rect extends outside the system decor rect.
            clipRect.intersect(mClipRect);
        }

        // The clip rect was generated assuming (0,0) as the window origin,
        // so we need to translate to match the actual surface coordinates.
        clipRect.offset(attrs.surfaceInsets.left, attrs.surfaceInsets.top);