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

Commit c4ab2cca authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Replace old app transition type to new transition type (3/N)

Removed the old app transition logic.

Bug: 166736358
Test: all existing tests pass

Change-Id: Ia2f99fa354298daf7dbb1758eee51aa8d0d0f9b5
parent 656bfb53
Loading
Loading
Loading
Loading
+12 −36
Original line number Diff line number Diff line
@@ -265,6 +265,12 @@
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityTaskManagerService.java"
    },
    "-1800899273": {
      "message": "applyAnimation: anim=%s transit=%s Callers=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/AppTransition.java"
    },
    "-1792633344": {
      "message": "Register task organizer=%s uid=%d",
      "level": "VERBOSE",
@@ -907,12 +913,6 @@
      "group": "WM_DEBUG_FOCUS",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "-1044506655": {
      "message": "New transit away from wallpaper: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "-1042574499": {
      "message": "Attempted to add Accessibility overlay window with unknown token %s.  Aborting.",
      "level": "WARN",
@@ -979,12 +979,6 @@
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-928291778": {
      "message": "applyAnimation: anim=%s nextAppTransition=%d transit=%s Callers=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
      "at": "com\/android\/server\/wm\/AppTransition.java"
    },
    "-927199900": {
      "message": "Updating global configuration to: %s",
      "level": "INFO",
@@ -1111,12 +1105,6 @@
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-793346159": {
      "message": "New transit into wallpaper: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "-784959154": {
      "message": "Attempted to add private presentation window to a non-private display.  Aborting.",
      "level": "WARN",
@@ -1597,6 +1585,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "-240296576": {
      "message": "handleAppTransitionReady: displayId=%d appTransition={%s} openingApps=[%s] closingApps=[%s] transit=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "-235225312": {
      "message": "Skipping config check for initializing activity: %s",
      "level": "VERBOSE",
@@ -1657,12 +1651,6 @@
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-129722369": {
      "message": "New transit: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "-118786523": {
      "message": "Resume failed; resetting state to %s: %s",
      "level": "VERBOSE",
@@ -3337,12 +3325,6 @@
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/Task.java"
    },
    "1838928243": {
      "message": "handleAppTransitionReady: appTransition=%s openingApps=[%s] closingApps=[%s] transit=%s transitCompat=%s (%b)",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "1853793312": {
      "message": "Notify removed startingWindow %s",
      "level": "VERBOSE",
@@ -3445,12 +3427,6 @@
      "group": "WM_DEBUG_CONFIGURATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "2016061474": {
      "message": "Prepare app transition: transit=%s %s alwaysKeepCurrent=%b displayId=%d Callers=%s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransition.java"
    },
    "2018454757": {
      "message": "WS.removeImmediately: %s Already removed...",
      "level": "VERBOSE",
+3 −7
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
import static android.view.WindowManager.TransitionOldType;

@@ -2609,7 +2608,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                if (DEBUG_VISIBILITY || DEBUG_TRANSITION) {
                    Slog.v(TAG_TRANSITION, "Prepare close transition: finishing " + this);
                }
                mDisplayContent.prepareAppTransitionOld(transit, false);
                mDisplayContent.prepareAppTransition(TRANSIT_CLOSE);

                // When finishing the activity preemptively take the snapshot before the app window
@@ -2693,7 +2691,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    private void prepareActivityHideTransitionAnimation(@TransitionOldType int transit) {
        final DisplayContent dc = mDisplayContent;
        dc.prepareAppTransitionOld(transit, false);
        dc.prepareAppTransition(TRANSIT_CLOSE);
        setVisibility(false);
        dc.executeAppTransition();
@@ -4274,8 +4271,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                displayContent.mClosingApps.add(this);
                mEnteringAnimation = false;
            }
            if (appTransition.getAppTransitionOld() == TRANSIT_OLD_TASK_OPEN_BEHIND
                    || (appTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0) {
            if ((appTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0) {
                // We're launchingBehind, add the launching activity to mOpeningApps.
                final WindowState win = getDisplayContent().findFocusedWindow();
                if (win != null) {
@@ -4298,7 +4294,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    @Override
    boolean applyAnimation(LayoutParams lp, int transit, boolean enter,
    boolean applyAnimation(LayoutParams lp, @TransitionOldType int transit, boolean enter,
            boolean isVoiceInteraction, @Nullable ArrayList<WindowContainer> sources) {
        if (mUseTransferredAnimation) {
            return false;
@@ -6305,7 +6301,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mThumbnail = null;
    }

    public int getTransit() {
    public @TransitionOldType int getTransit() {
        return mTransit;
    }

+4 −7
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OLD_NONE;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_CONFIGURATION;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS;
@@ -95,10 +94,6 @@ import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.Scr
import static com.android.server.am.ActivityManagerServiceDumpProcessesProto.ScreenCompatPackage.PACKAGE;
import static com.android.server.am.EventLogTags.writeBootProgressEnableScreen;
import static com.android.server.am.EventLogTags.writeConfigurationChanged;
import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME;
import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP;
import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ALL;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY;
@@ -117,6 +112,10 @@ import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_RECEI
import static com.android.server.wm.ActivityTaskManagerInternal.ASSIST_KEY_STRUCTURE;
import static com.android.server.wm.ActivityTaskManagerService.H.REPORT_TIME_TRACKER_MSG;
import static com.android.server.wm.ActivityTaskManagerService.UiHandler.DISMISS_DIALOG_UI_MSG;
import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME;
import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP;
import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS;
import static com.android.server.wm.LockTaskController.LOCK_TASK_AUTH_DONT_LOCK;
import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;
import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION;
@@ -164,7 +163,6 @@ import android.app.assist.AssistStructure;
import android.app.servertransaction.ClientTransaction;
import android.app.servertransaction.EnterPipRequestedItem;
import android.app.usage.UsageStatsManagerInternal;
import android.compat.annotation.ChangeId;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.ContentResolver;
@@ -6248,7 +6246,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                }
                final boolean wasTransitionSet = dc.mAppTransition.isTransitionSet();
                if (!wasTransitionSet) {
                    dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, false /* alwaysKeepCurrent */);
                    dc.prepareAppTransition(TRANSIT_NONE);
                }
                mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS);
+10 −89
Original line number Diff line number Diff line
@@ -184,7 +184,6 @@ public class AppTransition implements Dump {
    private final WindowManagerService mService;
    private final DisplayContent mDisplayContent;

    private @TransitionOldType int mNextAppTransitionOld = TRANSIT_OLD_UNSET;
    private @TransitionFlags int mNextAppTransitionFlags = 0;
    private final ArrayList<Integer> mNextAppTransitionRequests = new ArrayList<>();
    private @TransitionOldType int mLastUsedAppTransition = TRANSIT_OLD_UNSET;
@@ -330,46 +329,20 @@ public class AppTransition implements Dump {
    }

    boolean isTransitionSet() {
        return mNextAppTransitionOld != TRANSIT_OLD_UNSET || !mNextAppTransitionRequests.isEmpty();
    }

    // TODO(new-app-tranistion): Remove this after migrating to new app transition system.
    boolean isTransitionOldEqual(@TransitionOldType int transit) {
        return mNextAppTransitionOld == transit;
        return !mNextAppTransitionRequests.isEmpty();
    }

    boolean isUnoccluding() {
        return WindowManagerService.sUseNewAppTransit
                ? mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE)
                : mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
    }

    @TransitionOldType
    int getAppTransitionOld() {
        return mNextAppTransitionOld;
        return mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_UNOCCLUDE);
    }

    boolean transferFrom(AppTransition other) {
        prepareAppTransitionOld(other.getAppTransitionOld(), true /* alwaysKeepCurrent */,
                0 /* flags */, false /* forceOverride */);
        mNextAppTransitionRequests.addAll(other.mNextAppTransitionRequests);
        return prepare();
    }

    private void setAppTransitionOld(@TransitionOldType int transit, int flags) {
        mNextAppTransitionOld = transit;
        mNextAppTransitionFlags |= flags;
        setLastAppTransition(TRANSIT_OLD_UNSET, null, null, null);
        updateBooster();
        if (isTransitionSet()) {
            removeAppTransitionTimeoutCallbacks();
            mHandler.postDelayed(mHandleAppTransitionTimeoutRunnable,
                    APP_TRANSITION_TIMEOUT_MS);
        }
    }

    void setLastAppTransition(int transit, ActivityRecord openingApp, ActivityRecord closingApp,
            ActivityRecord changingApp) {
    void setLastAppTransition(@TransitionOldType int transit, ActivityRecord openingApp,
            ActivityRecord closingApp, ActivityRecord changingApp) {
        mLastUsedAppTransition = transit;
        mLastOpeningApp = "" + openingApp;
        mLastClosingApp = "" + closingApp;
@@ -461,7 +434,6 @@ public class AppTransition implements Dump {
     *         layout pass needs to be done
     */
    int goodToGo(@TransitionOldType int transit, ActivityRecord topOpeningApp) {
        mNextAppTransitionOld = TRANSIT_OLD_UNSET;
        mNextAppTransitionFlags = 0;
        mNextAppTransitionRequests.clear();
        setAppTransitionState(APP_STATE_RUNNING);
@@ -495,9 +467,8 @@ public class AppTransition implements Dump {
    }

    void freeze() {
        final boolean keyguardGoingAway = WindowManagerService.sUseNewAppTransit
                ? mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_GOING_AWAY)
                : isKeyguardGoingAwayTransitOld(mNextAppTransitionOld);
        final boolean keyguardGoingAway = mNextAppTransitionRequests.contains(
                TRANSIT_KEYGUARD_GOING_AWAY);

        // The RemoteAnimationControl didn't register AppTransitionListener and
        // only initialized the finish and timeout callback when goodToGo().
@@ -506,7 +477,6 @@ public class AppTransition implements Dump {
        if (mRemoteAnimationController != null) {
            mRemoteAnimationController.cancelAnimation("freeze");
        }
        setAppTransitionOld(TRANSIT_OLD_UNSET, 0 /* flags */);
        mNextAppTransitionRequests.clear();
        clear();
        setReady();
@@ -529,8 +499,7 @@ public class AppTransition implements Dump {

    private boolean needsBoosting() {
        final boolean recentsAnimRunning = mService.getRecentsAnimationController() != null;
        return mNextAppTransitionOld != TRANSIT_OLD_UNSET
                || !mNextAppTransitionRequests.isEmpty()
        return !mNextAppTransitionRequests.isEmpty()
                || mAppTransitionState == APP_STATE_READY
                || mAppTransitionState == APP_STATE_RUNNING
                || recentsAnimRunning;
@@ -1584,7 +1553,6 @@ public class AppTransition implements Dump {
                && !mNextAppTransitionOverrideRequested
                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE
                && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CLIP_REVEAL
                && mNextAppTransitionOld != TRANSIT_OLD_KEYGUARD_GOING_AWAY
                && !mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_GOING_AWAY);
    }

@@ -1652,9 +1620,8 @@ public class AppTransition implements Dump {
        } else if (transit == TRANSIT_OLD_ACTIVITY_RELAUNCH) {
            a = createRelaunchAnimation(frame, insets);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM,
                    "applyAnimation: anim=%s nextAppTransition=%d transit=%s Callers=%s", a,
                    mNextAppTransitionOld, appTransitionOldToString(transit),
                    Debug.getCallers(3));
                    "applyAnimation: anim=%s transit=%s Callers=%s", a,
                    appTransitionOldToString(transit), Debug.getCallers(3));
        } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM) {
            a = loadAnimationRes(mNextAppTransitionPackage, enter ?
                    mNextAppTransitionEnter : mNextAppTransitionExit);
@@ -1806,10 +1773,7 @@ public class AppTransition implements Dump {
    int getAppStackClipMode() {
        return mNextAppTransitionRequests.contains(TRANSIT_RELAUNCH)
                || mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_GOING_AWAY)
                || mNextAppTransitionOld == TRANSIT_OLD_ACTIVITY_RELAUNCH
                || mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL
                || mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_GOING_AWAY
                || mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER
                ? STACK_CLIP_NONE
                : STACK_CLIP_AFTER_ANIM;
    }
@@ -2009,9 +1973,7 @@ public class AppTransition implements Dump {
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("mNextAppTransition=");
        sb.append(appTransitionOldToString(mNextAppTransitionOld));
        sb.append(", mNextAppTransitionRequests=[");
        sb.append("mNextAppTransitionRequests=[");

        boolean separator = false;
        for (Integer transit : mNextAppTransitionRequests) {
@@ -2301,47 +2263,6 @@ public class AppTransition implements Dump {
        mCurrentUserId = newUserId;
    }

    /**
     * @return true if transition is not running and should not be skipped, false if transition is
     *         already running
     */
    boolean prepareAppTransitionOld(@TransitionOldType int transit, boolean alwaysKeepCurrent,
            @TransitionFlags int flags, boolean forceOverride) {
        if (mService.mAtmService.getTransitionController().getTransitionPlayer() != null) {
            return false;
        }
        ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                "Prepare app transition: transit=%s %s alwaysKeepCurrent=%b displayId=%d "
                        + "Callers=%s",
                appTransitionOldToString(transit), this, alwaysKeepCurrent,
                mDisplayContent.getDisplayId(), Debug.getCallers(5));
        final boolean allowSetCrashing = !isKeyguardTransitOld(mNextAppTransitionOld)
                && transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
        if (forceOverride || isKeyguardTransitOld(transit) || !isTransitionSet()
                || mNextAppTransitionOld == TRANSIT_OLD_NONE || allowSetCrashing) {
            setAppTransitionOld(transit, flags);
        }
        // We never want to change from a Keyguard transit to a non-Keyguard transit, as our logic
        // relies on the fact that we always execute a Keyguard transition after preparing one. We
        // also don't want to change away from a crashing transition.
        else if (!alwaysKeepCurrent && !isKeyguardTransitOld(mNextAppTransitionOld)
                && mNextAppTransitionOld != TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE) {
            if (transit == TRANSIT_OLD_TASK_OPEN && isTransitionOldEqual(TRANSIT_OLD_TASK_CLOSE)) {
                // Opening a new task always supersedes a close for the anim.
                setAppTransitionOld(transit, flags);
            } else if (transit == TRANSIT_OLD_ACTIVITY_OPEN
                    && isTransitionOldEqual(TRANSIT_OLD_ACTIVITY_CLOSE)) {
                // Opening a new activity always supersedes a close for the anim.
                setAppTransitionOld(transit, flags);
            } else if (isTaskTransitOld(transit) && isActivityTransitOld(mNextAppTransitionOld)) {
                // Task animations always supersede activity animations, because if we have both, it
                // usually means that activity transition were just trampoline activities.
                setAppTransitionOld(transit, flags);
            }
        }
        return prepare();
    }

    boolean prepareAppTransition(@TransitionType int transit, @TransitionFlags int flags) {
        if (mService.mAtmService.getTransitionController().getTransitionPlayer() != null) {
            return false;
+8 −161

File changed.

Preview size limit exceeded, changes collapsed.

Loading