diff options
4 files changed, 21 insertions, 2 deletions
diff --git a/core/java/android/window/TransitionInfo.java b/core/java/android/window/TransitionInfo.java index 5bfa3d759a66..7c9340e72f72 100644 --- a/core/java/android/window/TransitionInfo.java +++ b/core/java/android/window/TransitionInfo.java @@ -165,6 +165,9 @@ public final class TransitionInfo implements Parcelable { public static final int FLAGS_IS_NON_APP_WINDOW = FLAG_IS_WALLPAPER | FLAG_IS_INPUT_METHOD | FLAG_IS_SYSTEM_WINDOW; + /** The change will not participate in the animation. */ + public static final int FLAGS_IS_OCCLUDED_NO_ANIMATION = FLAG_IS_OCCLUDED | FLAG_NO_ANIMATION; + /** @hide */ @IntDef(prefix = { "FLAG_" }, value = { FLAG_NONE, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index af69b5272ad5..b0d8b47b170a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -757,6 +757,10 @@ public class Transitions implements RemoteCallable<Transitions>, } if (!change.hasFlags(FLAG_IS_OCCLUDED)) { allOccluded = false; + } else if (change.hasAllFlags(TransitionInfo.FLAGS_IS_OCCLUDED_NO_ANIMATION)) { + // Remove the change because it should be invisible in the animation. + info.getChanges().remove(i); + continue; } // The change has already animated by back gesture, don't need to play transition // animation on it. diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 1ce87a7b6af3..145eb3b8464c 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -125,6 +125,7 @@ import static android.view.WindowManager.TRANSIT_CLOSE; import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND; import static android.view.WindowManager.TRANSIT_OLD_UNSET; import static android.view.WindowManager.TRANSIT_RELAUNCH; +import static android.window.TransitionInfo.FLAGS_IS_OCCLUDED_NO_ANIMATION; import static android.window.TransitionInfo.FLAG_IS_OCCLUDED; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; @@ -683,6 +684,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private final WindowState.UpdateReportedVisibilityResults mReportedVisibilityResults = new WindowState.UpdateReportedVisibilityResults(); + // TODO(b/317000737): Replace it with visibility states lookup. int mTransitionChangeFlags; /** Whether we need to setup the animation to animate only within the letterbox. */ @@ -5468,8 +5470,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // Defer committing visibility until transition starts. if (isCollecting) { // It may be occluded by the activity above that calls convertFromTranslucent(). - if (!visible && mTransitionController.inPlayingTransition(this)) { - mTransitionChangeFlags |= FLAG_IS_OCCLUDED; + // Or it may be restoring transient launch to invisible when finishing transition. + if (!visible) { + if (mTransitionController.inPlayingTransition(this)) { + mTransitionChangeFlags |= FLAG_IS_OCCLUDED; + } else if (mTransitionController.inFinishingTransition(this)) { + mTransitionChangeFlags |= FLAGS_IS_OCCLUDED_NO_ANIMATION; + } } return; } diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index f020bfa8cbc7..3117db5f27f0 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -43,6 +43,7 @@ import static android.view.WindowManager.TransitionFlags; import static android.view.WindowManager.TransitionType; import static android.view.WindowManager.transitTypeToString; import static android.window.TaskFragmentAnimationParams.DEFAULT_ANIMATION_BACKGROUND_COLOR; +import static android.window.TransitionInfo.FLAGS_IS_OCCLUDED_NO_ANIMATION; import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS; import static android.window.TransitionInfo.FLAG_FILLS_TASK; import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY; @@ -3067,6 +3068,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { Slog.e(TAG, "Unexpected launch-task-behind operation in shell transition"); flags |= FLAG_TASK_LAUNCHING_BEHIND; } + if ((topActivity.mTransitionChangeFlags & FLAGS_IS_OCCLUDED_NO_ANIMATION) + == FLAGS_IS_OCCLUDED_NO_ANIMATION) { + flags |= FLAGS_IS_OCCLUDED_NO_ANIMATION; + } } if (task.voiceSession != null) { flags |= FLAG_IS_VOICE_INTERACTION; |