Loading core/java/android/window/TransitionInfo.java +5 −1 Original line number Diff line number Diff line Loading @@ -149,8 +149,11 @@ public final class TransitionInfo implements Parcelable { /** The task is launching behind home. */ public static final int FLAG_TASK_LAUNCHING_BEHIND = 1 << 19; /** The task became the top-most task even if it didn't change visibility. */ public static final int FLAG_MOVED_TO_TOP = 1 << 20; /** The first unused bit. This can be used by remotes to attach custom flags to this change. */ public static final int FLAG_FIRST_CUSTOM = 1 << 20; public static final int FLAG_FIRST_CUSTOM = 1 << 21; /** The change belongs to a window that won't contain activities. */ public static final int FLAGS_IS_NON_APP_WINDOW = Loading Loading @@ -179,6 +182,7 @@ public final class TransitionInfo implements Parcelable { FLAG_BACK_GESTURE_ANIMATED, FLAG_NO_ANIMATION, FLAG_TASK_LAUNCHING_BEHIND, FLAG_MOVED_TO_TOP, FLAG_FIRST_CUSTOM }) public @interface ChangeFlags {} Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +8 −4 Original line number Diff line number Diff line Loading @@ -456,9 +456,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { cancel(mWillFinishToHome); return; } // Don't consider order-only changes as changing apps. if (!TransitionUtil.isOrderOnly(change)) { hasChangingApp = true; } } } if (hasChangingApp && foundRecentsClosing) { // This happens when a visible app is expanding (usually PiP). In this case, // that transition probably has a special-purpose animation, so finish recents Loading @@ -484,13 +487,14 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { } boolean didMergeThings = false; if (closingTasks != null) { // Cancelling a task-switch. Move the tasks back to mPausing from mOpening // Potentially cancelling a task-switch. Move the tasks back to mPausing if they // are in mOpening. for (int i = 0; i < closingTasks.size(); ++i) { final TransitionInfo.Change change = closingTasks.get(i); int openingIdx = TaskState.indexOf(mOpeningTasks, change); if (openingIdx < 0) { Slog.e(TAG, "Back to existing recents animation from an unrecognized " + "task: " + change.getTaskInfo().taskId); Slog.w(TAG, "Closing a task that wasn't opening, this may be split or" + " something unexpected: " + change.getTaskInfo().taskId); continue; } mPausingTasks.add(mOpeningTasks.remove(openingIdx)); Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -301,8 +301,8 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return true; } // check if no-animation and skip animation if so. if (Transitions.isAllNoAnimation(info)) { // Early check if the transition doesn't warrant an animation. if (Transitions.isAllNoAnimation(info) || Transitions.isAllOrderOnly(info)) { startTransaction.apply(); finishTransaction.apply(); finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */); Loading libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +10 −0 Original line number Diff line number Diff line Loading @@ -516,6 +516,16 @@ public class Transitions implements RemoteCallable<Transitions> { return hasNoAnimation; } /** * Check if all changes in this transition are only ordering changes. If so, we won't animate. */ static boolean isAllOrderOnly(TransitionInfo info) { for (int i = info.getChanges().size() - 1; i >= 0; --i) { if (!TransitionUtil.isOrderOnly(info.getChanges().get(i))) return false; } return true; } @VisibleForTesting void onTransitionReady(@NonNull IBinder transitionToken, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { Loading libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java +10 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_DISPLAY; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_MOVED_TO_TOP; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR; Loading Loading @@ -90,6 +91,15 @@ public class TransitionUtil { && !change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY); } /** Returns `true` if `change` is only re-ordering. */ public static boolean isOrderOnly(TransitionInfo.Change change) { return change.getMode() == TRANSIT_CHANGE && (change.getFlags() & FLAG_MOVED_TO_TOP) != 0 && change.getStartAbsBounds().equals(change.getEndAbsBounds()) && (change.getLastParent() == null || change.getLastParent().equals(change.getParent())); } /** * Filter that selects leaf-tasks only. THIS IS ORDER-DEPENDENT! For it to work properly, you * MUST call `test` in the same order that the changes appear in the TransitionInfo. Loading Loading
core/java/android/window/TransitionInfo.java +5 −1 Original line number Diff line number Diff line Loading @@ -149,8 +149,11 @@ public final class TransitionInfo implements Parcelable { /** The task is launching behind home. */ public static final int FLAG_TASK_LAUNCHING_BEHIND = 1 << 19; /** The task became the top-most task even if it didn't change visibility. */ public static final int FLAG_MOVED_TO_TOP = 1 << 20; /** The first unused bit. This can be used by remotes to attach custom flags to this change. */ public static final int FLAG_FIRST_CUSTOM = 1 << 20; public static final int FLAG_FIRST_CUSTOM = 1 << 21; /** The change belongs to a window that won't contain activities. */ public static final int FLAGS_IS_NON_APP_WINDOW = Loading Loading @@ -179,6 +182,7 @@ public final class TransitionInfo implements Parcelable { FLAG_BACK_GESTURE_ANIMATED, FLAG_NO_ANIMATION, FLAG_TASK_LAUNCHING_BEHIND, FLAG_MOVED_TO_TOP, FLAG_FIRST_CUSTOM }) public @interface ChangeFlags {} Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +8 −4 Original line number Diff line number Diff line Loading @@ -456,9 +456,12 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { cancel(mWillFinishToHome); return; } // Don't consider order-only changes as changing apps. if (!TransitionUtil.isOrderOnly(change)) { hasChangingApp = true; } } } if (hasChangingApp && foundRecentsClosing) { // This happens when a visible app is expanding (usually PiP). In this case, // that transition probably has a special-purpose animation, so finish recents Loading @@ -484,13 +487,14 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { } boolean didMergeThings = false; if (closingTasks != null) { // Cancelling a task-switch. Move the tasks back to mPausing from mOpening // Potentially cancelling a task-switch. Move the tasks back to mPausing if they // are in mOpening. for (int i = 0; i < closingTasks.size(); ++i) { final TransitionInfo.Change change = closingTasks.get(i); int openingIdx = TaskState.indexOf(mOpeningTasks, change); if (openingIdx < 0) { Slog.e(TAG, "Back to existing recents animation from an unrecognized " + "task: " + change.getTaskInfo().taskId); Slog.w(TAG, "Closing a task that wasn't opening, this may be split or" + " something unexpected: " + change.getTaskInfo().taskId); continue; } mPausingTasks.add(mOpeningTasks.remove(openingIdx)); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +2 −2 Original line number Diff line number Diff line Loading @@ -301,8 +301,8 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return true; } // check if no-animation and skip animation if so. if (Transitions.isAllNoAnimation(info)) { // Early check if the transition doesn't warrant an animation. if (Transitions.isAllNoAnimation(info) || Transitions.isAllOrderOnly(info)) { startTransaction.apply(); finishTransaction.apply(); finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +10 −0 Original line number Diff line number Diff line Loading @@ -516,6 +516,16 @@ public class Transitions implements RemoteCallable<Transitions> { return hasNoAnimation; } /** * Check if all changes in this transition are only ordering changes. If so, we won't animate. */ static boolean isAllOrderOnly(TransitionInfo info) { for (int i = info.getChanges().size() - 1; i >= 0; --i) { if (!TransitionUtil.isOrderOnly(info.getChanges().get(i))) return false; } return true; } @VisibleForTesting void onTransitionReady(@NonNull IBinder transitionToken, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java +10 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static android.view.WindowManager.TRANSIT_TO_FRONT; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; import static android.window.TransitionInfo.FLAG_IS_DISPLAY; import static android.window.TransitionInfo.FLAG_IS_WALLPAPER; import static android.window.TransitionInfo.FLAG_MOVED_TO_TOP; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR; Loading Loading @@ -90,6 +91,15 @@ public class TransitionUtil { && !change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY); } /** Returns `true` if `change` is only re-ordering. */ public static boolean isOrderOnly(TransitionInfo.Change change) { return change.getMode() == TRANSIT_CHANGE && (change.getFlags() & FLAG_MOVED_TO_TOP) != 0 && change.getStartAbsBounds().equals(change.getEndAbsBounds()) && (change.getLastParent() == null || change.getLastParent().equals(change.getParent())); } /** * Filter that selects leaf-tasks only. THIS IS ORDER-DEPENDENT! For it to work properly, you * MUST call `test` in the same order that the changes appear in the TransitionInfo. Loading