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

Commit b4478c56 authored by Louis Chang's avatar Louis Chang Committed by Charles Chen
Browse files

Fix black screen while animating a closing and changing TF

A TaskFragment could be resizing to a smaller bounds while changing
to be invisible. A black screen was shown during the transition.
So, skip unfreeze surface in that case.

Also union the staring bounds to the whole closing screen bounds,
or the leash will be cropped by the target screen bounds.

Bug: 267044260
Test: steps on the bug
Change-Id: Ia037c5beaca12695fc6c00e38c454cb6dced1b33
parent 28b2efa8
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -214,7 +214,8 @@ class TaskFragmentAnimationRunner extends IRemoteAnimationRunner.Stub {
                openingWholeScreenBounds.union(target.screenSpaceBounds);
                openingWholeScreenBounds.union(target.screenSpaceBounds);
            } else {
            } else {
                closingTargets.add(target);
                closingTargets.add(target);
                closingWholeScreenBounds.union(target.screenSpaceBounds);
                // Union the start bounds since this may be the ClosingChanging animation.
                closingWholeScreenBounds.union(target.startBounds);
            }
            }
        }
        }


+1 −1
Original line number Original line Diff line number Diff line
@@ -224,7 +224,7 @@ class ActivityEmbeddingAnimationRunner {
                openingWholeScreenBounds.union(change.getEndAbsBounds());
                openingWholeScreenBounds.union(change.getEndAbsBounds());
            } else {
            } else {
                closingChanges.add(change);
                closingChanges.add(change);
                closingWholeScreenBounds.union(change.getEndAbsBounds());
                closingWholeScreenBounds.union(change.getStartAbsBounds());
            }
            }
        }
        }


+7 −2
Original line number Original line Diff line number Diff line
@@ -2518,13 +2518,18 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        return task != null && !task.isDragResizing() && super.canStartChangeTransition();
        return task != null && !task.isDragResizing() && super.canStartChangeTransition();
    }
    }


    /** Records the starting bounds of the closing organized TaskFragment. */
    /**
    void setClosingChangingStartBoundsIfNeeded() {
     * Returns {@code true} if the starting bounds of the closing organized TaskFragment is
     * recorded. Otherwise, return {@code false}.
     */
    boolean setClosingChangingStartBoundsIfNeeded() {
        if (isOrganizedTaskFragment() && mDisplayContent != null
        if (isOrganizedTaskFragment() && mDisplayContent != null
                && mDisplayContent.mChangingContainers.remove(this)) {
                && mDisplayContent.mChangingContainers.remove(this)) {
            mDisplayContent.mClosingChangingContainers.put(
            mDisplayContent.mClosingChangingContainers.put(
                    this, new Rect(mSurfaceFreezer.mFreezeBounds));
                    this, new Rect(mSurfaceFreezer.mFreezeBounds));
            return true;
        }
        }
        return false;
    }
    }


    @Override
    @Override
+6 −2
Original line number Original line Diff line number Diff line
@@ -1336,15 +1336,19 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        // If we are losing visibility, then a snapshot isn't necessary and we are no-longer
        // If we are losing visibility, then a snapshot isn't necessary and we are no-longer
        // part of a change transition.
        // part of a change transition.
        if (!visible) {
        if (!visible) {
            boolean skipUnfreeze = false;
            if (asTaskFragment() != null) {
            if (asTaskFragment() != null) {
                // If the organized TaskFragment is closing while resizing, we want to keep track of
                // If the organized TaskFragment is closing while resizing, we want to keep track of
                // its starting bounds to make sure the animation starts at the correct position.
                // its starting bounds to make sure the animation starts at the correct position.
                // This should be called before unfreeze() because we record the starting bounds
                // This should be called before unfreeze() because we record the starting bounds
                // in SurfaceFreezer.
                // in SurfaceFreezer.
                asTaskFragment().setClosingChangingStartBoundsIfNeeded();
                skipUnfreeze = asTaskFragment().setClosingChangingStartBoundsIfNeeded();
            }
            }

            if (!skipUnfreeze) {
                mSurfaceFreezer.unfreeze(getSyncTransaction());
                mSurfaceFreezer.unfreeze(getSyncTransaction());
            }
            }
        }
        WindowContainer parent = getParent();
        WindowContainer parent = getParent();
        if (parent != null) {
        if (parent != null) {
            parent.onChildVisibilityRequested(visible);
            parent.onChildVisibilityRequested(visible);