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

Commit 44258880 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Ignore invisible activity change from finishing transition" into main

parents f2eec5c4 928af5db
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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,
+4 −0
Original line number Diff line number Diff line
@@ -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.
+9 −2
Original line number Diff line number Diff line
@@ -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)) {
            // 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;
        }
+5 −0
Original line number Diff line number Diff line
@@ -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;