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

Commit 738ba560 authored by Evan Rosky's avatar Evan Rosky
Browse files

Relocate transition collection around lifecycle events (1/N)

Previously was just using whatever the legacy transition system
used. However, that system would wait too late (until after
round-trips to the client) in order to prepare some transitions.
Since the new transitions utilize "snapshots", they need to
collect earlier in the lifecycle to work properly.

This first CL deals mostly with activity start/finish and
task to-front/to-back. It also adds some utilities like the
ability to abort a transition (needed because activitystarter
works this way) and the ability to un-ready a transition/
sync transaction to enable trampolines.

This also switches the transit types to the new constants.

Bug: 169035022
Test: Existing tests (TransitionTests) pass
Change-Id: I05f3a2e8e27ccaed7077d648daf033aeabc333f9
parent 24b362f6
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -170,14 +170,14 @@ public final class TransitionInfo implements Parcelable {
        private final Rect mStartBounds = new Rect();
        private final Rect mEndBounds = new Rect();

        public Change(@NonNull WindowContainerToken container, @NonNull SurfaceControl leash) {
        public Change(@Nullable WindowContainerToken container, @NonNull SurfaceControl leash) {
            mContainer = container;
            mLeash = leash;
        }

        private Change(Parcel in) {
            mContainer = WindowContainerToken.CREATOR.createFromParcel(in);
            mParent = in.readParcelable(WindowContainerToken.class.getClassLoader());
            mContainer = in.readTypedObject(WindowContainerToken.CREATOR);
            mParent = in.readTypedObject(WindowContainerToken.CREATOR);
            mLeash = new SurfaceControl();
            mLeash.readFromParcel(in);
            mMode = in.readInt();
@@ -205,8 +205,8 @@ public final class TransitionInfo implements Parcelable {
            mEndBounds.set(rect);
        }

        /** @return the container that is changing */
        @NonNull
        /** @return the container that is changing. May be null if non-remotable (eg. activity) */
        @Nullable
        public WindowContainerToken getContainer() {
            return mContainer;
        }
@@ -252,8 +252,8 @@ public final class TransitionInfo implements Parcelable {
        @Override
        /** @hide */
        public void writeToParcel(@NonNull Parcel dest, int flags) {
            mContainer.writeToParcel(dest, flags);
            dest.writeParcelable(mParent, 0);
            dest.writeTypedObject(mContainer, flags);
            dest.writeTypedObject(mParent, flags);
            mLeash.writeToParcel(dest, flags);
            dest.writeInt(mMode);
            mStartBounds.writeToParcel(dest, flags);
+6 −6
Original line number Diff line number Diff line
@@ -1027,6 +1027,12 @@
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/ResetTargetTaskHelper.java"
    },
    "-874888131": {
      "message": "Set transition ready=%b %d",
      "level": "VERBOSE",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/Transition.java"
    },
    "-874446906": {
      "message": "showBootMessage: msg=%s always=%b mAllowBootMessages=%b mShowingBootMessages=%b mSystemBooted=%b. %s",
      "level": "INFO",
@@ -2509,12 +2515,6 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowToken.java"
    },
    "849147756": {
      "message": "Finish collecting in transition %d",
      "level": "VERBOSE",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/Transition.java"
    },
    "853091290": {
      "message": "Moved stack=%s behind stack=%s",
      "level": "DEBUG",
+4 −7
Original line number Diff line number Diff line
@@ -109,13 +109,10 @@ public class Transitions extends ITransitionPlayer.Stub {
        mAnimExecutor.execute(va::start);
    }

    private static boolean isOpeningType(@WindowManager.TransitionOldType int legacyType) {
        // TODO(shell-transitions): consider providing and using z-order vs the global type for
        //                          this determination.
        return legacyType == WindowManager.TRANSIT_OLD_TASK_OPEN
                || legacyType == WindowManager.TRANSIT_OLD_TASK_TO_FRONT
                || legacyType == WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND
                || legacyType == WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
    private static boolean isOpeningType(@WindowManager.TransitionType int type) {
        return type == WindowManager.TRANSIT_OPEN
                || type == WindowManager.TRANSIT_TO_FRONT
                || type == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -2983,6 +2983,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (stopped) {
            clearOptionsLocked();
        }
        mAtmService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, this);
    }

    /**
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ import static android.os.PowerManager.PARTIAL_WAKE_LOCK;
import static android.os.Process.INVALID_UID;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_TO_FRONT;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_STATES;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_TASKS;
@@ -1349,6 +1351,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
            mUserLeaving = true;
        }

        mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_TO_FRONT, task);
        reason = reason + " findTaskToMoveToFront";
        boolean reparented = false;
        if (task.isResizeable() && canUseActivityOptionsLaunchBounds(options)) {
@@ -1516,6 +1519,7 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
            // Prevent recursion.
            return;
        }
        mService.getTransitionController().requestTransitionIfNeeded(TRANSIT_CLOSE, task);
        task.mInRemoveTask = true;
        try {
            task.performClearTask(reason);
Loading