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

Commit 79ab7ea0 authored by Chris Li's avatar Chris Li
Browse files

Flag whether a RemoteAnimationTarget has parent in animation

There is case when a TaskFragment is resizing while one of its children
is open/close. In such case, both the TaskFragment and its child will be
included in the transition, but we don't want to animate both of them.
Use the new flag to determine if the child need to be animated.

Bug: 196173550
Test: test with demo app
Change-Id: Ib5ad32501e046e5b612f6d5ae2faed6266d99f3d
parent e045dd6e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -208,6 +208,15 @@ public class RemoteAnimationTarget implements Parcelable {
     */
    public final @WindowManager.LayoutParams.WindowType int windowType;

    /**
     * {@code true} if its parent is also a {@link RemoteAnimationTarget} in the same transition.
     *
     * For example, when a TaskFragment is resizing while one of its children is open/close, both
     * windows will be animation targets. This value will be {@code true} for the child, so that
     * the handler can choose to handle it differently.
     */
    public boolean hasAnimatingParent;

    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            Rect localBounds, Rect screenSpaceBounds,
@@ -265,6 +274,7 @@ public class RemoteAnimationTarget implements Parcelable {
        taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
        allowEnterPip = in.readBoolean();
        windowType = in.readInt();
        hasAnimatingParent = in.readBoolean();
    }

    @Override
@@ -292,6 +302,7 @@ public class RemoteAnimationTarget implements Parcelable {
        dest.writeTypedObject(taskInfo, 0 /* flags */);
        dest.writeBoolean(allowEnterPip);
        dest.writeInt(windowType);
        dest.writeBoolean(hasAnimatingParent);
    }

    public void dump(PrintWriter pw, String prefix) {
@@ -311,6 +322,7 @@ public class RemoteAnimationTarget implements Parcelable {
        pw.print(prefix); pw.print("taskInfo="); pw.println(taskInfo);
        pw.print(prefix); pw.print("allowEnterPip="); pw.println(allowEnterPip);
        pw.print(prefix); pw.print("windowType="); pw.print(windowType);
        pw.print(prefix); pw.print("hasAnimatingParent="); pw.print(hasAnimatingParent);
    }

    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
+4 −2
Original line number Diff line number Diff line
@@ -9265,14 +9265,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                task.getBounds(), Type.systemBars(), false /* ignoreVisibility */).toRect();
        InsetUtils.addInsets(insets, getLetterboxInsets());

        return new RemoteAnimationTarget(task.mTaskId, record.getMode(),
                record.mAdapter.mCapturedLeash, !fillsParent(),
        final RemoteAnimationTarget target = new RemoteAnimationTarget(task.mTaskId,
                record.getMode(), record.mAdapter.mCapturedLeash, !fillsParent(),
                new Rect(), insets,
                getPrefixOrderIndex(), record.mAdapter.mPosition, record.mAdapter.mLocalBounds,
                record.mAdapter.mRootTaskBounds, task.getWindowConfiguration(),
                false /*isNotInRecents*/,
                record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null,
                record.mStartBounds, task.getTaskInfo(), checkEnterPictureInPictureAppOpsState());
        target.hasAnimatingParent = record.hasAnimatingParent();
        return target;
    }

    @Override
+13 −0
Original line number Diff line number Diff line
@@ -436,6 +436,19 @@ class RemoteAnimationController implements DeathRecipient {
        int getMode() {
            return mMode;
        }

        /** Whether its parent is also an animation target in the same transition. */
        boolean hasAnimatingParent() {
            // mOpeningApps and mClosingApps are only activities, so only need to check
            // mChangingContainers.
            for (int i = mDisplayContent.mChangingContainers.size() - 1; i >= 0; i--) {
                if (mWindowContainer.isDescendantOf(
                        mDisplayContent.mChangingContainers.valueAt(i))) {
                    return true;
                }
            }
            return false;
        }
    }

    class RemoteAnimationAdapterWrapper implements AnimationAdapter {