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

Commit 1e2b8593 authored by Issei Suzuki's avatar Issei Suzuki Committed by Android (Google) Code Review
Browse files

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

parents 91bd9307 aa5118f2
Loading
Loading
Loading
Loading
+0 −3
Original line number Original line Diff line number Diff line
@@ -140,7 +140,6 @@ interface IWindowManager
     * @displayId The ID of the display where this token should be removed.
     * @displayId The ID of the display where this token should be removed.
     */
     */
    void removeWindowToken(IBinder token, int displayId);
    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
     * Sets a singular remote controller of display rotations. There can only be one. The
@@ -180,8 +179,6 @@ interface IWindowManager
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
    void overridePendingAppTransitionRemote(in RemoteAnimationAdapter remoteAnimationAdapter,
            int displayId);
            int displayId);
    @UnsupportedAppUsage
    void executeAppTransition();


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


import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.WindowConfiguration;
import android.app.WindowConfiguration.ActivityType;
import android.app.WindowConfiguration.ActivityType;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.IBinder;
import android.os.IBinder;
@@ -29,7 +28,7 @@ import android.os.RemoteException;
import android.util.ArraySet;
import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseArray;
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.
 * 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.
     * 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
     * @param activityTypeFilter The remote animation only runs if an activity with type of this
     *                           parameter is involved in the transition.
     *                           parameter is involved in the transition.
     * @param adapter The adapter that described how to run the remote animation.
     * @param adapter The adapter that described how to run the remote animation.
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public void addRemoteAnimation(@TransitionType int transition,
    public void addRemoteAnimation(@TransitionOldType int transition,
            @ActivityType int activityTypeFilter, RemoteAnimationAdapter adapter) {
            @ActivityType int activityTypeFilter, RemoteAnimationAdapter adapter) {
        mTransitionAnimationMap.put(transition,
        mTransitionAnimationMap.put(transition,
                new RemoteAnimationAdapterEntry(adapter, activityTypeFilter));
                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
     * Registers a remote animation for a specific transition without defining an activity type
     * filter.
     * 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.
     * @param adapter The adapter that described how to run the remote animation.
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public void addRemoteAnimation(@TransitionType int transition, RemoteAnimationAdapter adapter) {
    public void addRemoteAnimation(@TransitionOldType int transition,
            RemoteAnimationAdapter adapter) {
        addRemoteAnimation(transition, ACTIVITY_TYPE_UNDEFINED, adapter);
        addRemoteAnimation(transition, ACTIVITY_TYPE_UNDEFINED, adapter);
    }
    }


    /**
    /**
     * Checks whether a remote animation for specific transition is defined.
     * 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
     * @param activityTypes The set of activity types of activities that are involved in the
     *                      transition. Will be used for filtering.
     *                      transition. Will be used for filtering.
     * @return Whether this definition has defined a remote animation for the specified transition.
     * @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;
        return getAdapter(transition, activityTypes) != null;
    }
    }


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


    /**
    /**
     * No animation for transition.
     * No animation for transition.
     * @hide
     * @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.
     * A window in a new activity is being opened on top of an existing one in the same task.
     * @hide
     * @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
     * The window in the top-most activity is being closed to reveal the previous activity in the
     * same task.
     * same task.
     * @hide
     * @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.
     * A window in a new task is being opened on top of an existing one in another activity's task.
     * @hide
     * @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
     * A window in the top-most activity is being closed to reveal the previous activity in a
     * different task.
     * different task.
     * @hide
     * @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
     * A window in an existing task is being displayed on top of an existing one in another
     * activity's task.
     * activity's task.
     * @hide
     * @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.
     * A window in an existing task is being put below all other tasks.
     * @hide
     * @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
     * 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.
     * does, effectively closing the wallpaper.
     * @hide
     * @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,
     * A window in a new activity that does have a wallpaper is being opened on one that didn't,
     * effectively opening the wallpaper.
     * effectively opening the wallpaper.
     * @hide
     * @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
     * A window in a new activity is being opened on top of an existing one, and both are on top
     * of the wallpaper.
     * of the wallpaper.
     * @hide
     * @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
     * The window in the top-most activity is being closed to reveal the previous activity, and
     * both are on top of the wallpaper.
     * both are on top of the wallpaper.
     * @hide
     * @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.
     * 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.
     * The new window will show briefly and then be gone.
     * @hide
     * @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).
     * An activity is being relaunched (e.g. due to configuration change).
     * @hide
     * @hide
     */
     */
    int TRANSIT_ACTIVITY_RELAUNCH = 18;
    int TRANSIT_OLD_ACTIVITY_RELAUNCH = 18;


    /**
    /**
     * Keyguard is going away.
     * Keyguard is going away.
     * @hide
     * @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.
     * Keyguard is going away with showing an activity behind that requests wallpaper.
     * @hide
     * @hide
     */
     */
    int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;
    int TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER = 21;


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


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


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


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


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


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


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

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


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


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


+5 −5
Original line number Original line Diff line number Diff line
@@ -109,13 +109,13 @@ public class Transitions extends ITransitionPlayer.Stub {
        mAnimExecutor.execute(va::start);
        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
        // TODO(shell-transitions): consider providing and using z-order vs the global type for
        //                          this determination.
        //                          this determination.
        return legacyType == WindowManager.TRANSIT_TASK_OPEN
        return legacyType == WindowManager.TRANSIT_OLD_TASK_OPEN
                || legacyType == WindowManager.TRANSIT_TASK_TO_FRONT
                || legacyType == WindowManager.TRANSIT_OLD_TASK_TO_FRONT
                || legacyType == WindowManager.TRANSIT_TASK_OPEN_BEHIND
                || legacyType == WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND
                || legacyType == WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
                || legacyType == WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
    }
    }


    @Override
    @Override
Loading