diff options
32 files changed, 793 insertions, 529 deletions
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index f572eb91ef34..43a8992aa74e 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -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. diff --git a/core/java/android/view/RemoteAnimationDefinition.java b/core/java/android/view/RemoteAnimationDefinition.java index 5a8ac544e27e..a5ff19ee3312 100644 --- a/core/java/android/view/RemoteAnimationDefinition.java +++ b/core/java/android/view/RemoteAnimationDefinition.java @@ -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) { diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 9336872f29d8..565f6d8df057 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -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 {} @@ -326,13 +365,20 @@ 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 */ @IntDef(flag = true, prefix = { "TRANSIT_FLAG_" }, value = { 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 {} diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 34d1d4e8699d..50174dfd8899 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -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; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java index 36e49d9fd770..04be3b70fc65 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/Transitions.java @@ -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 diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java index 5b41d5f90975..d3066b4d43d4 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/WindowManagerWrapper.java @@ -39,27 +39,29 @@ public class WindowManagerWrapper { private static final String TAG = "WindowManagerWrapper"; - public static final int TRANSIT_UNSET = WindowManager.TRANSIT_UNSET; - public static final int TRANSIT_NONE = WindowManager.TRANSIT_NONE; - public static final int TRANSIT_ACTIVITY_OPEN = WindowManager.TRANSIT_ACTIVITY_OPEN; - public static final int TRANSIT_ACTIVITY_CLOSE = WindowManager.TRANSIT_ACTIVITY_CLOSE; - public static final int TRANSIT_TASK_OPEN = WindowManager.TRANSIT_TASK_OPEN; - public static final int TRANSIT_TASK_CLOSE = WindowManager.TRANSIT_TASK_CLOSE; - public static final int TRANSIT_TASK_TO_FRONT = WindowManager.TRANSIT_TASK_TO_FRONT; - public static final int TRANSIT_TASK_TO_BACK = WindowManager.TRANSIT_TASK_TO_BACK; - public static final int TRANSIT_WALLPAPER_CLOSE = WindowManager.TRANSIT_WALLPAPER_CLOSE; - public static final int TRANSIT_WALLPAPER_OPEN = WindowManager.TRANSIT_WALLPAPER_OPEN; + public static final int TRANSIT_UNSET = WindowManager.TRANSIT_OLD_UNSET; + public static final int TRANSIT_NONE = WindowManager.TRANSIT_OLD_NONE; + public static final int TRANSIT_ACTIVITY_OPEN = WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; + public static final int TRANSIT_ACTIVITY_CLOSE = WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE; + public static final int TRANSIT_TASK_OPEN = WindowManager.TRANSIT_OLD_TASK_OPEN; + public static final int TRANSIT_TASK_CLOSE = WindowManager.TRANSIT_OLD_TASK_CLOSE; + public static final int TRANSIT_TASK_TO_FRONT = WindowManager.TRANSIT_OLD_TASK_TO_FRONT; + public static final int TRANSIT_TASK_TO_BACK = WindowManager.TRANSIT_OLD_TASK_TO_BACK; + public static final int TRANSIT_WALLPAPER_CLOSE = WindowManager.TRANSIT_OLD_WALLPAPER_CLOSE; + public static final int TRANSIT_WALLPAPER_OPEN = WindowManager.TRANSIT_OLD_WALLPAPER_OPEN; public static final int TRANSIT_WALLPAPER_INTRA_OPEN = - WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN; + WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN; public static final int TRANSIT_WALLPAPER_INTRA_CLOSE = - WindowManager.TRANSIT_WALLPAPER_INTRA_CLOSE; - public static final int TRANSIT_TASK_OPEN_BEHIND = WindowManager.TRANSIT_TASK_OPEN_BEHIND; - public static final int TRANSIT_ACTIVITY_RELAUNCH = WindowManager.TRANSIT_ACTIVITY_RELAUNCH; - public static final int TRANSIT_KEYGUARD_GOING_AWAY = WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; + WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_CLOSE; + public static final int TRANSIT_TASK_OPEN_BEHIND = WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND; + public static final int TRANSIT_ACTIVITY_RELAUNCH = WindowManager.TRANSIT_OLD_ACTIVITY_RELAUNCH; + public static final int TRANSIT_KEYGUARD_GOING_AWAY = + WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; public static final int TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER = - WindowManager.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; - public static final int TRANSIT_KEYGUARD_OCCLUDE = WindowManager.TRANSIT_KEYGUARD_OCCLUDE; - public static final int TRANSIT_KEYGUARD_UNOCCLUDE = WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; + WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; + public static final int TRANSIT_KEYGUARD_OCCLUDE = WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE; + public static final int TRANSIT_KEYGUARD_UNOCCLUDE = + WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE; public static final int NAV_BAR_POS_INVALID = NAV_BAR_INVALID; public static final int NAV_BAR_POS_LEFT = NAV_BAR_LEFT; diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java index 4c2d0d08cd4e..9e211672539c 100644 --- a/services/core/java/com/android/server/wm/AccessibilityController.java +++ b/services/core/java/com/android/server/wm/AccessibilityController.java @@ -489,18 +489,18 @@ final class AccessibilityController { public void onAppWindowTransitionLocked(int displayId, int transition) { if (DEBUG_WINDOW_TRANSITIONS) { Slog.i(LOG_TAG, "Window transition: " - + AppTransition.appTransitionToString(transition) + + AppTransition.appTransitionOldToString(transition) + " displayId: " + displayId); } final boolean magnifying = mMagnifedViewport.isMagnifyingLocked(); if (magnifying) { switch (transition) { - case WindowManager.TRANSIT_ACTIVITY_OPEN: - case WindowManager.TRANSIT_TASK_OPEN: - case WindowManager.TRANSIT_TASK_TO_FRONT: - case WindowManager.TRANSIT_WALLPAPER_OPEN: - case WindowManager.TRANSIT_WALLPAPER_CLOSE: - case WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN: { + case WindowManager.TRANSIT_OLD_ACTIVITY_OPEN: + case WindowManager.TRANSIT_OLD_TASK_OPEN: + case WindowManager.TRANSIT_OLD_TASK_TO_FRONT: + case WindowManager.TRANSIT_OLD_WALLPAPER_OPEN: + case WindowManager.TRANSIT_OLD_WALLPAPER_CLOSE: + case WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN: { mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_USER_CONTEXT_CHANGED); } } @@ -510,7 +510,7 @@ final class AccessibilityController { public void onWindowTransitionLocked(WindowState windowState, int transition) { if (DEBUG_WINDOW_TRANSITIONS) { Slog.i(LOG_TAG, "Window transition: " - + AppTransition.appTransitionToString(transition) + + AppTransition.appTransitionOldToString(transition) + " displayId: " + windowState.getDisplayId()); } final boolean magnifying = mMagnifedViewport.isMagnifyingLocked(); diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 86578cc69644..e59b4ddd1fb5 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -102,10 +102,12 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND; -import static android.view.WindowManager.TRANSIT_UNSET; +import static android.view.WindowManager.TRANSIT_CLOSE; +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; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ADD_REMOVE; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS; @@ -1314,7 +1316,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (prevDc.mOpeningApps.remove(this)) { // Transfer opening transition to new display. mDisplayContent.mOpeningApps.add(this); - mDisplayContent.prepareAppTransition(prevDc.mAppTransition.getAppTransition(), true); + mDisplayContent.transferAppTransitionFrom(prevDc); mDisplayContent.executeAppTransition(); } @@ -2575,7 +2577,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean endTask = task.getActivityBelow(this) == null && !task.isClearingToReuseTask(); - final int transit = endTask ? TRANSIT_TASK_CLOSE : TRANSIT_ACTIVITY_CLOSE; + final int transit = endTask ? TRANSIT_OLD_TASK_CLOSE : TRANSIT_OLD_ACTIVITY_CLOSE; if (isState(RESUMED)) { if (endTask) { mAtmService.getTaskChangeNotificationController().notifyTaskRemovalStarted( @@ -2588,7 +2590,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (DEBUG_VISIBILITY || DEBUG_TRANSITION) { Slog.v(TAG_TRANSITION, "Prepare close transition: finishing " + this); } - mDisplayContent.prepareAppTransition(transit, false); + mDisplayContent.prepareAppTransitionOld(transit, false); + mDisplayContent.prepareAppTransition(TRANSIT_CLOSE); // When finishing the activity preemptively take the snapshot before the app window // is marked as hidden and any configuration changes take place @@ -2659,15 +2662,16 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } - private void prepareActivityHideTransitionAnimationIfOvarlay(int transit) { + private void prepareActivityHideTransitionAnimationIfOvarlay(@TransitionOldType int transit) { if (mTaskOverlay) { prepareActivityHideTransitionAnimation(transit); } } - private void prepareActivityHideTransitionAnimation(int transit) { + private void prepareActivityHideTransitionAnimation(@TransitionOldType int transit) { final DisplayContent dc = mDisplayContent; - dc.prepareAppTransition(transit, false); + dc.prepareAppTransitionOld(transit, false); + dc.prepareAppTransition(TRANSIT_CLOSE); setVisibility(false); dc.executeAppTransition(); } @@ -4218,6 +4222,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Note that we ignore display frozen since we want the opening / closing transition type // can be updated correctly even display frozen, and it's safe since in applyAnimation will // still check DC#okToAnimate again if the transition animation is fine to apply. + // TODO(new-app-transition): Rewrite this logic using WM Shell. final boolean recentsAnimating = isAnimating(PARENTS, ANIMATION_TYPE_RECENTS); if (okToAnimate(true /* ignoreFrozen */) && (appTransition.isTransitionSet() || (recentsAnimating && !isActivityTypeHome()))) { @@ -4228,7 +4233,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A displayContent.mClosingApps.add(this); mEnteringAnimation = false; } - if (appTransition.getAppTransition() == TRANSIT_TASK_OPEN_BEHIND) { + if (appTransition.getAppTransitionOld() == TRANSIT_OLD_TASK_OPEN_BEHIND) { // We're launchingBehind, add the launching activity to mOpeningApps. final WindowState win = getDisplayContent().findFocusedWindow(); if (win != null) { @@ -6197,7 +6202,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A super.onAnimationFinished(type, anim); Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "AR#onAnimationFinished"); - mTransit = TRANSIT_UNSET; + mTransit = TRANSIT_OLD_UNSET; mTransitFlags = 0; mNeedsAnimationBoundsLayer = false; diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 51f7d015e548..0b8f518b9d51 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -65,6 +65,7 @@ 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; @@ -6183,10 +6184,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (dc == null) { return; } - final boolean wasTransitionSet = - dc.mAppTransition.getAppTransition() != TRANSIT_NONE; + final boolean wasTransitionSet = dc.mAppTransition.isTransitionSet(); if (!wasTransitionSet) { - dc.prepareAppTransition(TRANSIT_NONE, false /* alwaysKeepCurrent */); + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, false /* alwaysKeepCurrent */); + dc.prepareAppTransition(TRANSIT_NONE); } mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java index 26c701b99150..12c2c0e54ce7 100644 --- a/services/core/java/com/android/server/wm/AppTransition.java +++ b/services/core/java/com/android/server/wm/AppTransition.java @@ -17,31 +17,43 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams; -import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_ACTIVITY_RELAUNCH; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_CLOSE; +import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; +import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManager.TRANSIT_NONE; -import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND; -import static android.view.WindowManager.TRANSIT_TASK_TO_BACK; -import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT; -import static android.view.WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_UNSET; -import static android.view.WindowManager.TRANSIT_WALLPAPER_CLOSE; -import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_CLOSE; -import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN; -import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_RELAUNCH; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE; +import static android.view.WindowManager.TRANSIT_OLD_NONE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_UNSET; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_OPEN; +import static android.view.WindowManager.TRANSIT_OPEN; +import static android.view.WindowManager.TRANSIT_RELAUNCH; +import static android.view.WindowManager.TRANSIT_TO_BACK; +import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation; import static com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation; @@ -104,6 +116,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.util.ArraySet; +import android.util.Pair; import android.util.Slog; import android.util.SparseArray; import android.util.proto.ProtoOutputStream; @@ -111,6 +124,7 @@ import android.view.AppTransitionAnimationSpec; import android.view.IAppTransitionAnimationSpecsFuture; import android.view.RemoteAnimationAdapter; import android.view.WindowManager.TransitionFlags; +import android.view.WindowManager.TransitionOldType; import android.view.WindowManager.TransitionType; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; @@ -170,9 +184,10 @@ public class AppTransition implements Dump { private final WindowManagerService mService; private final DisplayContent mDisplayContent; - private @TransitionType int mNextAppTransition = TRANSIT_UNSET; + private @TransitionOldType int mNextAppTransitionOld = TRANSIT_OLD_UNSET; private @TransitionFlags int mNextAppTransitionFlags = 0; - private int mLastUsedAppTransition = TRANSIT_UNSET; + private final ArrayList<Integer> mNextAppTransitionRequests = new ArrayList<>(); + private @TransitionOldType int mLastUsedAppTransition = TRANSIT_OLD_UNSET; private String mLastOpeningApp; private String mLastClosingApp; private String mLastChangingApp; @@ -315,21 +330,36 @@ public class AppTransition implements Dump { } boolean isTransitionSet() { - return mNextAppTransition != TRANSIT_UNSET; + return mNextAppTransitionOld != TRANSIT_OLD_UNSET || !mNextAppTransitionRequests.isEmpty(); } - boolean isTransitionEqual(@TransitionType int transit) { - return mNextAppTransition == transit; + // TODO(new-app-tranistion): Remove this after migrating to new app transition system. + boolean isTransitionOldEqual(@TransitionOldType int transit) { + return mNextAppTransitionOld == transit; } - @TransitionType int getAppTransition() { - return mNextAppTransition; + boolean isUnoccluding() { + return WindowManagerService.sUseNewAppTransit + ? mNextAppTransitionRequests.contains(TRANSIT_OLD_KEYGUARD_UNOCCLUDE) + : mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_UNOCCLUDE; + } + + @TransitionOldType + int getAppTransitionOld() { + return mNextAppTransitionOld; } - private void setAppTransition(int transit, int flags) { - mNextAppTransition = transit; + 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_UNSET, null, null, null); + setLastAppTransition(TRANSIT_OLD_UNSET, null, null, null); updateBooster(); if (isTransitionSet()) { removeAppTransitionTimeoutCallbacks(); @@ -431,8 +461,9 @@ public class AppTransition implements Dump { * layout pass needs to be done */ int goodToGo(int transit, ActivityRecord topOpeningApp, ArraySet<ActivityRecord> openingApps) { - mNextAppTransition = TRANSIT_UNSET; + mNextAppTransitionOld = TRANSIT_OLD_UNSET; mNextAppTransitionFlags = 0; + mNextAppTransitionRequests.clear(); setAppTransitionState(APP_STATE_RUNNING); final WindowContainer wc = topOpeningApp != null ? topOpeningApp.getAnimatingContainer() : null; @@ -463,7 +494,7 @@ public class AppTransition implements Dump { } void freeze() { - final int transit = mNextAppTransition; + final int transit = mNextAppTransitionOld; // The RemoteAnimationControl didn't register AppTransitionListener and // only initialized the finish and timeout callback when goodToGo(). // So cancel the remote animation here to prevent the animation can't do @@ -471,7 +502,7 @@ public class AppTransition implements Dump { if (mRemoteAnimationController != null) { mRemoteAnimationController.cancelAnimation("freeze"); } - setAppTransition(TRANSIT_UNSET, 0 /* flags */); + setAppTransitionOld(TRANSIT_OLD_UNSET, 0 /* flags */); clear(); setReady(); notifyAppTransitionCancelledLocked(transit); @@ -493,7 +524,7 @@ public class AppTransition implements Dump { private boolean needsBoosting() { final boolean recentsAnimRunning = mService.getRecentsAnimationController() != null; - return mNextAppTransition != TRANSIT_UNSET + return mNextAppTransitionOld != TRANSIT_OLD_UNSET || mAppTransitionState == APP_STATE_READY || mAppTransitionState == APP_STATE_RUNNING || recentsAnimRunning; @@ -645,11 +676,13 @@ public class AppTransition implements Dump { } } - private int updateToTranslucentAnimIfNeeded(int anim, int transit) { - if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_OPEN && anim == R.anim.activity_open_enter) { + private int updateToTranslucentAnimIfNeeded(int anim, @TransitionOldType int transit) { + if (transit == TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN + && anim == R.anim.activity_open_enter) { return R.anim.activity_translucent_open_enter; } - if (transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE && anim == R.anim.activity_close_exit) { + if (transit == TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE + && anim == R.anim.activity_close_exit) { return R.anim.activity_translucent_close_exit; } return anim; @@ -752,8 +785,8 @@ public class AppTransition implements Dump { set.addAnimation(alpha); set.setDetachWallpaper(true); a = set; - } else if (transit == TRANSIT_WALLPAPER_INTRA_OPEN || - transit == TRANSIT_WALLPAPER_INTRA_CLOSE) { + } else if (transit == TRANSIT_OLD_WALLPAPER_INTRA_OPEN + || transit == TRANSIT_OLD_WALLPAPER_INTRA_CLOSE) { // If we are on top of the wallpaper, we need an animation that // correctly handles the wallpaper staying static behind all of // the animated elements. To do this, will just have the existing @@ -770,8 +803,8 @@ public class AppTransition implements Dump { // task transition duration. final long duration; switch (transit) { - case TRANSIT_ACTIVITY_OPEN: - case TRANSIT_ACTIVITY_CLOSE: + case TRANSIT_OLD_ACTIVITY_OPEN: + case TRANSIT_OLD_ACTIVITY_CLOSE: duration = mConfigShortAnimTime; break; default: @@ -950,16 +983,16 @@ public class AppTransition implements Dump { } else { final long duration; switch (transit) { - case TRANSIT_ACTIVITY_OPEN: - case TRANSIT_ACTIVITY_CLOSE: + case TRANSIT_OLD_ACTIVITY_OPEN: + case TRANSIT_OLD_ACTIVITY_CLOSE: duration = mConfigShortAnimTime; break; default: duration = DEFAULT_APP_TRANSITION_DURATION; break; } - if (transit == TRANSIT_WALLPAPER_INTRA_OPEN || - transit == TRANSIT_WALLPAPER_INTRA_CLOSE) { + if (transit == TRANSIT_OLD_WALLPAPER_INTRA_OPEN + || transit == TRANSIT_OLD_WALLPAPER_INTRA_CLOSE) { // If we are on top of the wallpaper, we need an animation that // correctly handles the wallpaper staying static behind all of // the animated elements. To do this, will just have the existing @@ -1002,8 +1035,8 @@ public class AppTransition implements Dump { // task transition duration. final int duration; switch (transit) { - case TRANSIT_ACTIVITY_OPEN: - case TRANSIT_ACTIVITY_CLOSE: + case TRANSIT_OLD_ACTIVITY_OPEN: + case TRANSIT_OLD_ACTIVITY_CLOSE: duration = mConfigShortAnimTime; break; default: @@ -1306,7 +1339,7 @@ public class AppTransition implements Dump { } case THUMBNAIL_TRANSITION_EXIT_SCALE_UP: { // Previous app window during the scale up - if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) { + if (transit == TRANSIT_OLD_WALLPAPER_INTRA_OPEN) { // Fade out the source activity if we are animating to a wallpaper // activity. a = new AlphaAnimation(1, 0); @@ -1317,7 +1350,7 @@ public class AppTransition implements Dump { } case THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN: { // Target app window during the scale down - if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) { + if (transit == TRANSIT_OLD_WALLPAPER_INTRA_OPEN) { // Fade in the destination activity if we are animating from a wallpaper // activity. a = new AlphaAnimation(0, 1); @@ -1452,7 +1485,7 @@ public class AppTransition implements Dump { } case THUMBNAIL_TRANSITION_EXIT_SCALE_UP: { // Exiting app while the thumbnail is scaling up should fade or stay in place - if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) { + if (transit == TRANSIT_OLD_WALLPAPER_INTRA_OPEN) { // Fade out while bringing up selected activity. This keeps the // current activity from showing through a launching wallpaper // activity. @@ -1545,7 +1578,7 @@ public class AppTransition implements Dump { && !mNextAppTransitionOverrideRequested && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE && mNextAppTransitionType != NEXT_TRANSIT_TYPE_CLIP_REVEAL - && mNextAppTransition != TRANSIT_KEYGUARD_GOING_AWAY; + && mNextAppTransitionOld != TRANSIT_OLD_KEYGUARD_GOING_AWAY; } RemoteAnimationController getRemoteAnimationController() { @@ -1585,35 +1618,35 @@ public class AppTransition implements Dump { Animation a; if (isKeyguardGoingAwayTransit(transit) && enter) { a = loadKeyguardExitAnimation(transit); - } else if (transit == TRANSIT_KEYGUARD_OCCLUDE) { + } else if (transit == TRANSIT_OLD_KEYGUARD_OCCLUDE) { a = null; - } else if (transit == TRANSIT_KEYGUARD_UNOCCLUDE && !enter) { + } else if (transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE && !enter) { a = loadAnimationRes(lp, com.android.internal.R.anim.wallpaper_open_exit); - } else if (transit == TRANSIT_CRASHING_ACTIVITY_CLOSE) { + } else if (transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE) { a = null; - } else if (isVoiceInteraction && (transit == TRANSIT_ACTIVITY_OPEN - || transit == TRANSIT_TASK_OPEN - || transit == TRANSIT_TASK_TO_FRONT)) { + } else if (isVoiceInteraction && (transit == TRANSIT_OLD_ACTIVITY_OPEN + || transit == TRANSIT_OLD_TASK_OPEN + || transit == TRANSIT_OLD_TASK_TO_FRONT)) { a = loadAnimationRes(lp, enter ? com.android.internal.R.anim.voice_activity_open_enter : com.android.internal.R.anim.voice_activity_open_exit); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation voice: anim=%s transit=%s isEntrance=%b Callers=%s", a, - appTransitionToString(transit), enter, Debug.getCallers(3)); - } else if (isVoiceInteraction && (transit == TRANSIT_ACTIVITY_CLOSE - || transit == TRANSIT_TASK_CLOSE - || transit == TRANSIT_TASK_TO_BACK)) { + appTransitionOldToString(transit), enter, Debug.getCallers(3)); + } else if (isVoiceInteraction && (transit == TRANSIT_OLD_ACTIVITY_CLOSE + || transit == TRANSIT_OLD_TASK_CLOSE + || transit == TRANSIT_OLD_TASK_TO_BACK)) { a = loadAnimationRes(lp, enter ? com.android.internal.R.anim.voice_activity_close_enter : com.android.internal.R.anim.voice_activity_close_exit); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation voice: anim=%s transit=%s isEntrance=%b Callers=%s", a, - appTransitionToString(transit), enter, Debug.getCallers(3)); - } else if (transit == TRANSIT_ACTIVITY_RELAUNCH) { + appTransitionOldToString(transit), enter, Debug.getCallers(3)); + } 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, - mNextAppTransition, appTransitionToString(transit), + mNextAppTransitionOld, appTransitionOldToString(transit), Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM) { a = loadAnimationRes(mNextAppTransitionPackage, enter ? @@ -1621,25 +1654,25 @@ public class AppTransition implements Dump { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s nextAppTransition=ANIM_CUSTOM transit=%s " + "isEntrance=%b Callers=%s", - a, appTransitionToString(transit), enter, Debug.getCallers(3)); + a, appTransitionOldToString(transit), enter, Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE) { a = loadAnimationRes(mNextAppTransitionPackage, mNextAppTransitionInPlace); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s nextAppTransition=ANIM_CUSTOM_IN_PLACE " + "transit=%s Callers=%s", - a, appTransitionToString(transit), Debug.getCallers(3)); + a, appTransitionOldToString(transit), Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL) { a = createClipRevealAnimationLocked(transit, enter, frame, displayFrame); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s nextAppTransition=ANIM_CLIP_REVEAL " + "transit=%s Callers=%s", - a, appTransitionToString(transit), Debug.getCallers(3)); + a, appTransitionOldToString(transit), Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_SCALE_UP) { a = createScaleUpAnimationLocked(transit, enter, frame); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s nextAppTransition=ANIM_SCALE_UP transit=%s " + "isEntrance=%s Callers=%s", - a, appTransitionToString(transit), enter, Debug.getCallers(3)); + a, appTransitionOldToString(transit), enter, Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP || mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN) { mNextAppTransitionScaleUp = @@ -1651,7 +1684,7 @@ public class AppTransition implements Dump { + "Callers=%s", a, mNextAppTransitionScaleUp ? "ANIM_THUMBNAIL_SCALE_UP" : "ANIM_THUMBNAIL_SCALE_DOWN", - appTransitionToString(transit), enter, Debug.getCallers(3)); + appTransitionOldToString(transit), enter, Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP || mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN) { mNextAppTransitionScaleUp = @@ -1665,77 +1698,77 @@ public class AppTransition implements Dump { a, mNextAppTransitionScaleUp ? "ANIM_THUMBNAIL_ASPECT_SCALE_UP" : "ANIM_THUMBNAIL_ASPECT_SCALE_DOWN", - appTransitionToString(transit), enter, Debug.getCallers(3)); + appTransitionOldToString(transit), enter, Debug.getCallers(3)); } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS && enter) { a = loadAnimationRes("android", com.android.internal.R.anim.task_open_enter_cross_profile_apps); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: " + "anim=%s transit=%s isEntrance=true Callers=%s", - a, appTransitionToString(transit), Debug.getCallers(3)); - } else if (transit == TRANSIT_TASK_CHANGE_WINDOWING_MODE) { + a, appTransitionOldToString(transit), Debug.getCallers(3)); + } else if (transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE) { // In the absence of a specific adapter, we just want to keep everything stationary. a = new AlphaAnimation(1.f, 1.f); a.setDuration(WindowChangeAnimationSpec.ANIMATION_DURATION); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s transit=%s isEntrance=%b Callers=%s", - a, appTransitionToString(transit), enter, Debug.getCallers(3)); + a, appTransitionOldToString(transit), enter, Debug.getCallers(3)); } else { int animAttr = 0; switch (transit) { - case TRANSIT_ACTIVITY_OPEN: - case TRANSIT_TRANSLUCENT_ACTIVITY_OPEN: + case TRANSIT_OLD_ACTIVITY_OPEN: + case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN: animAttr = enter ? WindowAnimation_activityOpenEnterAnimation : WindowAnimation_activityOpenExitAnimation; break; - case TRANSIT_ACTIVITY_CLOSE: - case TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE: + case TRANSIT_OLD_ACTIVITY_CLOSE: + case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE: animAttr = enter ? WindowAnimation_activityCloseEnterAnimation : WindowAnimation_activityCloseExitAnimation; break; - case TRANSIT_TASK_OPEN: + case TRANSIT_OLD_TASK_OPEN: animAttr = enter ? WindowAnimation_taskOpenEnterAnimation : WindowAnimation_taskOpenExitAnimation; break; - case TRANSIT_TASK_CLOSE: + case TRANSIT_OLD_TASK_CLOSE: animAttr = enter ? WindowAnimation_taskCloseEnterAnimation : WindowAnimation_taskCloseExitAnimation; break; - case TRANSIT_TASK_TO_FRONT: + case TRANSIT_OLD_TASK_TO_FRONT: animAttr = enter ? WindowAnimation_taskToFrontEnterAnimation : WindowAnimation_taskToFrontExitAnimation; break; - case TRANSIT_TASK_TO_BACK: + case TRANSIT_OLD_TASK_TO_BACK: animAttr = enter ? WindowAnimation_taskToBackEnterAnimation : WindowAnimation_taskToBackExitAnimation; break; - case TRANSIT_WALLPAPER_OPEN: + case TRANSIT_OLD_WALLPAPER_OPEN: animAttr = enter ? WindowAnimation_wallpaperOpenEnterAnimation : WindowAnimation_wallpaperOpenExitAnimation; break; - case TRANSIT_WALLPAPER_CLOSE: + case TRANSIT_OLD_WALLPAPER_CLOSE: animAttr = enter ? WindowAnimation_wallpaperCloseEnterAnimation : WindowAnimation_wallpaperCloseExitAnimation; break; - case TRANSIT_WALLPAPER_INTRA_OPEN: + case TRANSIT_OLD_WALLPAPER_INTRA_OPEN: animAttr = enter ? WindowAnimation_wallpaperIntraOpenEnterAnimation : WindowAnimation_wallpaperIntraOpenExitAnimation; break; - case TRANSIT_WALLPAPER_INTRA_CLOSE: + case TRANSIT_OLD_WALLPAPER_INTRA_CLOSE: animAttr = enter ? WindowAnimation_wallpaperIntraCloseEnterAnimation : WindowAnimation_wallpaperIntraCloseExitAnimation; break; - case TRANSIT_TASK_OPEN_BEHIND: + case TRANSIT_OLD_TASK_OPEN_BEHIND: animAttr = enter ? WindowAnimation_launchTaskBehindSourceAnimation : WindowAnimation_launchTaskBehindTargetAnimation; @@ -1744,7 +1777,7 @@ public class AppTransition implements Dump { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS_ANIM, "applyAnimation: anim=%s animAttr=0x%x transit=%s isEntrance=%b " + "Callers=%s", - a, animAttr, appTransitionToString(transit), enter, + a, animAttr, appTransitionOldToString(transit), enter, Debug.getCallers(3)); } setAppTransitionFinishedCallbackIfNeeded(a); @@ -1760,14 +1793,16 @@ public class AppTransition implements Dump { final boolean subtle = (mNextAppTransitionFlags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0; return mService.mPolicy.createHiddenByKeyguardExit( - transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, toShade, subtle); + transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER, toShade, subtle); } int getAppStackClipMode() { - return mNextAppTransition == TRANSIT_ACTIVITY_RELAUNCH + return mNextAppTransitionRequests.contains(TRANSIT_RELAUNCH) + || mNextAppTransitionRequests.contains(TRANSIT_KEYGUARD_GOING_AWAY) + || mNextAppTransitionOld == TRANSIT_OLD_ACTIVITY_RELAUNCH || mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL - || mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY - || mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER + || mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_GOING_AWAY + || mNextAppTransitionOld == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER ? STACK_CLIP_NONE : STACK_CLIP_AFTER_ANIM; } @@ -1965,80 +2000,140 @@ public class AppTransition implements Dump { @Override public String toString() { - return "mNextAppTransition=" + appTransitionToString(mNextAppTransition); + StringBuilder sb = new StringBuilder(); + sb.append("mNextAppTransition="); + sb.append(appTransitionOldToString(mNextAppTransitionOld)); + sb.append(", mNextAppTransitionRequests=["); + + boolean separator = false; + for (Integer transit : mNextAppTransitionRequests) { + if (separator) { + sb.append(", "); + } + sb.append(appTransitionToString(transit)); + separator = true; + } + sb.append("]"); + sb.append(", mNextAppTransitionFlags=" + + appTransitionFlagsToString(mNextAppTransitionFlags)); + return sb.toString(); } /** - * Returns the human readable name of a window transition. + * Returns the human readable name of a old window transition. * - * @param transition The window transition. + * @param transition The old window transition. * @return The transition symbolic name. */ - public static String appTransitionToString(int transition) { + public static String appTransitionOldToString(@TransitionOldType int transition) { switch (transition) { - case TRANSIT_UNSET: { - return "TRANSIT_UNSET"; + case TRANSIT_OLD_UNSET: { + return "TRANSIT_OLD_UNSET"; } - case TRANSIT_NONE: { - return "TRANSIT_NONE"; + case TRANSIT_OLD_NONE: { + return "TRANSIT_OLD_NONE"; + } + case TRANSIT_OLD_ACTIVITY_OPEN: { + return "TRANSIT_OLD_ACTIVITY_OPEN"; + } + case TRANSIT_OLD_ACTIVITY_CLOSE: { + return "TRANSIT_OLD_ACTIVITY_CLOSE"; + } + case TRANSIT_OLD_TASK_OPEN: { + return "TRANSIT_OLD_TASK_OPEN"; + } + case TRANSIT_OLD_TASK_CLOSE: { + return "TRANSIT_OLD_TASK_CLOSE"; } - case TRANSIT_ACTIVITY_OPEN: { - return "TRANSIT_ACTIVITY_OPEN"; + case TRANSIT_OLD_TASK_TO_FRONT: { + return "TRANSIT_OLD_TASK_TO_FRONT"; } - case TRANSIT_ACTIVITY_CLOSE: { - return "TRANSIT_ACTIVITY_CLOSE"; + case TRANSIT_OLD_TASK_TO_BACK: { + return "TRANSIT_OLD_TASK_TO_BACK"; } - case TRANSIT_TASK_OPEN: { - return "TRANSIT_TASK_OPEN"; + case TRANSIT_OLD_WALLPAPER_CLOSE: { + return "TRANSIT_OLD_WALLPAPER_CLOSE"; } - case TRANSIT_TASK_CLOSE: { - return "TRANSIT_TASK_CLOSE"; + case TRANSIT_OLD_WALLPAPER_OPEN: { + return "TRANSIT_OLD_WALLPAPER_OPEN"; } - case TRANSIT_TASK_TO_FRONT: { - return "TRANSIT_TASK_TO_FRONT"; + case TRANSIT_OLD_WALLPAPER_INTRA_OPEN: { + return "TRANSIT_OLD_WALLPAPER_INTRA_OPEN"; } - case TRANSIT_TASK_TO_BACK: { - return "TRANSIT_TASK_TO_BACK"; + case TRANSIT_OLD_WALLPAPER_INTRA_CLOSE: { + return "TRANSIT_OLD_WALLPAPER_INTRA_CLOSE"; } - case TRANSIT_WALLPAPER_CLOSE: { - return "TRANSIT_WALLPAPER_CLOSE"; + case TRANSIT_OLD_TASK_OPEN_BEHIND: { + return "TRANSIT_OLD_TASK_OPEN_BEHIND"; } - case TRANSIT_WALLPAPER_OPEN: { - return "TRANSIT_WALLPAPER_OPEN"; + case TRANSIT_OLD_ACTIVITY_RELAUNCH: { + return "TRANSIT_OLD_ACTIVITY_RELAUNCH"; } - case TRANSIT_WALLPAPER_INTRA_OPEN: { - return "TRANSIT_WALLPAPER_INTRA_OPEN"; + case TRANSIT_OLD_KEYGUARD_GOING_AWAY: { + return "TRANSIT_OLD_KEYGUARD_GOING_AWAY"; } - case TRANSIT_WALLPAPER_INTRA_CLOSE: { - return "TRANSIT_WALLPAPER_INTRA_CLOSE"; + case TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER: { + return "TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER"; } - case TRANSIT_TASK_OPEN_BEHIND: { - return "TRANSIT_TASK_OPEN_BEHIND"; + case TRANSIT_OLD_KEYGUARD_OCCLUDE: { + return "TRANSIT_OLD_KEYGUARD_OCCLUDE"; } - case TRANSIT_ACTIVITY_RELAUNCH: { - return "TRANSIT_ACTIVITY_RELAUNCH"; + case TRANSIT_OLD_KEYGUARD_UNOCCLUDE: { + return "TRANSIT_OLD_KEYGUARD_UNOCCLUDE"; + } + case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN: { + return "TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN"; + } + case TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE: { + return "TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE"; + } + case TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE: { + return "TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE"; + } + default: { + return "<UNKNOWN: " + transition + ">"; + } + } + } + + /** + * Returns the human readable name of a window transition. + * + * @param transition The window transition. + * @return The transition symbolic name. + */ + public static String appTransitionToString(@TransitionType int transition) { + switch (transition) { + case TRANSIT_NONE: { + return "TRANSIT_NONE"; + } + case TRANSIT_OPEN: { + return "TRANSIT_OPEN"; + } + case TRANSIT_CLOSE: { + return "TRANSIT_CLOSE"; + } + case TRANSIT_TO_FRONT: { + return "TRANSIT_TO_FRONT"; + } + case TRANSIT_TO_BACK: { + return "TRANSIT_TO_BACK"; + } + case TRANSIT_RELAUNCH: { + return "TRANSIT_RELAUNCH"; + } + case TRANSIT_CHANGE_WINDOWING_MODE: { + return "TRANSIT_CHANGE_WINDOWING_MODE"; } case TRANSIT_KEYGUARD_GOING_AWAY: { return "TRANSIT_KEYGUARD_GOING_AWAY"; } - case TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER: { - return "TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER"; - } case TRANSIT_KEYGUARD_OCCLUDE: { return "TRANSIT_KEYGUARD_OCCLUDE"; } case TRANSIT_KEYGUARD_UNOCCLUDE: { return "TRANSIT_KEYGUARD_UNOCCLUDE"; } - case TRANSIT_TRANSLUCENT_ACTIVITY_OPEN: { - return "TRANSIT_TRANSLUCENT_ACTIVITY_OPEN"; - } - case TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE: { - return "TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE"; - } - case TRANSIT_CRASHING_ACTIVITY_CLOSE: { - return "TRANSIT_CRASHING_ACTIVITY_CLOSE"; - } default: { return "<UNKNOWN: " + transition + ">"; } @@ -2085,6 +2180,41 @@ public class AppTransition implements Dump { } } + private static final ArrayList<Pair<Integer, String>> sFlagToString; + + static { + sFlagToString = new ArrayList<>(); + sFlagToString.add(new Pair<>(TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE, + "TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE")); + sFlagToString.add(new Pair<>(TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION, + "TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION")); + sFlagToString.add(new Pair<>(TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER, + "TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER")); + sFlagToString.add(new Pair<>(TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION, + "TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION")); + sFlagToString.add(new Pair<>(TRANSIT_FLAG_APP_CRASHED, + "TRANSIT_FLAG_APP_CRASHED")); + } + + /** + * Returns the human readable names of transit flags. + * + * @param flags a bitmask combination of transit flags. + * @return The combination of symbolic names. + */ + public static String appTransitionFlagsToString(int flags) { + String sep = ""; + StringBuilder sb = new StringBuilder(); + for (Pair<Integer, String> pair : sFlagToString) { + if ((flags & pair.first) != 0) { + sb.append(sep); + sb.append(pair.second); + sep = " | "; + } + } + return sb.toString(); + } + void dumpDebug(ProtoOutputStream proto, long fieldId) { final long token = proto.start(fieldId); proto.write(APP_TRANSITION_STATE, mAppTransitionState); @@ -2145,9 +2275,9 @@ public class AppTransition implements Dump { pw.print(prefix); pw.print("mNextAppTransitionCallback="); pw.println(mNextAppTransitionCallback); } - if (mLastUsedAppTransition != TRANSIT_NONE) { + if (mLastUsedAppTransition != TRANSIT_OLD_NONE) { pw.print(prefix); pw.print("mLastUsedAppTransition="); - pw.println(appTransitionToString(mLastUsedAppTransition)); + pw.println(appTransitionOldToString(mLastUsedAppTransition)); pw.print(prefix); pw.print("mLastOpeningApp="); pw.println(mLastOpeningApp); pw.print(prefix); pw.print("mLastClosingApp="); @@ -2165,7 +2295,7 @@ public class AppTransition implements Dump { * @return true if transition is not running and should not be skipped, false if transition is * already running */ - boolean prepareAppTransitionLocked(@TransitionType int transit, boolean alwaysKeepCurrent, + boolean prepareAppTransitionOld(@TransitionOldType int transit, boolean alwaysKeepCurrent, @TransitionFlags int flags, boolean forceOverride) { if (mService.mAtmService.getTransitionController().adaptLegacyPrepare( transit, flags, forceOverride)) { @@ -2174,78 +2304,88 @@ public class AppTransition implements Dump { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Prepare app transition: transit=%s %s alwaysKeepCurrent=%b displayId=%d " + "Callers=%s", - appTransitionToString(transit), this, alwaysKeepCurrent, + appTransitionOldToString(transit), this, alwaysKeepCurrent, mDisplayContent.getDisplayId(), Debug.getCallers(5)); - final boolean allowSetCrashing = !isKeyguardTransit(mNextAppTransition) - && transit == TRANSIT_CRASHING_ACTIVITY_CLOSE; + final boolean allowSetCrashing = !isKeyguardTransit(mNextAppTransitionOld) + && transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; if (forceOverride || isKeyguardTransit(transit) || !isTransitionSet() - || mNextAppTransition == TRANSIT_NONE || allowSetCrashing) { - setAppTransition(transit, flags); + || 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 && !isKeyguardTransit(mNextAppTransition) - && mNextAppTransition != TRANSIT_CRASHING_ACTIVITY_CLOSE) { - if (transit == TRANSIT_TASK_OPEN && isTransitionEqual(TRANSIT_TASK_CLOSE)) { + else if (!alwaysKeepCurrent && !isKeyguardTransit(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. - setAppTransition(transit, flags); - } else if (transit == TRANSIT_ACTIVITY_OPEN - && isTransitionEqual(TRANSIT_ACTIVITY_CLOSE)) { + 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. - setAppTransition(transit, flags); - } else if (isTaskTransit(transit) && isActivityTransit(mNextAppTransition)) { + setAppTransitionOld(transit, flags); + } else if (isTaskTransit(transit) && isActivityTransit(mNextAppTransitionOld)) { // Task animations always supersede activity animations, because if we have both, it // usually means that activity transition were just trampoline activities. - setAppTransition(transit, flags); + setAppTransitionOld(transit, flags); } } return prepare(); } + boolean prepareAppTransition(@TransitionType int transit, @TransitionFlags int flags) { + mNextAppTransitionRequests.add(transit); + mNextAppTransitionFlags |= flags; + updateBooster(); + removeAppTransitionTimeoutCallbacks(); + mHandler.postDelayed(mHandleAppTransitionTimeoutRunnable, + APP_TRANSITION_TIMEOUT_MS); + return prepare(); + } + /** * @return true if {@param transit} is representing a transition in which Keyguard is going * away, false otherwise */ public static boolean isKeyguardGoingAwayTransit(int transit) { - return transit == TRANSIT_KEYGUARD_GOING_AWAY - || transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; + return transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY + || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; } - static boolean isKeyguardTransit(int transit) { - return isKeyguardGoingAwayTransit(transit) || transit == TRANSIT_KEYGUARD_OCCLUDE - || transit == TRANSIT_KEYGUARD_UNOCCLUDE; + static boolean isKeyguardTransit(@TransitionOldType int transit) { + return isKeyguardGoingAwayTransit(transit) || transit == TRANSIT_OLD_KEYGUARD_OCCLUDE + || transit == TRANSIT_OLD_KEYGUARD_UNOCCLUDE; } - static boolean isTaskTransit(int transit) { + static boolean isTaskTransit(@TransitionOldType int transit) { return isTaskOpenTransit(transit) - || transit == TRANSIT_TASK_CLOSE - || transit == TRANSIT_TASK_TO_BACK; + || transit == TRANSIT_OLD_TASK_CLOSE + || transit == TRANSIT_OLD_TASK_TO_BACK; } - private static boolean isTaskOpenTransit(int transit) { - return transit == TRANSIT_TASK_OPEN - || transit == TRANSIT_TASK_OPEN_BEHIND - || transit == TRANSIT_TASK_TO_FRONT; + private static boolean isTaskOpenTransit(@TransitionOldType int transit) { + return transit == TRANSIT_OLD_TASK_OPEN + || transit == TRANSIT_OLD_TASK_OPEN_BEHIND + || transit == TRANSIT_OLD_TASK_TO_FRONT; } - static boolean isActivityTransit(int transit) { - return transit == TRANSIT_ACTIVITY_OPEN - || transit == TRANSIT_ACTIVITY_CLOSE - || transit == TRANSIT_ACTIVITY_RELAUNCH; + static boolean isActivityTransit(@TransitionOldType int transit) { + return transit == TRANSIT_OLD_ACTIVITY_OPEN + || transit == TRANSIT_OLD_ACTIVITY_CLOSE + || transit == TRANSIT_OLD_ACTIVITY_RELAUNCH; } - static boolean isChangeTransit(int transit) { - return transit == TRANSIT_TASK_CHANGE_WINDOWING_MODE; + static boolean isChangeTransit(@TransitionOldType int transit) { + return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; } - static boolean isClosingTransit(int transit) { - return transit == TRANSIT_ACTIVITY_CLOSE - || transit == TRANSIT_TASK_CLOSE - || transit == TRANSIT_WALLPAPER_CLOSE - || transit == TRANSIT_WALLPAPER_INTRA_CLOSE - || transit == TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE - || transit == TRANSIT_CRASHING_ACTIVITY_CLOSE; + static boolean isClosingTransit(@TransitionOldType int transit) { + return transit == TRANSIT_OLD_ACTIVITY_CLOSE + || transit == TRANSIT_OLD_TASK_CLOSE + || transit == TRANSIT_OLD_WALLPAPER_CLOSE + || transit == TRANSIT_OLD_WALLPAPER_INTRA_CLOSE + || transit == TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE + || transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; } /** diff --git a/services/core/java/com/android/server/wm/AppTransitionController.java b/services/core/java/com/android/server/wm/AppTransitionController.java index 14eedf786f4c..97912c1965ac 100644 --- a/services/core/java/com/android/server/wm/AppTransitionController.java +++ b/services/core/java/com/android/server/wm/AppTransitionController.java @@ -17,27 +17,27 @@ package com.android.server.wm; import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; -import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_ACTIVITY_RELAUNCH; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; -import static android.view.WindowManager.TRANSIT_NONE; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_TO_BACK; -import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT; -import static android.view.WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_WALLPAPER_CLOSE; -import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_CLOSE; -import static android.view.WindowManager.TRANSIT_WALLPAPER_INTRA_OPEN; -import static android.view.WindowManager.TRANSIT_WALLPAPER_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_RELAUNCH; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; +import static android.view.WindowManager.TRANSIT_OLD_NONE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_WALLPAPER_OPEN; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS_ANIM; @@ -63,7 +63,7 @@ import android.view.RemoteAnimationAdapter; import android.view.RemoteAnimationDefinition; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; -import android.view.WindowManager.TransitionType; +import android.view.WindowManager.TransitionOldType; import android.view.animation.Animation; import com.android.internal.annotations.VisibleForTesting; @@ -109,10 +109,12 @@ public class AppTransitionController { Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady"); ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "**** GOOD TO GO"); + // TODO(new-app-transition): Compute the best transition from + // appTransition.mNextAppTransitionRequests final AppTransition appTransition = mDisplayContent.mAppTransition; - int transit = appTransition.getAppTransition(); + int transit = appTransition.getAppTransitionOld(); if (mDisplayContent.mSkipAppTransitionAnimation && !isKeyguardGoingAwayTransit(transit)) { - transit = WindowManager.TRANSIT_UNSET; + transit = WindowManager.TRANSIT_OLD_UNSET; } mDisplayContent.mSkipAppTransitionAnimation = false; mDisplayContent.mNoAnimationNotifyOnTransitionFinished.clear(); @@ -226,7 +228,7 @@ public class AppTransitionController { } RemoteAnimationAdapter getRemoteAnimationOverride(@NonNull WindowContainer container, - @TransitionType int transit, ArraySet<Integer> activityTypes) { + @TransitionOldType int transit, ArraySet<Integer> activityTypes) { final RemoteAnimationDefinition definition = container.getRemoteAnimationDefinition(); if (definition != null) { final RemoteAnimationAdapter adapter = definition.getAdapter(transit, activityTypes); @@ -245,8 +247,8 @@ public class AppTransitionController { * set of defined remote animations in the app window token. */ private void overrideWithRemoteAnimationIfSet(ActivityRecord animLpActivity, - @TransitionType int transit, ArraySet<Integer> activityTypes) { - if (transit == TRANSIT_CRASHING_ACTIVITY_CLOSE) { + @TransitionOldType int transit, ArraySet<Integer> activityTypes) { + if (transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE) { // The crash transition has higher priority than any involved remote animations. return; } @@ -269,7 +271,7 @@ public class AppTransitionController { /** * @return The window token that determines the animation theme. */ - private ActivityRecord findAnimLayoutParamsToken(@TransitionType int transit, + private ActivityRecord findAnimLayoutParamsToken(@TransitionOldType int transit, ArraySet<Integer> activityTypes) { ActivityRecord result; final ArraySet<ActivityRecord> closingApps = mDisplayContent.mClosingApps; @@ -357,7 +359,7 @@ public class AppTransitionController { * interaction session driving task. */ private void applyAnimations(ArraySet<WindowContainer> wcs, ArraySet<ActivityRecord> apps, - @TransitionType int transit, boolean visible, LayoutParams animLp, + @TransitionOldType int transit, boolean visible, LayoutParams animLp, boolean voiceInteraction) { final int wcsCount = wcs.size(); for (int i = 0; i < wcsCount; i++) { @@ -490,9 +492,9 @@ public class AppTransitionController { * interaction session driving task. */ private void applyAnimations(ArraySet<ActivityRecord> openingApps, - ArraySet<ActivityRecord> closingApps, @TransitionType int transit, + ArraySet<ActivityRecord> closingApps, @TransitionOldType int transit, LayoutParams animLp, boolean voiceInteraction) { - if (transit == WindowManager.TRANSIT_UNSET + if (transit == WindowManager.TRANSIT_OLD_UNSET || (openingApps.isEmpty() && closingApps.isEmpty())) { return; } @@ -583,7 +585,7 @@ public class AppTransitionController { } } - private void handleChangingApps(@TransitionType int transit) { + private void handleChangingApps(@TransitionOldType int transit) { final ArraySet<WindowContainer> apps = mDisplayContent.mChangingContainers; final int appsCount = apps.size(); for (int i = 0; i < appsCount; i++) { @@ -593,8 +595,8 @@ public class AppTransitionController { } } - private void handleNonAppWindowsInTransition(@TransitionType int transit, int flags) { - if (transit == TRANSIT_KEYGUARD_GOING_AWAY) { + private void handleNonAppWindowsInTransition(@TransitionOldType int transit, int flags) { + if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY) { if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) { @@ -606,10 +608,10 @@ public class AppTransitionController { } } } - if (transit == TRANSIT_KEYGUARD_GOING_AWAY - || transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { + if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY + || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { mDisplayContent.startKeyguardExitOnNonAppWindows( - transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, + transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER, (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0, (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0); } @@ -689,13 +691,13 @@ public class AppTransitionController { return true; } - private int maybeUpdateTransitToWallpaper(@TransitionType int transit, + private int maybeUpdateTransitToWallpaper(@TransitionOldType int transit, boolean openingAppHasWallpaper, boolean closingAppHasWallpaper) { // Given no app transition pass it through instead of a wallpaper transition. // Never convert the crashing transition. // Never convert a change transition since the top activity isn't changing and will likely // still be above an opening wallpaper. - if (transit == TRANSIT_NONE || transit == TRANSIT_CRASHING_ACTIVITY_CLOSE + if (transit == TRANSIT_OLD_NONE || transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE || AppTransition.isChangeTransit(transit)) { return transit; } @@ -705,7 +707,7 @@ public class AppTransitionController { && ((wallpaperTarget.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0 // Update task open transition to wallpaper transition when wallpaper is visible. // (i.e.launching app info activity from recent tasks) - || ((transit == TRANSIT_TASK_OPEN || transit == TRANSIT_TASK_TO_FRONT) + || ((transit == TRANSIT_OLD_TASK_OPEN || transit == TRANSIT_OLD_TASK_TO_FRONT) && mWallpaperControllerLocked.isWallpaperVisible())); // If wallpaper is animating or wallpaperTarget doesn't have SHOW_WALLPAPER flag set, // don't consider upgrading to wallpaper transition. @@ -725,10 +727,10 @@ public class AppTransitionController { "New wallpaper target=%s, oldWallpaper=%s, openingApps=%s, closingApps=%s", wallpaperTarget, oldWallpaper, openingApps, closingApps); - if (openingCanBeWallpaperTarget && transit == TRANSIT_KEYGUARD_GOING_AWAY) { - transit = TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; + if (openingCanBeWallpaperTarget && transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY) { + transit = TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "New transit: %s", AppTransition.appTransitionToString(transit)); + "New transit: %s", AppTransition.appTransitionOldToString(transit)); } // 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. @@ -736,37 +738,37 @@ public class AppTransitionController { if (closingAppHasWallpaper && openingAppHasWallpaper) { ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Wallpaper animation!"); switch (transit) { - case TRANSIT_ACTIVITY_OPEN: - case TRANSIT_TASK_OPEN: - case TRANSIT_TASK_TO_FRONT: - transit = TRANSIT_WALLPAPER_INTRA_OPEN; + case TRANSIT_OLD_ACTIVITY_OPEN: + case TRANSIT_OLD_TASK_OPEN: + case TRANSIT_OLD_TASK_TO_FRONT: + transit = TRANSIT_OLD_WALLPAPER_INTRA_OPEN; break; - case TRANSIT_ACTIVITY_CLOSE: - case TRANSIT_TASK_CLOSE: - case TRANSIT_TASK_TO_BACK: - transit = TRANSIT_WALLPAPER_INTRA_CLOSE; + case TRANSIT_OLD_ACTIVITY_CLOSE: + case TRANSIT_OLD_TASK_CLOSE: + case TRANSIT_OLD_TASK_TO_BACK: + transit = TRANSIT_OLD_WALLPAPER_INTRA_CLOSE; break; } ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, - "New transit: %s", AppTransition.appTransitionToString(transit)); + "New transit: %s", AppTransition.appTransitionOldToString(transit)); } else if (oldWallpaper != null && !mDisplayContent.mOpeningApps.isEmpty() && !openingApps.contains(oldWallpaper.mActivityRecord) && closingApps.contains(oldWallpaper.mActivityRecord) && topClosingApp == oldWallpaper.mActivityRecord) { // We are transitioning from an activity with a wallpaper to one without. - transit = TRANSIT_WALLPAPER_CLOSE; + transit = TRANSIT_OLD_WALLPAPER_CLOSE; ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "New transit away from wallpaper: %s", - AppTransition.appTransitionToString(transit)); + AppTransition.appTransitionOldToString(transit)); } else if (wallpaperTarget != null && wallpaperTarget.isVisibleLw() && openingApps.contains(wallpaperTarget.mActivityRecord) && topOpeningApp == wallpaperTarget.mActivityRecord - && transit != TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE) { + && transit != TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE) { // We are transitioning from an activity without // a wallpaper to now showing the wallpaper - transit = TRANSIT_WALLPAPER_OPEN; + transit = TRANSIT_OLD_WALLPAPER_OPEN; ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "New transit into wallpaper: %s", - AppTransition.appTransitionToString(transit)); + AppTransition.appTransitionOldToString(transit)); } } return transit; @@ -780,12 +782,12 @@ public class AppTransitionController { * * @param transit The current transition type. * @return The current transition type or - * {@link WindowManager#TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE}/ - * {@link WindowManager#TRANSIT_TRANSLUCENT_ACTIVITY_OPEN} if appropriate for the + * {@link WindowManager#TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE}/ + * {@link WindowManager#TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN} if appropriate for the * situation. */ @VisibleForTesting - int maybeUpdateTransitToTranslucentAnim(@TransitionType int transit) { + int maybeUpdateTransitToTranslucentAnim(@TransitionOldType int transit) { if (AppTransition.isChangeTransit(transit)) { // There's no special animation to handle change animations with translucent apps return transit; @@ -812,10 +814,10 @@ public class AppTransitionController { } if (taskOrActivity && allTranslucentClosingApps && allOpeningVisible) { - return TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE; + return TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE; } if (taskOrActivity && allTranslucentOpeningApps && mDisplayContent.mClosingApps.isEmpty()) { - return TRANSIT_TRANSLUCENT_ACTIVITY_OPEN; + return TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN; } return transit; } @@ -825,16 +827,16 @@ public class AppTransitionController { * to determine whether animations should be clipped to the task bounds instead of stack bounds. */ @VisibleForTesting - boolean isTransitWithinTask(@TransitionType int transit, Task task) { + boolean isTransitWithinTask(@TransitionOldType int transit, Task task) { if (task == null || !mDisplayContent.mChangingContainers.isEmpty()) { // if there is no task, then we can't constrain to the task. // if anything is changing, it can animate outside its task. return false; } - if (!(transit == TRANSIT_ACTIVITY_OPEN - || transit == TRANSIT_ACTIVITY_CLOSE - || transit == TRANSIT_ACTIVITY_RELAUNCH)) { + if (!(transit == TRANSIT_OLD_ACTIVITY_OPEN + || transit == TRANSIT_OLD_ACTIVITY_CLOSE + || transit == TRANSIT_OLD_ACTIVITY_RELAUNCH)) { // only activity-level transitions will be within-task. return false; } diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java index 38ad0706d949..8fb40ba71696 100644 --- a/services/core/java/com/android/server/wm/DisplayArea.java +++ b/services/core/java/com/android/server/wm/DisplayArea.java @@ -19,7 +19,6 @@ package com.android.server.wm; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_BEHIND; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; -import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; import static android.view.WindowManagerPolicyConstants.APPLICATION_LAYER; import static android.window.DisplayAreaOrganizer.FEATURE_UNDEFINED; import static android.window.DisplayAreaOrganizer.FEATURE_WINDOW_TOKENS; @@ -467,8 +466,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> { // Consider unoccluding only when all unknown visibilities have been // resolved, as otherwise we just may be starting another occluding activity. final boolean isUnoccluding = - mDisplayContent.mAppTransition.getAppTransition() - == TRANSIT_KEYGUARD_UNOCCLUDE + mDisplayContent.mAppTransition.isUnoccluding() && mDisplayContent.mUnknownAppVisibilityController.allResolved(); // If keyguard is showing, or we're unoccluding, force the keyguard's orientation, // even if SystemUI hasn't updated the attrs yet. diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 2de28beaad58..6402e72f21f1 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -70,9 +70,9 @@ import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG; import static android.view.WindowManager.LayoutParams.TYPE_SYSTEM_ERROR; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_FRONT; import static android.window.DisplayAreaOrganizer.FEATURE_ROOT; import static android.window.DisplayAreaOrganizer.FEATURE_WINDOWED_MAGNIFICATION; @@ -109,7 +109,6 @@ import static com.android.server.wm.DisplayContentProto.OPENING_APPS; import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY; import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA; import static com.android.server.wm.DisplayContentProto.SCREEN_ROTATION_ANIMATION; -import static com.android.server.wm.DisplayContentProto.SINGLE_TASK_INSTANCE; import static com.android.server.wm.Task.ActivityState.RESUMED; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION; @@ -4499,21 +4498,48 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mPointerEventDispatcher.unregisterInputEventListener(listener); } - void prepareAppTransition(@WindowManager.TransitionType int transit, + /** + * Transfer app transition from other display to this display. + * + * @param from Display from where the app transition is transferred. + * + * TODO(new-app-transition): Remove this once the shell handles app transition. + */ + void transferAppTransitionFrom(DisplayContent from) { + final boolean prepared = mAppTransition.transferFrom(from.mAppTransition); + if (prepared && okToAnimate()) { + mSkipAppTransitionAnimation = false; + } + } + + void prepareAppTransitionOld(@WindowManager.TransitionOldType int transit, boolean alwaysKeepCurrent) { - prepareAppTransition(transit, alwaysKeepCurrent, 0 /* flags */, false /* forceOverride */); + prepareAppTransitionOld(transit, alwaysKeepCurrent, 0 /* flags */, + false /* forceOverride */); } - void prepareAppTransition(@WindowManager.TransitionType int transit, + void prepareAppTransitionOld(@WindowManager.TransitionOldType int transit, boolean alwaysKeepCurrent, @WindowManager.TransitionFlags int flags, boolean forceOverride) { - final boolean prepared = mAppTransition.prepareAppTransitionLocked( + final boolean prepared = mAppTransition.prepareAppTransitionOld( transit, alwaysKeepCurrent, flags, forceOverride); if (prepared && okToAnimate()) { mSkipAppTransitionAnimation = false; } } + void prepareAppTransition(@WindowManager.TransitionType int transit) { + prepareAppTransition(transit, 0 /* flags */); + } + + void prepareAppTransition(@WindowManager.TransitionType int transit, + @WindowManager.TransitionFlags int flags) { + final boolean prepared = mAppTransition.prepareAppTransition(transit, flags); + if (prepared && okToAnimate()) { + mSkipAppTransitionAnimation = false; + } + } + void executeAppTransition() { mAtmService.getTransitionController().setReady(); if (mAppTransition.isTransitionSet()) { @@ -4558,10 +4584,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp /** Check if pending app transition is for activity / task launch. */ boolean isNextTransitionForward() { - final int transit = mAppTransition.getAppTransition(); - return transit == TRANSIT_ACTIVITY_OPEN - || transit == TRANSIT_TASK_OPEN - || transit == TRANSIT_TASK_TO_FRONT; + final int transit = mAppTransition.getAppTransitionOld(); + return transit == TRANSIT_OLD_ACTIVITY_OPEN + || transit == TRANSIT_OLD_TASK_OPEN + || transit == TRANSIT_OLD_TASK_TO_FRONT; } /** diff --git a/services/core/java/com/android/server/wm/KeyguardController.java b/services/core/java/com/android/server/wm/KeyguardController.java index 71eb18ca4117..b416309c5577 100644 --- a/services/core/java/com/android/server/wm/KeyguardController.java +++ b/services/core/java/com/android/server/wm/KeyguardController.java @@ -25,7 +25,10 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_W import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE; import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; -import static android.view.WindowManager.TRANSIT_UNSET; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE; +import static android.view.WindowManager.TRANSIT_OLD_UNSET; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS; import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE; @@ -199,9 +202,12 @@ class KeyguardController { 1 /* keyguardGoingAway */, "keyguardGoingAway"); mRootWindowContainer.getDefaultDisplay() - .prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, + .prepareAppTransitionOld(TRANSIT_OLD_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */, convertTransitFlags(flags), false /* forceOverride */); + mRootWindowContainer.getDefaultDisplay() + .prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, + convertTransitFlags(flags)); updateKeyguardSleepToken(); // Some stack visibility might change (e.g. docked stack) @@ -344,9 +350,14 @@ class KeyguardController { mService.deferWindowLayout(); try { mRootWindowContainer.getDefaultDisplay() - .prepareAppTransition(resolveOccludeTransit(), + .prepareAppTransitionOld(resolveOccludeTransit(), false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */); + mRootWindowContainer.getDefaultDisplay() + .prepareAppTransition( + isDisplayOccluded(DEFAULT_DISPLAY) + ? TRANSIT_KEYGUARD_OCCLUDE + : TRANSIT_KEYGUARD_UNOCCLUDE); updateKeyguardSleepToken(DEFAULT_DISPLAY); mWindowManager.executeAppTransition(); } finally { @@ -374,9 +385,10 @@ class KeyguardController { // we immediately dismiss the Keyguard so the activity gets shown without a flicker. final DisplayContent dc = mRootWindowContainer.getDefaultDisplay(); if (mKeyguardShowing && canDismissKeyguard() - && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE) { - dc.prepareAppTransition(mBeforeUnoccludeTransit, false /* alwaysKeepCurrent */, + && dc.mAppTransition.getAppTransitionOld() == TRANSIT_OLD_KEYGUARD_UNOCCLUDE) { + dc.prepareAppTransitionOld(mBeforeUnoccludeTransit, false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */); + dc.prepareAppTransition(TRANSIT_KEYGUARD_UNOCCLUDE); mWindowManager.executeAppTransition(); } } @@ -394,9 +406,10 @@ class KeyguardController { } private int resolveOccludeTransit() { + // TODO(new-app-transition): Remove after migrating to the enw transit system. final DisplayContent dc = mRootWindowContainer.getDefaultDisplay(); - if (mBeforeUnoccludeTransit != TRANSIT_UNSET - && dc.mAppTransition.getAppTransition() == TRANSIT_KEYGUARD_UNOCCLUDE + if (mBeforeUnoccludeTransit != TRANSIT_OLD_UNSET + && dc.mAppTransition.getAppTransitionOld() == TRANSIT_OLD_KEYGUARD_UNOCCLUDE // TODO(b/113840485): Handle app transition for individual display. && isDisplayOccluded(DEFAULT_DISPLAY)) { @@ -407,10 +420,10 @@ class KeyguardController { } else if (!isDisplayOccluded(DEFAULT_DISPLAY)) { // Save transit in case we dismiss/occlude Keyguard shortly after. - mBeforeUnoccludeTransit = dc.mAppTransition.getAppTransition(); - return TRANSIT_KEYGUARD_UNOCCLUDE; + mBeforeUnoccludeTransit = dc.mAppTransition.getAppTransitionOld(); + return TRANSIT_OLD_KEYGUARD_UNOCCLUDE; } else { - return TRANSIT_KEYGUARD_OCCLUDE; + return TRANSIT_OLD_KEYGUARD_OCCLUDE; } } diff --git a/services/core/java/com/android/server/wm/RecentsAnimation.java b/services/core/java/com/android/server/wm/RecentsAnimation.java index 1cf50ab25240..ca429f8d434d 100644 --- a/services/core/java/com/android/server/wm/RecentsAnimation.java +++ b/services/core/java/com/android/server/wm/RecentsAnimation.java @@ -23,7 +23,6 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; -import static android.view.WindowManager.TRANSIT_NONE; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_RECENTS_ANIMATIONS; import static com.android.server.wm.ActivityStackSupervisor.PRESERVE_WINDOWS; @@ -221,7 +220,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "Moved stack=%s behind stack=%s", targetStack, getStackAbove(targetStack)); - mWindowManager.prepareAppTransition(TRANSIT_NONE, false); + mWindowManager.prepareAppTransitionNone(); mWindowManager.executeAppTransition(); // TODO: Maybe wait for app to draw in this particular case? @@ -377,7 +376,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, return; } - mWindowManager.prepareAppTransition(TRANSIT_NONE, false); + mWindowManager.prepareAppTransitionNone(); mService.mRootWindowContainer.ensureActivitiesVisible(null, 0, false); mService.mRootWindowContainer.resumeFocusedStacksTopActivities(); @@ -436,7 +435,7 @@ class RecentsAnimation implements RecentsAnimationCallbacks, || controller.isTargetApp(stack.getTopNonFinishingActivity())) && controller.shouldDeferCancelUntilNextTransition()) { // Always prepare an app transition since we rely on the transition callbacks to cleanup - mWindowManager.prepareAppTransition(TRANSIT_NONE, false); + mWindowManager.prepareAppTransitionNone(); controller.setCancelOnNextTransitionStart(); } } diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java index 11718dc5fab6..46664ad42602 100644 --- a/services/core/java/com/android/server/wm/RootWindowContainer.java +++ b/services/core/java/com/android/server/wm/RootWindowContainer.java @@ -36,9 +36,12 @@ import static android.view.Display.INVALID_DISPLAY; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE; import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_CLOSE; +import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; import static android.view.WindowManager.TRANSIT_NONE; -import static android.view.WindowManager.TRANSIT_TASK_TO_BACK; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_NONE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_FOCUS_LIGHT; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_KEEP_SCREEN_ON; @@ -2175,7 +2178,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> // Set a transition to ensure that we don't immediately try and update the visibility // of the activity entering PIP - r.getDisplayContent().prepareAppTransition(TRANSIT_NONE, false); + r.getDisplayContent().prepareAppTransitionOld(TRANSIT_OLD_NONE, false); + r.getDisplayContent().prepareAppTransition(TRANSIT_NONE); final boolean singleActivity = task.getChildCount() == 1; final Task stack; @@ -2206,8 +2210,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent> // to the list of apps being closed, and request its transition to be ran. final ActivityRecord oldTopActivity = task.getTopMostActivity(); if (oldTopActivity != null && oldTopActivity.isState(STOPPED) - && task.getDisplayContent().mAppTransition.getAppTransition() - == TRANSIT_TASK_TO_BACK) { + && task.getDisplayContent().mAppTransition.getAppTransitionOld() + == TRANSIT_OLD_TASK_TO_BACK) { task.getDisplayContent().mClosingApps.add(oldTopActivity); oldTopActivity.mRequestForceTransition = true; } @@ -2799,8 +2803,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); r.detachFromProcess(); - r.mDisplayContent.prepareAppTransition( - TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); + r.mDisplayContent.prepareAppTransitionOld(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE, + false /* alwaysKeepCurrent */); + r.mDisplayContent.prepareAppTransition(TRANSIT_CLOSE, TRANSIT_FLAG_APP_CRASHED); r.destroyIfPossible("handleAppCrashed"); } diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index d1b1d74ccdd8..1f420dbaca03 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -63,16 +63,23 @@ import static android.provider.Settings.Secure.USER_SETUP_COMPLETE; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.SurfaceControl.METADATA_TASK_ID; -import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_CLOSE; +import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED; import static android.view.WindowManager.TRANSIT_NONE; -import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND; -import static android.view.WindowManager.TRANSIT_TASK_TO_BACK; -import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_NONE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OPEN; +import static android.view.WindowManager.TRANSIT_TO_BACK; +import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.internal.policy.DecorView.DECOR_SHADOW_FOCUSED_HEIGHT_IN_DIP; import static com.android.internal.policy.DecorView.DECOR_SHADOW_UNFOCUSED_HEIGHT_IN_DIP; @@ -2359,8 +2366,9 @@ class Task extends WindowContainer<WindowContainer> { * Initializes a change transition. See {@link SurfaceFreezer} for more information. */ private void initializeChangeTransition(Rect startBounds) { - mDisplayContent.prepareAppTransition(TRANSIT_TASK_CHANGE_WINDOWING_MODE, + mDisplayContent.prepareAppTransitionOld(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE, false /* alwaysKeepCurrent */, 0, false /* forceOverride */); + mDisplayContent.prepareAppTransition(TRANSIT_CHANGE_WINDOWING_MODE); mAtmService.getTransitionController().collect(this); mDisplayContent.mChangingContainers.add(this); @@ -2445,7 +2453,7 @@ class Task extends WindowContainer<WindowContainer> { @Override public SurfaceControl getFreezeSnapshotTarget() { - final int transit = mDisplayContent.mAppTransition.getAppTransition(); + final int transit = mDisplayContent.mAppTransition.getAppTransitionOld(); if (!AppTransition.isChangeTransit(transit)) { return null; } @@ -3943,7 +3951,7 @@ class Task extends WindowContainer<WindowContainer> { if (enter && !isHomeOrRecentsStack()) { ProtoLog.d(WM_DEBUG_RECENTS_ANIMATIONS, "applyAnimationUnchecked, control: %s, task: %s, transit: %s", - control, asTask(), AppTransition.appTransitionToString(transit)); + control, asTask(), AppTransition.appTransitionOldToString(transit)); control.addTaskToTargets(this, (type, anim) -> { for (int i = 0; i < sources.size(); ++i) { sources.get(i).onAnimationFinished(type, anim); @@ -6052,11 +6060,13 @@ class Task extends WindowContainer<WindowContainer> { "Prepare close transition: prev=" + prev); if (mStackSupervisor.mNoAnimActivities.contains(prev)) { anim = false; - dc.prepareAppTransition(TRANSIT_NONE, false); + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, false); + dc.prepareAppTransition(TRANSIT_NONE); } else { - dc.prepareAppTransition( - prev.getTask() == next.getTask() ? TRANSIT_ACTIVITY_CLOSE - : TRANSIT_TASK_CLOSE, false); + dc.prepareAppTransitionOld( + prev.getTask() == next.getTask() ? TRANSIT_OLD_ACTIVITY_CLOSE + : TRANSIT_OLD_TASK_CLOSE, false); + dc.prepareAppTransition(TRANSIT_CLOSE); } prev.setVisibility(false); } else { @@ -6064,21 +6074,25 @@ class Task extends WindowContainer<WindowContainer> { "Prepare open transition: prev=" + prev); if (mStackSupervisor.mNoAnimActivities.contains(next)) { anim = false; - dc.prepareAppTransition(TRANSIT_NONE, false); + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, false); + dc.prepareAppTransition(TRANSIT_NONE); } else { - dc.prepareAppTransition( - prev.getTask() == next.getTask() ? TRANSIT_ACTIVITY_OPEN - : next.mLaunchTaskBehind ? TRANSIT_TASK_OPEN_BEHIND - : TRANSIT_TASK_OPEN, false); + dc.prepareAppTransitionOld( + prev.getTask() == next.getTask() ? TRANSIT_OLD_ACTIVITY_OPEN + : next.mLaunchTaskBehind ? TRANSIT_OLD_TASK_OPEN_BEHIND + : TRANSIT_OLD_TASK_OPEN, /* alwaysKeepCurrent */false); + dc.prepareAppTransition(TRANSIT_OPEN); } } } else { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous"); if (mStackSupervisor.mNoAnimActivities.contains(next)) { anim = false; - dc.prepareAppTransition(TRANSIT_NONE, false); + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, false); + dc.prepareAppTransition(TRANSIT_NONE); } else { - dc.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false); + dc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false); + dc.prepareAppTransition(TRANSIT_OPEN); } } @@ -6337,13 +6351,14 @@ class Task extends WindowContainer<WindowContainer> { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: starting " + r); if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { - dc.prepareAppTransition(TRANSIT_NONE, keepCurTransition); + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, keepCurTransition); + dc.prepareAppTransition(TRANSIT_NONE); mStackSupervisor.mNoAnimActivities.add(r); } else { - int transit = TRANSIT_ACTIVITY_OPEN; + int transit = TRANSIT_OLD_ACTIVITY_OPEN; if (newTask) { if (r.mLaunchTaskBehind) { - transit = TRANSIT_TASK_OPEN_BEHIND; + transit = TRANSIT_OLD_TASK_OPEN_BEHIND; } else { // If a new task is being launched, then mark the existing top activity as // supporting picture-in-picture while pausing only if the starting activity @@ -6353,17 +6368,18 @@ class Task extends WindowContainer<WindowContainer> { null /* toFrontTask */, r, options)) { focusedTopActivity.supportsEnterPipOnTaskSwitch = true; } - transit = TRANSIT_TASK_OPEN; + transit = TRANSIT_OLD_TASK_OPEN; } } if (mAtmService.getTransitionController().isShellTransitionsEnabled() // TODO(shell-transitions): eventually all transitions. - && transit == TRANSIT_TASK_OPEN) { + && transit == TRANSIT_OLD_TASK_OPEN) { Transition transition = mAtmService.getTransitionController().requestTransition(transit); transition.collect(task); } else { - dc.prepareAppTransition(transit, keepCurTransition); + dc.prepareAppTransitionOld(transit, keepCurTransition); + dc.prepareAppTransition(TRANSIT_OPEN); } mStackSupervisor.mNoAnimActivities.remove(r); } @@ -6502,8 +6518,9 @@ class Task extends WindowContainer<WindowContainer> { Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); Task finishedTask = r.getTask(); - mDisplayContent.prepareAppTransition( - TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransitionOld( + TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransition(TRANSIT_CLOSE, TRANSIT_FLAG_APP_CRASHED); r.finishIfPossible(reason, false /* oomAdj */); // Also terminate any activities below it that aren't yet stopped, to avoid a situation @@ -6734,7 +6751,9 @@ class Task extends WindowContainer<WindowContainer> { forAllActivities(ActivityRecord::removeLaunchTickRunnable); } - private void updateTransitLocked(int transit, ActivityOptions options, boolean forceOverride) { + private void updateTransitLocked(@WindowManager.TransitionOldType int transit, + @WindowManager.TransitionType int transit2, ActivityOptions options, + boolean forceOverride) { if (options != null) { ActivityRecord r = topRunningActivity(); if (r != null && !r.isState(RESUMED)) { @@ -6743,8 +6762,9 @@ class Task extends WindowContainer<WindowContainer> { ActivityOptions.abort(options); } } - mDisplayContent.prepareAppTransition(transit, false, + mDisplayContent.prepareAppTransitionOld(transit, false, 0 /* flags */, forceOverride); + mDisplayContent.prepareAppTransition(transit2); } final void moveTaskToFront(Task tr, boolean noAnimation, ActivityOptions options, @@ -6765,7 +6785,8 @@ class Task extends WindowContainer<WindowContainer> { if (noAnimation) { ActivityOptions.abort(options); } else { - updateTransitLocked(TRANSIT_TASK_TO_FRONT, options, false /* forceOverride */); + updateTransitLocked(TRANSIT_OLD_TASK_TO_FRONT, TRANSIT_TO_FRONT, options, + false /* forceOverride */); } return; } @@ -6806,13 +6827,16 @@ class Task extends WindowContainer<WindowContainer> { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr); if (noAnimation) { - mDisplayContent.prepareAppTransition(TRANSIT_NONE, false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransitionOld(TRANSIT_OLD_NONE, + false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransition(TRANSIT_NONE); if (r != null) { mStackSupervisor.mNoAnimActivities.add(r); } ActivityOptions.abort(options); } else { - updateTransitLocked(TRANSIT_TASK_TO_FRONT, options, false /* forceOverride */); + updateTransitLocked(TRANSIT_OLD_TASK_TO_FRONT, TRANSIT_TO_FRONT, + options, false /* forceOverride */); } // If a new task is moved to the front, then mark the existing top activity as @@ -6880,7 +6904,9 @@ class Task extends WindowContainer<WindowContainer> { if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to back transition: task=" + tr.mTaskId); - mDisplayContent.prepareAppTransition(TRANSIT_TASK_TO_BACK, false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransitionOld(TRANSIT_OLD_TASK_TO_BACK, + false /* alwaysKeepCurrent */); + mDisplayContent.prepareAppTransition(TRANSIT_TO_BACK); moveToBack("moveTaskToBackLocked", tr); if (inPinnedWindowingMode()) { diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index ac86698c630f..d5322eac3886 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -22,8 +22,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANI import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER; import android.annotation.NonNull; import android.os.Binder; @@ -65,7 +65,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe */ private static final int STATE_PLAYING = 2; - final @WindowManager.TransitionType int mType; + final @WindowManager.TransitionOldType int mType; private int mSyncId; private @WindowManager.TransitionFlags int mFlags; private final TransitionController mController; @@ -74,7 +74,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe private int mState = STATE_COLLECTING; private boolean mReadyCalled = false; - Transition(@WindowManager.TransitionType int type, + Transition(@WindowManager.TransitionOldType int type, @WindowManager.TransitionFlags int flags, TransitionController controller) { mType = type; mFlags = flags; @@ -182,7 +182,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe if (dc == null) { return; } - if (transit == TRANSIT_KEYGUARD_GOING_AWAY) { + if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY) { if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0 && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) == 0) { @@ -196,10 +196,10 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe } } } - if (transit == TRANSIT_KEYGUARD_GOING_AWAY - || transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { + if (transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY + || transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { dc.startKeyguardExitOnNonAppWindows( - transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, + transit == TRANSIT_OLD_KEYGUARD_GOING_AWAY_ON_WALLPAPER, (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0, (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_SUBTLE_ANIMATION) != 0); mController.mAtm.mWindowManager.mPolicy.startKeyguardExitAnimation(transit, 0); diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 7cdc177e1b9b..c2fb4cd9f6b3 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -16,13 +16,13 @@ package com.android.server.wm; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_OPEN_BEHIND; -import static android.view.WindowManager.TRANSIT_TASK_TO_BACK; -import static android.view.WindowManager.TRANSIT_TASK_TO_FRONT; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN_BEHIND; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_BACK; +import static android.view.WindowManager.TRANSIT_OLD_TASK_TO_FRONT; import android.annotation.NonNull; import android.annotation.Nullable; @@ -44,9 +44,9 @@ import java.util.Arrays; class TransitionController { private static final String TAG = "TransitionController"; - private static final int[] SUPPORTED_LEGACY_TRANSIT_TYPES = {TRANSIT_TASK_OPEN, - TRANSIT_TASK_CLOSE, TRANSIT_TASK_TO_FRONT, TRANSIT_TASK_TO_BACK, - TRANSIT_TASK_OPEN_BEHIND, TRANSIT_KEYGUARD_GOING_AWAY}; + private static final int[] SUPPORTED_LEGACY_TRANSIT_TYPES = {TRANSIT_OLD_TASK_OPEN, + TRANSIT_OLD_TASK_CLOSE, TRANSIT_OLD_TASK_TO_FRONT, TRANSIT_OLD_TASK_TO_BACK, + TRANSIT_OLD_TASK_OPEN_BEHIND, TRANSIT_OLD_KEYGUARD_GOING_AWAY}; static { Arrays.sort(SUPPORTED_LEGACY_TRANSIT_TYPES); } @@ -79,7 +79,7 @@ class TransitionController { * Creates a transition. It can immediately collect participants. */ @NonNull - Transition createTransition(@WindowManager.TransitionType int type, + Transition createTransition(@WindowManager.TransitionOldType int type, @WindowManager.TransitionFlags int flags) { if (mCollectingTransition != null) { throw new IllegalStateException("Simultaneous transitions not supported yet."); @@ -137,13 +137,13 @@ class TransitionController { * @return the created transition. Collection can start immediately. */ @NonNull - Transition requestTransition(@WindowManager.TransitionType int type) { + Transition requestTransition(@WindowManager.TransitionOldType int type) { return requestTransition(type, 0 /* flags */); } /** @see #requestTransition */ @NonNull - Transition requestTransition(@WindowManager.TransitionType int type, + Transition requestTransition(@WindowManager.TransitionOldType int type, @WindowManager.TransitionFlags int flags) { if (mTransitionPlayer == null) { throw new IllegalStateException("Shell Transitions not enabled"); @@ -169,7 +169,7 @@ class TransitionController { * * @return {@code true} if the transition is handled. */ - boolean adaptLegacyPrepare(@WindowManager.TransitionType int transit, + boolean adaptLegacyPrepare(@WindowManager.TransitionOldType int transit, @WindowManager.TransitionFlags int flags, boolean forceOverride) { if (!isShellTransitionsEnabled() || Arrays.binarySearch(SUPPORTED_LEGACY_TRANSIT_TYPES, transit) < 0) { @@ -180,7 +180,7 @@ class TransitionController { // TODO(shell-transitions): add to flags } else if (forceOverride) { // TODO(shell-transitions): sort out these flags - } else if (transit == TRANSIT_CRASHING_ACTIVITY_CLOSE) { + } else if (transit == TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE) { // TODO(shell-transitions): record crashing } } else { diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index da3a92856fe5..1e938a413212 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -2550,7 +2550,8 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< ProtoLog.d(WM_DEBUG_APP_TRANSITIONS, "Loading animation for app transition. transit=%s enter=%b frame=%s insets=%s " + "surfaceInsets=%s", - AppTransition.appTransitionToString(transit), enter, frame, insets, surfaceInsets); + AppTransition.appTransitionOldToString(transit), enter, frame, insets, + surfaceInsets); final Configuration displayConfig = displayContent.getConfiguration(); final Animation a = getDisplayContent().mAppTransition.loadAnimation(lp, transit, enter, displayConfig.uiMode, displayConfig.orientation, frame, displayFrame, insets, diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 66f2e4d8dc2c..0585679f7fbb 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -78,6 +78,9 @@ import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.REMOVE_CONTENT_MODE_UNDEFINED; +import static android.view.WindowManager.TRANSIT_NONE; +import static android.view.WindowManager.TRANSIT_OLD_NONE; +import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManagerGlobal.ADD_OKAY; import static android.view.WindowManagerGlobal.ADD_TOO_MANY_TOKENS; import static android.view.WindowManagerGlobal.RELAYOUT_DEFER_SURFACE_DESTROY; @@ -254,7 +257,6 @@ import android.view.WindowInsets; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.RemoveContentMode; -import android.view.WindowManager.TransitionType; import android.view.WindowManagerGlobal; import android.view.WindowManagerPolicyConstants.PointerEventListener; import android.window.ClientWindowFrames; @@ -419,6 +421,16 @@ public class WindowManagerService extends IWindowManager.Stub DISABLE_TRIPLE_BUFFERING_PROPERTY, false); /** + * Use new app transit framework. + */ + private static final String USE_NEW_APP_TRANSIT = + "persist.wm.use_new_app_transit"; + /** + * @see #USE_NEW_APP_TRANSIT + */ + static boolean sUseNewAppTransit = SystemProperties.getBoolean(USE_NEW_APP_TRANSIT, false); + + /** * Allows a fullscreen windowing mode activity to launch in its desired orientation directly * when the display has different orientation. */ @@ -1860,8 +1872,9 @@ public class WindowManagerService extends IWindowManager.Stub // animation and piggy-back on existing transition animation infrastructure. final DisplayContent dc = activity.getDisplayContent(); dc.mOpeningApps.add(activity); - dc.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_RELAUNCH, ALWAYS_KEEP_CURRENT, - 0 /* flags */, false /* forceOverride */); + dc.prepareAppTransitionOld(WindowManager.TRANSIT_OLD_ACTIVITY_RELAUNCH, + ALWAYS_KEEP_CURRENT, 0 /* flags */, false /* forceOverride */); + dc.prepareAppTransition(TRANSIT_RELAUNCH); dc.mAppTransition.overridePendingAppTransitionClipReveal(frame.left, frame.top, frame.width(), frame.height()); dc.executeAppTransition(); @@ -1876,8 +1889,9 @@ public class WindowManagerService extends IWindowManager.Stub final DisplayContent dc = activity.getDisplayContent(); if (mDisplayFrozen && !dc.mOpeningApps.contains(activity) && activity.isRelaunching()) { dc.mOpeningApps.add(activity); - dc.prepareAppTransition(WindowManager.TRANSIT_NONE, !ALWAYS_KEEP_CURRENT, 0 /* flags */, + dc.prepareAppTransitionOld(TRANSIT_OLD_NONE, !ALWAYS_KEEP_CURRENT, 0 /* flags */, false /* forceOverride */); + dc.prepareAppTransition(TRANSIT_NONE); dc.executeAppTransition(); } } @@ -2757,14 +2771,14 @@ public class WindowManagerService extends IWindowManager.Stub } // TODO(multi-display): remove when no default display use case. - // (i.e. KeyguardController / RecentsAnimation) - @Override - public void prepareAppTransition(@TransitionType int transit, boolean alwaysKeepCurrent) { + void prepareAppTransitionNone() { if (!checkCallingPermission(MANAGE_APP_TOKENS, "prepareAppTransition()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } - getDefaultDisplayContentLocked().prepareAppTransition(transit, - alwaysKeepCurrent, 0 /* flags */, false /* forceOverride */); + getDefaultDisplayContentLocked().prepareAppTransitionOld(TRANSIT_OLD_NONE, + false /* alwaysKeepCurrent */, + 0 /* flags */, false /* forceOverride */); + getDefaultDisplayContentLocked().prepareAppTransition(TRANSIT_NONE); } @Override @@ -2810,7 +2824,6 @@ public class WindowManagerService extends IWindowManager.Stub // TODO(multi-display): remove when no default display use case. // (i.e. KeyguardController / RecentsAnimation) - @Override public void executeAppTransition() { if (!checkCallingPermission(MANAGE_APP_TOKENS, "executeAppTransition()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index 0111d4883eea..871364569839 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -27,7 +27,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CO import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD; -import static android.view.WindowManager.TRANSIT_NONE; +import static android.view.WindowManager.TRANSIT_OLD_NONE; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_DRAW; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_ORIENTATION; @@ -1075,7 +1075,7 @@ class WindowStateAnimator { } if (attr >= 0) { a = mWin.getDisplayContent().mAppTransition.loadAnimationAttr( - mWin.mAttrs, attr, TRANSIT_NONE); + mWin.mAttrs, attr, TRANSIT_OLD_NONE); } } if (DEBUG_ANIM) Slog.v(TAG, diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index dd4d718084ab..cdeacfb87ccd 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -32,7 +32,7 @@ import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.content.res.Configuration.ORIENTATION_PORTRAIT; import static android.os.Process.NOBODY_UID; import static android.view.Display.DEFAULT_DISPLAY; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; @@ -114,6 +114,7 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.invocation.InvocationOnMock; + /** * Tests for the {@link ActivityRecord} class. * @@ -844,7 +845,8 @@ public class ActivityRecordTests extends WindowTestsBase { assertEquals(PAUSING, mActivity.getState()); verify(mActivity).setVisibility(eq(false)); verify(mActivity.mDisplayContent) - .prepareAppTransition(eq(TRANSIT_TASK_CLOSE), eq(false) /* alwaysKeepCurrent */); + .prepareAppTransitionOld(eq(TRANSIT_OLD_TASK_CLOSE), + eq(false) /* alwaysKeepCurrent */); } /** @@ -888,7 +890,8 @@ public class ActivityRecordTests extends WindowTestsBase { verify(mActivity).setVisibility(eq(false)); verify(mActivity.mDisplayContent) - .prepareAppTransition(eq(TRANSIT_TASK_CLOSE), eq(false) /* alwaysKeepCurrent */); + .prepareAppTransitionOld(eq(TRANSIT_OLD_TASK_CLOSE), + eq(false) /* alwaysKeepCurrent */); verify(mActivity.mDisplayContent, never()).executeAppTransition(); } @@ -904,7 +907,8 @@ public class ActivityRecordTests extends WindowTestsBase { verify(mActivity, atLeast(1)).setVisibility(eq(false)); verify(mActivity.mDisplayContent) - .prepareAppTransition(eq(TRANSIT_TASK_CLOSE), eq(false) /* alwaysKeepCurrent */); + .prepareAppTransitionOld(eq(TRANSIT_OLD_TASK_CLOSE), + eq(false) /* alwaysKeepCurrent */); verify(mActivity.mDisplayContent).executeAppTransition(); } @@ -922,7 +926,8 @@ public class ActivityRecordTests extends WindowTestsBase { mActivity.finishIfPossible("test", false /* oomAdj */); verify(mActivity.mDisplayContent, never()) - .prepareAppTransition(eq(TRANSIT_TASK_CLOSE), eq(false) /* alwaysKeepCurrent */); + .prepareAppTransitionOld(eq(TRANSIT_OLD_TASK_CLOSE), + eq(false) /* alwaysKeepCurrent */); } /** diff --git a/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java index 673feb260dd4..30502d8f1612 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java @@ -20,7 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; -import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -66,7 +66,7 @@ public class AppChangeTransitionTests extends WindowTestsBase { RemoteAnimationDefinition definition = new RemoteAnimationDefinition(); RemoteAnimationAdapter adapter = new RemoteAnimationAdapter(new TestRemoteAnimationRunner(), 10, 1, false); - definition.addRemoteAnimation(TRANSIT_TASK_CHANGE_WINDOWING_MODE, adapter); + definition.addRemoteAnimation(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE, adapter); dc.registerRemoteAnimations(definition); } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java index 1b2192035213..c1212f598f67 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionControllerTest.java @@ -20,10 +20,10 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_TASK_CHANGE_WINDOWING_MODE; -import static android.view.WindowManager.TRANSIT_TASK_CLOSE; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -76,8 +76,9 @@ public class AppTransitionControllerTest extends WindowTestsBase { translucentOpening.setVisible(false); mDisplayContent.mOpeningApps.add(behind); mDisplayContent.mOpeningApps.add(translucentOpening); - assertEquals(WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_OPEN, - mAppTransitionController.maybeUpdateTransitToTranslucentAnim(TRANSIT_TASK_OPEN)); + assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN, + mAppTransitionController.maybeUpdateTransitToTranslucentAnim( + TRANSIT_OLD_TASK_OPEN)); } @Test @@ -89,8 +90,9 @@ public class AppTransitionControllerTest extends WindowTestsBase { WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD); translucentClosing.setOccludesParent(false); mDisplayContent.mClosingApps.add(translucentClosing); - assertEquals(WindowManager.TRANSIT_TRANSLUCENT_ACTIVITY_CLOSE, - mAppTransitionController.maybeUpdateTransitToTranslucentAnim(TRANSIT_TASK_CLOSE)); + assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE, + mAppTransitionController.maybeUpdateTransitToTranslucentAnim( + TRANSIT_OLD_TASK_CLOSE)); } @Test @@ -104,9 +106,9 @@ public class AppTransitionControllerTest extends WindowTestsBase { translucentOpening.setVisible(false); mDisplayContent.mOpeningApps.add(behind); mDisplayContent.mOpeningApps.add(translucentOpening); - assertEquals(TRANSIT_TASK_CHANGE_WINDOWING_MODE, + assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE, mAppTransitionController.maybeUpdateTransitToTranslucentAnim( - TRANSIT_TASK_CHANGE_WINDOWING_MODE)); + TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE)); } @Test @@ -121,11 +123,11 @@ public class AppTransitionControllerTest extends WindowTestsBase { final Task task = opening.getTask(); mDisplayContent.mOpeningApps.add(opening); mDisplayContent.mClosingApps.add(closing); - assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_ACTIVITY_OPEN, task)); + assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_OLD_ACTIVITY_OPEN, task)); closing.getTask().removeChild(closing); task.addChild(closing, 0); - assertTrue(mAppTransitionController.isTransitWithinTask(TRANSIT_ACTIVITY_OPEN, task)); - assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_TASK_OPEN, task)); + assertTrue(mAppTransitionController.isTransitWithinTask(TRANSIT_OLD_ACTIVITY_OPEN, task)); + assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_OLD_TASK_OPEN, task)); } @Test diff --git a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java index ee030af36b8f..485f92f3eef3 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppTransitionTests.java @@ -20,11 +20,11 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; -import static android.view.WindowManager.TRANSIT_CRASHING_ACTIVITY_CLOSE; -import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY; -import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY; +import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; @@ -73,38 +73,40 @@ public class AppTransitionTests extends WindowTestsBase { @Test public void testKeyguardOverride() { - mWm.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); - mWm.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); - assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransition()); + mDc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); + mDc.prepareAppTransitionOld(TRANSIT_OLD_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); + assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransitionOld()); } @Test public void testKeyguardKeep() { - mWm.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); - mWm.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); - assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransition()); + mDc.prepareAppTransitionOld(TRANSIT_OLD_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); + mDc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); + assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransitionOld()); } @Test public void testForceOverride() { - mWm.prepareAppTransition(TRANSIT_KEYGUARD_UNOCCLUDE, false /* alwaysKeepCurrent */); - mDc.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, + mDc.prepareAppTransitionOld(TRANSIT_OLD_KEYGUARD_UNOCCLUDE, false /* alwaysKeepCurrent */); + mDc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */, 0 /* flags */, true /* forceOverride */); - assertEquals(TRANSIT_ACTIVITY_OPEN, mDc.mAppTransition.getAppTransition()); + assertEquals(TRANSIT_OLD_ACTIVITY_OPEN, mDc.mAppTransition.getAppTransitionOld()); } @Test public void testCrashing() { - mWm.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); - mWm.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); - assertEquals(TRANSIT_CRASHING_ACTIVITY_CLOSE, mDc.mAppTransition.getAppTransition()); + mDc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); + mDc.prepareAppTransitionOld(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE, + false /* alwaysKeepCurrent */); + assertEquals(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE, mDc.mAppTransition.getAppTransitionOld()); } @Test public void testKeepKeyguard_withCrashing() { - mWm.prepareAppTransition(TRANSIT_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); - mWm.prepareAppTransition(TRANSIT_CRASHING_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */); - assertEquals(TRANSIT_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransition()); + mDc.prepareAppTransitionOld(TRANSIT_OLD_KEYGUARD_GOING_AWAY, false /* alwaysKeepCurrent */); + mDc.prepareAppTransitionOld(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE, + false /* alwaysKeepCurrent */); + assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY, mDc.mAppTransition.getAppTransitionOld()); } @Test @@ -125,12 +127,12 @@ public class AppTransitionTests extends WindowTestsBase { // Simulate activity resume / finish flows to prepare app transition & set visibility, // make sure transition is set as expected for each display. - dc1.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, + dc1.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */); - assertEquals(TRANSIT_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransition()); - dc2.prepareAppTransition(TRANSIT_ACTIVITY_CLOSE, + assertEquals(TRANSIT_OLD_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransitionOld()); + dc2.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */); - assertEquals(TRANSIT_ACTIVITY_CLOSE, dc2.mAppTransition.getAppTransition()); + assertEquals(TRANSIT_OLD_ACTIVITY_CLOSE, dc2.mAppTransition.getAppTransitionOld()); // One activity window is visible for resuming & the other activity window is invisible // for finishing in different display. activity1.setVisibility(true, false); @@ -158,9 +160,9 @@ public class AppTransitionTests extends WindowTestsBase { dc1.mClosingApps.add(activity1); assertTrue(dc1.mClosingApps.size() > 0); - dc1.prepareAppTransition(TRANSIT_ACTIVITY_OPEN, + dc1.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */); - assertEquals(TRANSIT_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransition()); + assertEquals(TRANSIT_OLD_ACTIVITY_OPEN, dc1.mAppTransition.getAppTransitionOld()); assertTrue(dc1.mAppTransition.isTransitionSet()); dc1.mOpeningApps.add(activity1); @@ -201,9 +203,9 @@ public class AppTransitionTests extends WindowTestsBase { // Simulate activity finish flows to prepare app transition & set visibility, // make sure transition is set as expected. - dc.prepareAppTransition(TRANSIT_ACTIVITY_CLOSE, + dc.prepareAppTransitionOld(TRANSIT_OLD_ACTIVITY_CLOSE, false /* alwaysKeepCurrent */, 0 /* flags */, false /* forceOverride */); - assertEquals(TRANSIT_ACTIVITY_CLOSE, dc.mAppTransition.getAppTransition()); + assertEquals(TRANSIT_OLD_ACTIVITY_CLOSE, dc.mAppTransition.getAppTransitionOld()); dc.mAppTransition.overridePendingAppTransitionRemote(adapter); exitingActivity.setVisibility(false, false); assertTrue(dc.mClosingApps.size() > 0); diff --git a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java index 085b8dec2cb7..6837e0e9248d 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java @@ -32,7 +32,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_ACTIVITY_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_ACTIVITY_OPEN; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; @@ -414,7 +414,7 @@ public class AppWindowTokenTests extends WindowTestsBase { sources.add(activity2); doReturn(true).when(activity2).okToAnimate(); doReturn(true).when(activity2).isAnimating(); - assertTrue(activity2.applyAnimation(null, TRANSIT_ACTIVITY_OPEN, true, false, sources)); + assertTrue(activity2.applyAnimation(null, TRANSIT_OLD_ACTIVITY_OPEN, true, false, sources)); } @Test diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java index 4d0d3b27ee99..c9e56fde0fb9 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java @@ -1169,7 +1169,7 @@ public class DisplayContentTests extends WindowTestsBase { final ActivityRecord app = mAppWindow.mActivityRecord; app.setVisible(false); - mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, + mDisplayContent.prepareAppTransitionOld(WindowManager.TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mDisplayContent.mOpeningApps.add(app); final int newOrientation = getRotatedOrientation(mDisplayContent); @@ -1355,7 +1355,7 @@ public class DisplayContentTests extends WindowTestsBase { final ActivityRecord app = new ActivityBuilder(mAtm).setCreateTask(true).build(); app.setVisible(false); app.setState(Task.ActivityState.RESUMED, "test"); - mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, + mDisplayContent.prepareAppTransitionOld(WindowManager.TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mDisplayContent.mOpeningApps.add(app); final int newOrientation = getRotatedOrientation(mDisplayContent); diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java index f1540731da8b..ce4a5c9d5f51 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -539,7 +539,7 @@ public class SizeCompatTests extends WindowTestsBase { addStatusBar(mActivity.mDisplayContent); mActivity.setVisible(false); - mActivity.mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, + mActivity.mDisplayContent.prepareAppTransitionOld(WindowManager.TRANSIT_OLD_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mActivity.mDisplayContent.mOpeningApps.add(mActivity); final float maxAspect = 1.8f; diff --git a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java index ce22205c75f0..feb509c63ae9 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/TransitionTests.java @@ -18,7 +18,7 @@ package com.android.server.wm; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; @@ -59,7 +59,7 @@ public class TransitionTests extends WindowTestsBase { opening.mVisibleRequested = true; ArrayMap<WindowContainer, Transition.ChangeInfo> participants = new ArrayMap<>(); - int transitType = TRANSIT_TASK_OPEN; + int transitType = TRANSIT_OLD_TASK_OPEN; // Check basic both tasks participating participants.put(oldTask, new Transition.ChangeInfo()); @@ -113,7 +113,7 @@ public class TransitionTests extends WindowTestsBase { opening2.mVisibleRequested = true; ArrayMap<WindowContainer, Transition.ChangeInfo> participants = new ArrayMap<>(); - int transitType = TRANSIT_TASK_OPEN; + int transitType = TRANSIT_OLD_TASK_OPEN; // Check full promotion from leaf participants.put(oldTask, new Transition.ChangeInfo()); @@ -152,7 +152,7 @@ public class TransitionTests extends WindowTestsBase { showing2.mVisibleRequested = true; ArrayMap<WindowContainer, Transition.ChangeInfo> participants = new ArrayMap<>(); - int transitType = TRANSIT_TASK_OPEN; + int transitType = TRANSIT_OLD_TASK_OPEN; // Check promotion to DisplayArea participants.put(showing, new Transition.ChangeInfo()); diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java index 36f3a21e38f1..f5d68894cc4f 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowContainerTests.java @@ -22,7 +22,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED; import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; -import static android.view.WindowManager.TRANSIT_TASK_OPEN; +import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN; import static android.window.DisplayAreaOrganizer.FEATURE_DEFAULT_TASK_CONTAINER; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; @@ -919,7 +919,7 @@ public class WindowContainerTests extends WindowTestsBase { } }, 0, 0, false); adapter.setCallingPidUid(123, 456); - wc.getDisplayContent().prepareAppTransition(TRANSIT_TASK_OPEN, false); + wc.getDisplayContent().prepareAppTransitionOld(TRANSIT_OLD_TASK_OPEN, false); wc.getDisplayContent().mAppTransition.overridePendingAppTransitionRemote(adapter); spyOn(wc); doReturn(true).when(wc).okToAnimate(); @@ -930,7 +930,7 @@ public class WindowContainerTests extends WindowTestsBase { // of the animation. ArrayList<WindowContainer<WindowState>> sources = new ArrayList<>(); sources.add(act); - assertTrue(wc.applyAnimation(null, TRANSIT_TASK_OPEN, true, false, sources)); + assertTrue(wc.applyAnimation(null, TRANSIT_OLD_TASK_OPEN, true, false, sources)); assertEquals(act, wc.getTopMostActivity()); assertTrue(wc.isAnimating()); @@ -943,7 +943,7 @@ public class WindowContainerTests extends WindowTestsBase { // Make sure animation finish callback will be received and reset animating state after // animation finish. - wc.getDisplayContent().mAppTransition.goodToGo(TRANSIT_TASK_OPEN, act, + wc.getDisplayContent().mAppTransition.goodToGo(TRANSIT_OLD_TASK_OPEN, act, mDisplayContent.mOpeningApps); verify(wc).onAnimationFinished(eq(ANIMATION_TYPE_APP_TRANSITION), any()); assertFalse(wc.isAnimating()); diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java index 737665fb97e4..aeb142b901d2 100644 --- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java +++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java @@ -64,26 +64,6 @@ public class WindowManagerPermissionTests extends TestCase { } catch (RemoteException e) { fail("Unexpected remote exception"); } - - try { - mWm.prepareAppTransition(0, false); - fail("IWindowManager.prepareAppTransition did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } - - try { - mWm.executeAppTransition(); - fail("IWindowManager.executeAppTransition did not throw SecurityException as" - + " expected"); - } catch (SecurityException e) { - // expected - } catch (RemoteException e) { - fail("Unexpected remote exception"); - } } @SmallTest |