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

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

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

- Rename TransitionType to TransitionOldType, and define a new
  TransitionType.
- Calls prepareAppTransition which takes a new TransitionType when app
  transition related event happens.

The TransitionOldType and related logic will eventually removed. Until
migration finishes, we keep both.

Bug: 166736358
Test: Pass existing tests, since no new logic is enabled.

Change-Id: I984f68d5ecfae56fbfe7d91babbfddcf34378f6c
parent da253452
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -140,7 +140,6 @@ interface IWindowManager
     * @displayId The ID of the display where this token should be removed.
     */
    void removeWindowToken(IBinder token, int displayId);
    void prepareAppTransition(int transit, boolean alwaysKeepCurrent);

    /**
     * Sets a singular remote controller of display rotations. There can only be one. The
@@ -180,8 +179,6 @@ interface IWindowManager
    @UnsupportedAppUsage
    void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
            int displayId);
    @UnsupportedAppUsage
    void executeAppTransition();

    /**
      * Used by system ui to report that recents has shown itself.
+11 −10
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package android.view;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;

import android.annotation.Nullable;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration.ActivityType;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.IBinder;
@@ -29,7 +28,7 @@ import android.os.RemoteException;
import android.util.ArraySet;
import android.util.Slog;
import android.util.SparseArray;
import android.view.WindowManager.TransitionType;
import android.view.WindowManager.TransitionOldType;

/**
 * Defines which animation types should be overridden by which remote animation.
@@ -48,13 +47,13 @@ public class RemoteAnimationDefinition implements Parcelable {
    /**
     * Registers a remote animation for a specific transition.
     *
     * @param transition The transition type. Must be one of WindowManager.TRANSIT_* values.
     * @param transition The old transition type. Must be one of WindowManager.TRANSIT_OLD_* values.
     * @param activityTypeFilter The remote animation only runs if an activity with type of this
     *                           parameter is involved in the transition.
     * @param adapter The adapter that described how to run the remote animation.
     */
    @UnsupportedAppUsage
    public void addRemoteAnimation(@TransitionType int transition,
    public void addRemoteAnimation(@TransitionOldType int transition,
            @ActivityType int activityTypeFilter, RemoteAnimationAdapter adapter) {
        mTransitionAnimationMap.put(transition,
                new RemoteAnimationAdapterEntry(adapter, activityTypeFilter));
@@ -64,35 +63,37 @@ public class RemoteAnimationDefinition implements Parcelable {
     * Registers a remote animation for a specific transition without defining an activity type
     * filter.
     *
     * @param transition The transition type. Must be one of WindowManager.TRANSIT_* values.
     * @param transition The old transition type. Must be one of WindowManager.TRANSIT_OLD_* values.
     * @param adapter The adapter that described how to run the remote animation.
     */
    @UnsupportedAppUsage
    public void addRemoteAnimation(@TransitionType int transition, RemoteAnimationAdapter adapter) {
    public void addRemoteAnimation(@TransitionOldType int transition,
            RemoteAnimationAdapter adapter) {
        addRemoteAnimation(transition, ACTIVITY_TYPE_UNDEFINED, adapter);
    }

    /**
     * Checks whether a remote animation for specific transition is defined.
     *
     * @param transition The transition type. Must be one of WindowManager.TRANSIT_* values.
     * @param transition The old transition type. Must be one of WindowManager.TRANSIT_OLD_* values.
     * @param activityTypes The set of activity types of activities that are involved in the
     *                      transition. Will be used for filtering.
     * @return Whether this definition has defined a remote animation for the specified transition.
     */
    public boolean hasTransition(@TransitionType int transition, ArraySet<Integer> activityTypes) {
    public boolean hasTransition(@TransitionOldType int transition,
            ArraySet<Integer> activityTypes) {
        return getAdapter(transition, activityTypes) != null;
    }

    /**
     * Retrieves the remote animation for a specific transition.
     *
     * @param transition The transition type. Must be one of WindowManager.TRANSIT_* values.
     * @param transition The old transition type. Must be one of WindowManager.TRANSIT_OLD_* values.
     * @param activityTypes The set of activity types of activities that are involved in the
     *                      transition. Will be used for filtering.
     * @return The remote animation adapter for the specified transition.
     */
    public @Nullable RemoteAnimationAdapter getAdapter(@TransitionType int transition,
    public @Nullable RemoteAnimationAdapter getAdapter(@TransitionOldType int transition,
            ArraySet<Integer> activityTypes) {
        final RemoteAnimationAdapterEntry entry = mTransitionAnimationMap.get(transition);
        if (entry == null) {
+87 −41
Original line number Diff line number Diff line
@@ -135,168 +135,207 @@ public interface WindowManager extends ViewManager {
     * Not set up for a transition.
     * @hide
     */
    int TRANSIT_UNSET = -1;
    int TRANSIT_OLD_UNSET = -1;

    /**
     * No animation for transition.
     * @hide
     */
    int TRANSIT_NONE = 0;
    int TRANSIT_OLD_NONE = 0;

    /**
     * A window in a new activity is being opened on top of an existing one in the same task.
     * @hide
     */
    int TRANSIT_ACTIVITY_OPEN = 6;
    int TRANSIT_OLD_ACTIVITY_OPEN = 6;

    /**
     * The window in the top-most activity is being closed to reveal the previous activity in the
     * same task.
     * @hide
     */
    int TRANSIT_ACTIVITY_CLOSE = 7;
    int TRANSIT_OLD_ACTIVITY_CLOSE = 7;

    /**
     * A window in a new task is being opened on top of an existing one in another activity's task.
     * @hide
     */
    int TRANSIT_TASK_OPEN = 8;
    int TRANSIT_OLD_TASK_OPEN = 8;

    /**
     * A window in the top-most activity is being closed to reveal the previous activity in a
     * different task.
     * @hide
     */
    int TRANSIT_TASK_CLOSE = 9;
    int TRANSIT_OLD_TASK_CLOSE = 9;

    /**
     * A window in an existing task is being displayed on top of an existing one in another
     * activity's task.
     * @hide
     */
    int TRANSIT_TASK_TO_FRONT = 10;
    int TRANSIT_OLD_TASK_TO_FRONT = 10;

    /**
     * A window in an existing task is being put below all other tasks.
     * @hide
     */
    int TRANSIT_TASK_TO_BACK = 11;
    int TRANSIT_OLD_TASK_TO_BACK = 11;

    /**
     * A window in a new activity that doesn't have a wallpaper is being opened on top of one that
     * does, effectively closing the wallpaper.
     * @hide
     */
    int TRANSIT_WALLPAPER_CLOSE = 12;
    int TRANSIT_OLD_WALLPAPER_CLOSE = 12;

    /**
     * A window in a new activity that does have a wallpaper is being opened on one that didn't,
     * effectively opening the wallpaper.
     * @hide
     */
    int TRANSIT_WALLPAPER_OPEN = 13;
    int TRANSIT_OLD_WALLPAPER_OPEN = 13;

    /**
     * A window in a new activity is being opened on top of an existing one, and both are on top
     * of the wallpaper.
     * @hide
     */
    int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
    int TRANSIT_OLD_WALLPAPER_INTRA_OPEN = 14;

    /**
     * The window in the top-most activity is being closed to reveal the previous activity, and
     * both are on top of the wallpaper.
     * @hide
     */
    int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
    int TRANSIT_OLD_WALLPAPER_INTRA_CLOSE = 15;

    /**
     * A window in a new task is being opened behind an existing one in another activity's task.
     * The new window will show briefly and then be gone.
     * @hide
     */
    int TRANSIT_TASK_OPEN_BEHIND = 16;
    int TRANSIT_OLD_TASK_OPEN_BEHIND = 16;

    /**
     * An activity is being relaunched (e.g. due to configuration change).
     * @hide
     */
    int TRANSIT_ACTIVITY_RELAUNCH = 18;
    int TRANSIT_OLD_ACTIVITY_RELAUNCH = 18;

    /**
     * Keyguard is going away.
     * @hide
     */
    int TRANSIT_KEYGUARD_GOING_AWAY = 20;
    int TRANSIT_OLD_KEYGUARD_GOING_AWAY = 20;

    /**
     * Keyguard is going away with showing an activity behind that requests wallpaper.
     * @hide
     */
    int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
    int TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;

    /**
     * Keyguard is being occluded.
     * @hide
     */
    int TRANSIT_KEYGUARD_OCCLUDE = 22;
    int TRANSIT_OLD_KEYGUARD_OCCLUDE = 22;

    /**
     * Keyguard is being unoccluded.
     * @hide
     */
    int TRANSIT_KEYGUARD_UNOCCLUDE = 23;
    int TRANSIT_OLD_KEYGUARD_UNOCCLUDE = 23;

    /**
     * A translucent activity is being opened.
     * @hide
     */
    int TRANSIT_TRANSLUCENT_ACTIVITY_OPEN = 24;
    int TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN = 24;

    /**
     * A translucent activity is being closed.
     * @hide
     */
    int TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE = 25;
    int TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE = 25;

    /**
     * A crashing activity is being closed.
     * @hide
     */
    int TRANSIT_CRASHING_ACTIVITY_CLOSE = 26;
    int TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE = 26;

    /**
     * A task is changing windowing modes
     * @hide
     */
    int TRANSIT_TASK_CHANGE_WINDOWING_MODE = 27;
    int TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE = 27;

    /**
     * @hide
     */
    @IntDef(prefix = { "TRANSIT_OLD_" }, value = {
            TRANSIT_OLD_UNSET,
            TRANSIT_OLD_NONE,
            TRANSIT_OLD_ACTIVITY_OPEN,
            TRANSIT_OLD_ACTIVITY_CLOSE,
            TRANSIT_OLD_TASK_OPEN,
            TRANSIT_OLD_TASK_CLOSE,
            TRANSIT_OLD_TASK_TO_FRONT,
            TRANSIT_OLD_TASK_TO_BACK,
            TRANSIT_OLD_WALLPAPER_CLOSE,
            TRANSIT_OLD_WALLPAPER_OPEN,
            TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
            TRANSIT_OLD_WALLPAPER_INTRA_CLOSE,
            TRANSIT_OLD_TASK_OPEN_BEHIND,
            TRANSIT_OLD_ACTIVITY_RELAUNCH,
            TRANSIT_OLD_KEYGUARD_GOING_AWAY,
            TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
            TRANSIT_OLD_KEYGUARD_OCCLUDE,
            TRANSIT_OLD_KEYGUARD_UNOCCLUDE,
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionOldType {}

    /** @hide */
    int TRANSIT_NONE = 0;
    /** @hide */
    int TRANSIT_OPEN = 1;
    /** @hide */
    int TRANSIT_CLOSE = 2;
    /** @hide */
    int TRANSIT_TO_FRONT = 3;
    /** @hide */
    int TRANSIT_TO_BACK = 4;
    /** @hide */
    int TRANSIT_RELAUNCH = 5;
    /** @hide */
    int TRANSIT_CHANGE_WINDOWING_MODE = 6;
    /** @hide */
    int TRANSIT_KEYGUARD_GOING_AWAY = 7;
    /** @hide */
    int TRANSIT_KEYGUARD_OCCLUDE = 8;
    /** @hide */
    int TRANSIT_KEYGUARD_UNOCCLUDE = 9;

    /**
     * @hide
     */
    @IntDef(prefix = { "TRANSIT_" }, value = {
            TRANSIT_UNSET,
            TRANSIT_NONE,
            TRANSIT_ACTIVITY_OPEN,
            TRANSIT_ACTIVITY_CLOSE,
            TRANSIT_TASK_OPEN,
            TRANSIT_TASK_CLOSE,
            TRANSIT_TASK_TO_FRONT,
            TRANSIT_TASK_TO_BACK,
            TRANSIT_WALLPAPER_CLOSE,
            TRANSIT_WALLPAPER_OPEN,
            TRANSIT_WALLPAPER_INTRA_OPEN,
            TRANSIT_WALLPAPER_INTRA_CLOSE,
            TRANSIT_TASK_OPEN_BEHIND,
            TRANSIT_ACTIVITY_RELAUNCH,
            TRANSIT_OPEN,
            TRANSIT_CLOSE,
            TRANSIT_TO_FRONT,
            TRANSIT_TO_BACK,
            TRANSIT_RELAUNCH,
            TRANSIT_CHANGE_WINDOWING_MODE,
            TRANSIT_KEYGUARD_GOING_AWAY,
            TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER,
            TRANSIT_KEYGUARD_OCCLUDE,
            TRANSIT_KEYGUARD_UNOCCLUDE,
            TRANSIT_TRANSLUCENT_ACTIVITY_OPEN,
            TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE,
            TRANSIT_CRASHING_ACTIVITY_CLOSE,
            TRANSIT_TASK_CHANGE_WINDOWING_MODE
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionType {}
@@ -325,6 +364,12 @@ public interface WindowManager extends ViewManager {
     */
    int TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION = 0x8;

    /**
     * Transition flag: App is crashed.
     * @hide
     */
    int TRANSIT_FLAG_APP_CRASHED = 0x10;

    /**
     * @hide
     */
@@ -332,7 +377,8 @@ public interface WindowManager extends ViewManager {
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE,
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION,
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER,
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION
            TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION,
            TRANSIT_FLAG_APP_CRASHED
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface TransitionFlags {}
+2 −2
Original line number Diff line number Diff line
@@ -63,11 +63,11 @@ public final class TransitionInfo implements Parcelable {
    })
    public @interface TransitionMode {}

    private final @WindowManager.TransitionType int mType;
    private final @WindowManager.TransitionOldType int mType;
    private final ArrayList<Change> mChanges = new ArrayList<>();

    /** @hide */
    public TransitionInfo(@WindowManager.TransitionType int type) {
    public TransitionInfo(@WindowManager.TransitionOldType int type) {
        mType = type;
    }

+5 −5
Original line number Diff line number Diff line
@@ -109,13 +109,13 @@ public class Transitions extends ITransitionPlayer.Stub {
        mAnimExecutor.execute(va::start);
    }

    private static boolean isOpeningType(@WindowManager.TransitionType int legacyType) {
    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_TASK_OPEN
                || legacyType == WindowManager.TRANSIT_TASK_TO_FRONT
                || legacyType == WindowManager.TRANSIT_TASK_OPEN_BEHIND
                || legacyType == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
        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;
    }

    @Override
Loading