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

Commit 19a5d2e9 authored by lumark's avatar lumark
Browse files

Promote AppWindowToken.applyAnimationLocked() to the base class.

- Add WindowContainer#getAnimationAdapter for all window hierarchy.

- Extract logics related Remote animation / Local animation adapter
  creation from applyAnimationLocked into WC#getAnimationAdapter.

- Make RemoteAnimationRecord can accept in each window hierarchy.

Bug: 142617871
Bug: 131661052
Test: Refactoring, existing tests pass.
Change-Id: If1c39d09966d82653faf7ebd975592eaeacd7c24
parent 9bca6b43
Loading
Loading
Loading
Loading
+48 −42
Original line number Diff line number Diff line
@@ -169,12 +169,6 @@
      "group": "WM_DEBUG_RESIZE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "-1822611824": {
      "message": "\tRemove token=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1797409732": {
      "message": "Skipping %s because %s",
      "level": "VERBOSE",
@@ -421,6 +415,12 @@
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-1248645819": {
      "message": "\tAdd container=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1219773477": {
      "message": "setInputConsumerEnabled(%s): mCanceled=%b",
      "level": "DEBUG",
@@ -493,12 +493,6 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/RootWindowContainer.java"
    },
    "-1099052739": {
      "message": "\tAdd token=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1089874824": {
      "message": "SURFACE SHOW (performLayout): %s",
      "level": "INFO",
@@ -721,6 +715,12 @@
      "group": "WM_DEBUG_SCREEN_ON",
      "at": "com\/android\/server\/wm\/DisplayContent.java"
    },
    "-633961578": {
      "message": "applyAnimation: transition animation is disabled or skipped. container=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-622997754": {
      "message": "postWindowRemoveCleanupLocked: %s",
      "level": "VERBOSE",
@@ -883,12 +883,6 @@
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-253016819": {
      "message": "applyAnimation: transition animation is disabled or skipped. atoken=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-251259736": {
      "message": "No longer freezing: %s",
      "level": "VERBOSE",
@@ -961,6 +955,12 @@
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/Session.java"
    },
    "-33096143": {
      "message": "applyAnimation: transition animation is disabled or skipped. container=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/WindowContainer.java"
    },
    "-29233992": {
      "message": "SURFACE CLEAR CROP: %s",
      "level": "INFO",
@@ -1375,6 +1375,12 @@
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
    },
    "638429464": {
      "message": "\tRemove container=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "644675193": {
      "message": "Real start recents",
      "level": "DEBUG",
@@ -1465,12 +1471,6 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "815803557": {
      "message": "applyAnimation: atoken=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "829434921": {
      "message": "Draw state now committed in %s",
      "level": "VERBOSE",
@@ -1543,6 +1543,12 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "972354148": {
      "message": "\tcontainer=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "1001904964": {
      "message": "***** BOOT TIMEOUT: forcing display enabled",
      "level": "WARN",
@@ -1675,12 +1681,6 @@
      "group": "WM_DEBUG_FOCUS",
      "at": "com\/android\/server\/wm\/DisplayContent.java"
    },
    "1358786604": {
      "message": "No thumbnail header bitmap for: %d",
      "level": "DEBUG",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "1364498663": {
      "message": "notifyAppResumed: wasStopped=%b %s",
      "level": "VERBOSE",
@@ -1795,11 +1795,11 @@
      "group": "WM_DEBUG_RECENTS_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RecentsAnimationController.java"
    },
    "1531527061": {
      "message": "createAnimationAdapter(): token=%s",
    "1528528509": {
      "message": "No thumbnail header bitmap for: %s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "1563755163": {
      "message": "Permission Denial: %s from pid=%d, uid=%d requires %s",
@@ -1819,6 +1819,12 @@
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "1584270979": {
      "message": "applyAnimation: container=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/WindowContainer.java"
    },
    "1589610525": {
      "message": "applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: anim=%s transit=%s isEntrance=true Callers=%s",
      "level": "VERBOSE",
@@ -1909,11 +1915,11 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "1804869745": {
    "1831008694": {
      "message": "Loading animation for app transition. transit=%s enter=%b frame=%s insets=%s surfaceInsets=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
      "at": "com\/android\/server\/wm\/WindowContainer.java"
    },
    "1836214582": {
      "message": "startingData was nulled out before handling mAddStartingWindow: %s",
@@ -1939,12 +1945,6 @@
      "group": "WM_DEBUG_SCREEN_ON",
      "at": "com\/android\/server\/wm\/DisplayPolicy.java"
    },
    "1865246212": {
      "message": "\tapp=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "1866772666": {
      "message": "SAFE MODE not enabled",
      "level": "INFO",
@@ -2017,6 +2017,12 @@
      "group": "WM_DEBUG_STARTING_WINDOW",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "2022422429": {
      "message": "createAnimationAdapter(): container=%s",
      "level": "DEBUG",
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "2028163120": {
      "message": "applyAnimation: anim=%s nextAppTransition=ANIM_SCALE_UP transit=%s isEntrance=%s Callers=%s",
      "level": "VERBOSE",
+64 −214

File changed.

Preview size limit exceeded, changes collapsed.

+41 −22
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ public class AppTransition implements Dump {
    private int mNextAppTransitionExit;
    private int mNextAppTransitionInPlace;

    // Keyed by task id.
    // Keyed by WindowContainer hashCode.
    private final SparseArray<AppTransitionAnimationSpec> mNextAppTransitionAnimationsSpecs
            = new SparseArray<>();
    private IAppTransitionAnimationSpecsFuture mNextAppTransitionAnimationsSpecsFuture;
@@ -372,8 +372,9 @@ public class AppTransition implements Dump {
        setAppTransitionState(APP_STATE_TIMEOUT);
    }

    GraphicBuffer getAppTransitionThumbnailHeader(int taskId) {
        AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(taskId);
    GraphicBuffer getAppTransitionThumbnailHeader(WindowContainer container) {
        AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
                container.hashCode());
        if (spec == null) {
            spec = mDefaultNextAppTransitionAnimationSpec;
        }
@@ -789,14 +790,15 @@ public class AppTransition implements Dump {
        }
    }

    void getNextAppTransitionStartRect(int taskId, Rect rect) {
        AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(taskId);
    void getNextAppTransitionStartRect(WindowContainer container, Rect rect) {
        AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
                container.hashCode());
        if (spec == null) {
            spec = mDefaultNextAppTransitionAnimationSpec;
        }
        if (spec == null || spec.rect == null) {
            Slog.e(TAG, "Starting rect for task: " + taskId + " requested, but not available",
                    new Throwable());
            Slog.e(TAG, "Starting rect for container: " + container
                            + " requested, but not available", new Throwable());
            rect.setEmpty();
        } else {
            rect.set(spec.rect);
@@ -1065,7 +1067,7 @@ public class AppTransition implements Dump {
     * when a thumbnail is specified with the pending animation override.
     */
    Animation createThumbnailAspectScaleAnimationLocked(Rect appRect, @Nullable Rect contentInsets,
            GraphicBuffer thumbnailHeader, final int taskId, int uiMode, int orientation) {
            GraphicBuffer thumbnailHeader, WindowContainer container, int uiMode, int orientation) {
        Animation a;
        final int thumbWidthI = thumbnailHeader.getWidth();
        final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
@@ -1073,7 +1075,7 @@ public class AppTransition implements Dump {
        final int appWidth = appRect.width();

        float scaleW = appWidth / thumbWidth;
        getNextAppTransitionStartRect(taskId, mTmpRect);
        getNextAppTransitionStartRect(container, mTmpRect);
        final float fromX;
        float fromY;
        final float toX;
@@ -1226,7 +1228,7 @@ public class AppTransition implements Dump {
    Animation createAspectScaledThumbnailEnterExitAnimationLocked(int thumbTransitState,
            int uiMode, int orientation, int transit, Rect containingFrame, Rect contentInsets,
            @Nullable Rect surfaceInsets, @Nullable Rect stableInsets, boolean freeform,
            int taskId) {
            WindowContainer container) {
        Animation a;
        final int appWidth = containingFrame.width();
        final int appHeight = containingFrame.height();
@@ -1244,10 +1246,10 @@ public class AppTransition implements Dump {
                final boolean scaleUp = thumbTransitState == THUMBNAIL_TRANSITION_ENTER_SCALE_UP;
                if (freeform && scaleUp) {
                    a = createAspectScaledThumbnailEnterFreeformAnimationLocked(
                            containingFrame, surfaceInsets, taskId);
                            containingFrame, surfaceInsets, container);
                } else if (freeform) {
                    a = createAspectScaledThumbnailExitFreeformAnimationLocked(
                            containingFrame, surfaceInsets, taskId);
                            containingFrame, surfaceInsets, container);
                } else {
                    AnimationSet set = new AnimationSet(true);

@@ -1359,15 +1361,15 @@ public class AppTransition implements Dump {
    }

    private Animation createAspectScaledThumbnailEnterFreeformAnimationLocked(Rect frame,
            @Nullable Rect surfaceInsets, int taskId) {
        getNextAppTransitionStartRect(taskId, mTmpRect);
            @Nullable Rect surfaceInsets, WindowContainer container) {
        getNextAppTransitionStartRect(container, mTmpRect);
        return createAspectScaledThumbnailFreeformAnimationLocked(mTmpRect, frame, surfaceInsets,
                true);
    }

    private Animation createAspectScaledThumbnailExitFreeformAnimationLocked(Rect frame,
            @Nullable Rect surfaceInsets, int taskId) {
        getNextAppTransitionStartRect(taskId, mTmpRect);
            @Nullable Rect surfaceInsets, WindowContainer container) {
        getNextAppTransitionStartRect(container, mTmpRect);
        return createAspectScaledThumbnailFreeformAnimationLocked(frame, mTmpRect, surfaceInsets,
                false);
    }
@@ -1469,10 +1471,10 @@ public class AppTransition implements Dump {
     * leaving, and the activity that is entering.
     */
    Animation createThumbnailEnterExitAnimationLocked(int thumbTransitState, Rect containingFrame,
            int transit, int taskId) {
            int transit, WindowContainer container) {
        final int appWidth = containingFrame.width();
        final int appHeight = containingFrame.height();
        final GraphicBuffer thumbnailHeader = getAppTransitionThumbnailHeader(taskId);
        final GraphicBuffer thumbnailHeader = getAppTransitionThumbnailHeader(container);
        Animation a;
        getDefaultNextAppTransitionStartRect(mTmpRect);
        final int thumbWidthI = thumbnailHeader != null ? thumbnailHeader.getWidth() : appWidth;
@@ -1615,7 +1617,7 @@ public class AppTransition implements Dump {
    Animation loadAnimation(LayoutParams lp, int transit, boolean enter, int uiMode,
            int orientation, Rect frame, Rect displayFrame, Rect insets,
            @Nullable Rect surfaceInsets, @Nullable Rect stableInsets, boolean isVoiceInteraction,
            boolean freeform, int taskId) {
            boolean freeform, WindowContainer container) {
        Animation a;
        if (isKeyguardGoingAwayTransit(transit) && enter) {
            a = loadKeyguardExitAnimation(transit);
@@ -1679,7 +1681,7 @@ public class AppTransition implements Dump {
            mNextAppTransitionScaleUp =
                    (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP);
            a = createThumbnailEnterExitAnimationLocked(getThumbnailTransitionState(enter),
                    frame, transit, taskId);
                    frame, transit, container);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
                    "applyAnimation: anim=%s nextAppTransition=%s transit=%s isEntrance=%b "
                            + "Callers=%s",
@@ -1692,7 +1694,7 @@ public class AppTransition implements Dump {
                    (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP);
            a = createAspectScaledThumbnailEnterExitAnimationLocked(
                    getThumbnailTransitionState(enter), uiMode, orientation, transit, frame,
                    insets, surfaceInsets, stableInsets, freeform, taskId);
                    insets, surfaceInsets, stableInsets, freeform, container);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
                    "applyAnimation: anim=%s nextAppTransition=%s transit=%s isEntrance=%b "
                            + "Callers=%s",
@@ -1895,7 +1897,11 @@ public class AppTransition implements Dump {
                for (int i = 0; i < specs.length; i++) {
                    AppTransitionAnimationSpec spec = specs[i];
                    if (spec != null) {
                        mNextAppTransitionAnimationsSpecs.put(spec.taskId, spec);
                        final WindowContainer container = findTask(spec.taskId);
                        if (container == null) {
                            continue;
                        }
                        mNextAppTransitionAnimationsSpecs.put(container.hashCode(), spec);
                        if (i == 0) {
                            // In full screen mode, the transition code depends on the default spec
                            // to be set.
@@ -1912,6 +1918,19 @@ public class AppTransition implements Dump {
        }
    }

    private Task findTask(int taskId) {
        if (taskId < 0) {
            return null;
        }
        ArrayList<Task> tasks = new ArrayList<>();
        mDisplayContent.forAllTasks(task -> {
            if (task.mTaskId == taskId) {
                tasks.add(task);
            }
        });
        return tasks.size() == 1 ? tasks.get(0) : null;
    }

    void overridePendingAppTransitionMultiThumbFuture(
            IAppTransitionAnimationSpecsFuture specsFuture, IRemoteCallback callback,
            boolean scaleUp) {
+1 −1
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ public class AppTransitionController {
            ActivityRecord activity = apps.valueAt(i);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Now changing app %s", activity);
            activity.cancelAnimationOnly();
            activity.applyAnimationLocked(null, transit, true, false);
            activity.applyAnimation(null, transit, true, false);
            activity.updateReportedVisibilityLocked();
            mService.openSurfaceTransaction();
            try {
+28 −38
Original line number Diff line number Diff line
@@ -41,7 +41,6 @@ import com.android.internal.util.FastPrintWriter;
import com.android.server.protolog.ProtoLogImpl;
import com.android.server.protolog.common.ProtoLog;
import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
import com.android.server.wm.utils.InsetUtils;

import java.io.PrintWriter;
import java.io.StringWriter;
@@ -76,20 +75,20 @@ class RemoteAnimationController implements DeathRecipient {
    }

    /**
     * Creates an animation record for each individual {@link ActivityRecord}.
     * Creates an animation record for each individual {@link WindowContainer}.
     *
     * @param activity The app to animate.
     * @param windowContainer The windows to animate.
     * @param position The position app bounds, in screen coordinates.
     * @param stackBounds The stack bounds of the app relative to position.
     * @param startBounds The stack bounds before the transition, in screen coordinates
     * @return The record representing animation(s) to run on the app.
     */
    RemoteAnimationRecord createRemoteAnimationRecord(ActivityRecord activity, Point position,
            Rect stackBounds, Rect startBounds) {
        ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "createAnimationAdapter(): token=%s",
                activity);
    RemoteAnimationRecord createRemoteAnimationRecord(WindowContainer windowContainer,
            Point position, Rect stackBounds, Rect startBounds) {
        ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "createAnimationAdapter(): container=%s",
                windowContainer);
        final RemoteAnimationRecord adapters =
                new RemoteAnimationRecord(activity, position, stackBounds, startBounds);
                new RemoteAnimationRecord(windowContainer, position, stackBounds, startBounds);
        mPendingAnimations.add(adapters);
        return adapters;
    }
@@ -169,11 +168,12 @@ class RemoteAnimationController implements DeathRecipient {
            final RemoteAnimationRecord wrappers = mPendingAnimations.get(i);
            final RemoteAnimationTarget target = wrappers.createRemoteAnimationTarget();
            if (target != null) {
                ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tAdd token=%s", wrappers.mActivityRecord);
                ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tAdd container=%s",
                        wrappers.mWindowContainer);
                targets.add(target);
            } else {
                ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tRemove token=%s",
                        wrappers.mActivityRecord);
                ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tRemove container=%s",
                        wrappers.mWindowContainer);

                // We can't really start an animation but we still need to make sure to finish the
                // pending animation that was started by SurfaceAnimator
@@ -228,7 +228,8 @@ class RemoteAnimationController implements DeathRecipient {
                                .onAnimationFinished(adapters.mThumbnailAdapter);
                    }
                    mPendingAnimations.remove(i);
                    ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tapp=%s", adapters.mActivityRecord);
                    ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "\tcontainer=%s",
                            adapters.mWindowContainer);
                }

                for (int i = mPendingWallpaperAnimations.size() - 1; i >= 0; i--) {
@@ -332,7 +333,7 @@ class RemoteAnimationController implements DeathRecipient {
    };

    /**
     * Contains information about a remote-animation for one AppWindowToken. This keeps track of,
     * Contains information about a remote-animation for one WindowContainer. This keeps track of,
     * potentially, multiple animating surfaces (AdapterWrappers) associated with one
     * Window/Transition. For example, a change transition has an adapter controller for the
     * main window and an adapter controlling the start-state snapshot.
@@ -345,12 +346,12 @@ class RemoteAnimationController implements DeathRecipient {
        RemoteAnimationAdapterWrapper mAdapter;
        RemoteAnimationAdapterWrapper mThumbnailAdapter = null;
        RemoteAnimationTarget mTarget;
        final ActivityRecord mActivityRecord;
        final WindowContainer mWindowContainer;
        final Rect mStartBounds;

        RemoteAnimationRecord(ActivityRecord activityRecord, Point endPos, Rect endBounds,
        RemoteAnimationRecord(WindowContainer windowContainer, Point endPos, Rect endBounds,
                Rect startBounds) {
            mActivityRecord = activityRecord;
            mWindowContainer = windowContainer;
            mAdapter = new RemoteAnimationAdapterWrapper(this, endPos, endBounds);
            if (startBounds != null) {
                mStartBounds = new Rect(startBounds);
@@ -366,31 +367,20 @@ class RemoteAnimationController implements DeathRecipient {
        }

        RemoteAnimationTarget createRemoteAnimationTarget() {
            final Task task = mActivityRecord.getTask();
            final WindowState mainWindow = mActivityRecord.findMainWindow();
            if (task == null || mainWindow == null || mAdapter == null
            if (mAdapter == null
                    || mAdapter.mCapturedFinishCallback == null
                    || mAdapter.mCapturedLeash == null) {
                return null;
            }
            final Rect insets = new Rect();
            mainWindow.getContentInsets(insets);
            InsetUtils.addInsets(insets, mActivityRecord.getLetterboxInsets());
            mTarget = new RemoteAnimationTarget(task.mTaskId, getMode(),
                    mAdapter.mCapturedLeash, !mActivityRecord.fillsParent(),
                    mainWindow.mWinAnimator.mLastClipRect, insets,
                    mActivityRecord.getPrefixOrderIndex(), mAdapter.mPosition,
                    mAdapter.mStackBounds, task.getWindowConfiguration(), false /*isNotInRecents*/,
                    mThumbnailAdapter != null ? mThumbnailAdapter.mCapturedLeash : null,
                    mStartBounds);
            mTarget = mWindowContainer.createRemoteAnimationTarget(this);
            return mTarget;
        }

        private int getMode() {
            final DisplayContent dc = mActivityRecord.getDisplayContent();
            if (dc.mOpeningApps.contains(mActivityRecord)) {
        int getMode() {
            final DisplayContent dc = mWindowContainer.getDisplayContent();
            if (dc.mOpeningApps.contains(mWindowContainer)) {
                return RemoteAnimationTarget.MODE_OPENING;
            } else if (dc.mChangingApps.contains(mActivityRecord)) {
            } else if (dc.mChangingApps.contains(mWindowContainer)) {
                return RemoteAnimationTarget.MODE_CHANGING;
            } else {
                return RemoteAnimationTarget.MODE_CLOSING;
@@ -398,12 +388,12 @@ class RemoteAnimationController implements DeathRecipient {
        }
    }

    private class RemoteAnimationAdapterWrapper implements AnimationAdapter {
    class RemoteAnimationAdapterWrapper implements AnimationAdapter {
        private final RemoteAnimationRecord mRecord;
        SurfaceControl mCapturedLeash;
        private OnAnimationFinishedCallback mCapturedFinishCallback;
        private final Point mPosition = new Point();
        private final Rect mStackBounds = new Rect();
        final Point mPosition = new Point();
        final Rect mStackBounds = new Rect();

        RemoteAnimationAdapterWrapper(RemoteAnimationRecord record, Point position,
                Rect stackBounds) {
@@ -423,7 +413,7 @@ class RemoteAnimationController implements DeathRecipient {
            ProtoLog.d(WM_DEBUG_REMOTE_ANIMATIONS, "startAnimation");

            // Restore z-layering, position and stack crop until client has a chance to modify it.
            t.setLayer(animationLeash, mRecord.mActivityRecord.getPrefixOrderIndex());
            t.setLayer(animationLeash, mRecord.mWindowContainer.getPrefixOrderIndex());
            if (mRecord.mStartBounds != null) {
                t.setPosition(animationLeash, mRecord.mStartBounds.left, mRecord.mStartBounds.top);
                t.setWindowCrop(animationLeash, mRecord.mStartBounds.width(),
@@ -464,7 +454,7 @@ class RemoteAnimationController implements DeathRecipient {

        @Override
        public void dump(PrintWriter pw, String prefix) {
            pw.print(prefix); pw.print("token="); pw.println(mRecord.mActivityRecord);
            pw.print(prefix); pw.print("container="); pw.println(mRecord.mWindowContainer);
            if (mRecord.mTarget != null) {
                pw.print(prefix); pw.println("Target:");
                mRecord.mTarget.dump(pw, prefix + "  ");
Loading