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

Commit 83d5a591 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge changes Ib5ad3250,Iff58afdb into sc-v2-dev

* changes:
  Flag whether a RemoteAnimationTarget has parent in animation
  Use TaskFragment bounds instead of TaskBounds for Activity animation
parents bd6816c6 79ab7ea0
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) {
+7 −9
Original line number Diff line number Diff line
@@ -223,7 +223,6 @@ import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL;
import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN;
import static com.android.server.wm.WindowStateAnimator.ROOT_TASK_CLIP_BEFORE_ANIM;

import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.END_TAG;
@@ -8041,13 +8040,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @VisibleForTesting
    @Override
    Rect getAnimationBounds(int appRootTaskClipMode) {
        if (appRootTaskClipMode == ROOT_TASK_CLIP_BEFORE_ANIM && getRootTask() != null) {
            // Using the root task bounds here effectively applies the clipping before animation.
            return getRootTask().getBounds();
        }
        // Use task-bounds if available so that activity-level letterbox (maxAspectRatio) is
        // Use TaskFragment-bounds if available so that activity-level letterbox (maxAspectRatio) is
        // included in the animation.
        return task != null ? task.getBounds() : getBounds();
        final TaskFragment taskFragment = getTaskFragment();
        return taskFragment != null ? taskFragment.getBounds() : getBounds();
    }

    @Override
@@ -9269,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 {
+0 −11
Original line number Diff line number Diff line
@@ -130,7 +130,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ROOT_TASK;
import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.dipToPixel;
import static com.android.server.wm.WindowStateAnimator.ROOT_TASK_CLIP_BEFORE_ANIM;

import static java.lang.Integer.MAX_VALUE;

@@ -2984,16 +2983,6 @@ class Task extends TaskFragment {
        super.resetSurfacePositionForAnimationLeash(t);
    }

    @Override
    Rect getAnimationBounds(int appRootTaskClipMode) {
        // TODO(b/131661052): we should remove appRootTaskClipMode with hierarchical animations.
        if (appRootTaskClipMode == ROOT_TASK_CLIP_BEFORE_ANIM && getRootTask() != null) {
            // Using the root task bounds here effectively applies the clipping before animation.
            return getRootTask().getBounds();
        }
        return super.getAnimationBounds(appRootTaskClipMode);
    }

    boolean shouldAnimate() {
        /**
         * Animations are handled by the TaskOrganizer implementation.
+1 −7
Original line number Diff line number Diff line
@@ -79,17 +79,11 @@ class WindowStateAnimator {
     */
    static final int ROOT_TASK_CLIP_AFTER_ANIM = 0;

    /**
     * Mode how the window gets clipped by the root task bounds: The clipping should be applied
     * before applying the animation transformation, i.e. the root task bounds move with the window.
     */
    static final int ROOT_TASK_CLIP_BEFORE_ANIM = 1;

    /**
     * Mode how window gets clipped by the root task bounds during an animation: Don't clip the
     * window by the root task bounds.
     */
    static final int ROOT_TASK_CLIP_NONE = 2;
    static final int ROOT_TASK_CLIP_NONE = 1;

    // Unchanging local convenience fields.
    final WindowManagerService mService;
Loading