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

Commit 859480ff authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge changes Ib5ad3250,Iff58afdb into sc-v2-dev am: 83d5a591 am: 055d1d5a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15838390

Change-Id: I437593233fa28a2915ebb4323f2e8172542777ff
parents 72bcee87 055d1d5a
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -208,6 +208,15 @@ public class RemoteAnimationTarget implements Parcelable {
     */
     */
    public final @WindowManager.LayoutParams.WindowType int windowType;
    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,
    public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
            Rect localBounds, Rect screenSpaceBounds,
            Rect localBounds, Rect screenSpaceBounds,
@@ -265,6 +274,7 @@ public class RemoteAnimationTarget implements Parcelable {
        taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
        taskInfo = in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
        allowEnterPip = in.readBoolean();
        allowEnterPip = in.readBoolean();
        windowType = in.readInt();
        windowType = in.readInt();
        hasAnimatingParent = in.readBoolean();
    }
    }


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


    public void dump(PrintWriter pw, String prefix) {
    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("taskInfo="); pw.println(taskInfo);
        pw.print(prefix); pw.print("allowEnterPip="); pw.println(allowEnterPip);
        pw.print(prefix); pw.print("allowEnterPip="); pw.println(allowEnterPip);
        pw.print(prefix); pw.print("windowType="); pw.print(windowType);
        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) {
    public void dumpDebug(ProtoOutputStream proto, long fieldId) {
+7 −9
Original line number Original line 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.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES;
import static com.android.server.wm.WindowState.LEGACY_POLICY_VISIBILITY;
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.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_DOCUMENT;
import static org.xmlpull.v1.XmlPullParser.END_TAG;
import static org.xmlpull.v1.XmlPullParser.END_TAG;
@@ -8041,13 +8040,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @VisibleForTesting
    @VisibleForTesting
    @Override
    @Override
    Rect getAnimationBounds(int appRootTaskClipMode) {
    Rect getAnimationBounds(int appRootTaskClipMode) {
        if (appRootTaskClipMode == ROOT_TASK_CLIP_BEFORE_ANIM && getRootTask() != null) {
        // Use TaskFragment-bounds if available so that activity-level letterbox (maxAspectRatio) is
            // 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
        // included in the animation.
        // included in the animation.
        return task != null ? task.getBounds() : getBounds();
        final TaskFragment taskFragment = getTaskFragment();
        return taskFragment != null ? taskFragment.getBounds() : getBounds();
    }
    }


    @Override
    @Override
@@ -9269,14 +9265,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                task.getBounds(), Type.systemBars(), false /* ignoreVisibility */).toRect();
                task.getBounds(), Type.systemBars(), false /* ignoreVisibility */).toRect();
        InsetUtils.addInsets(insets, getLetterboxInsets());
        InsetUtils.addInsets(insets, getLetterboxInsets());


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


    @Override
    @Override
+13 −0
Original line number Original line Diff line number Diff line
@@ -436,6 +436,19 @@ class RemoteAnimationController implements DeathRecipient {
        int getMode() {
        int getMode() {
            return mMode;
            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 {
    class RemoteAnimationAdapterWrapper implements AnimationAdapter {
+0 −11
Original line number Original line 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.DEBUG_TASK_MOVEMENT;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.dipToPixel;
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;
import static java.lang.Integer.MAX_VALUE;


@@ -2984,16 +2983,6 @@ class Task extends TaskFragment {
        super.resetSurfacePositionForAnimationLeash(t);
        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() {
    boolean shouldAnimate() {
        /**
        /**
         * Animations are handled by the TaskOrganizer implementation.
         * Animations are handled by the TaskOrganizer implementation.
+1 −7
Original line number Original line Diff line number Diff line
@@ -79,17 +79,11 @@ class WindowStateAnimator {
     */
     */
    static final int ROOT_TASK_CLIP_AFTER_ANIM = 0;
    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
     * Mode how window gets clipped by the root task bounds during an animation: Don't clip the
     * window by the root task bounds.
     * 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.
    // Unchanging local convenience fields.
    final WindowManagerService mService;
    final WindowManagerService mService;
Loading