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

Commit 2dde31ef authored by Robin Lee's avatar Robin Lee
Browse files

Tweak how we skip transitions for first activity

The first home activity is inserted into a task and then started from
ActivityStarter by Task.startActivityLocked.

Previously we checked for the first ever activity by checking for
isHome (=true) and not hasActivity (=true). This was intended to come
back false if there was no activity before this one. However the
activity is already created by this point so we wrongly treated this
first launch the same as any other launch.

Another way of checking for this condition is to do what the comment
says: see if getActivityBelow(x) exists, if not we have nothing to
animate in on top of.

Bug: 258882804
Change-Id: I6ffa281bad6bf5ffcf738e281c987f3a21a7ace1
parent e34e46d2
Loading
Loading
Loading
Loading
+67 −61
Original line number Diff line number Diff line
@@ -4964,9 +4964,20 @@ class Task extends TaskFragment {
        ProtoLog.i(WM_DEBUG_ADD_REMOVE, "Adding activity %s to task %s "
                        + "callers: %s", r, task, new RuntimeException("here").fillInStackTrace());

        // The transition animation and starting window are not needed if {@code allowMoveToFront}
        // is false, because the activity won't be visible.
        if ((!isActivityTypeHomeOrRecents() || hasActivity()) && allowMoveToFront) {
        if (isActivityTypeHomeOrRecents() && getActivityBelow(r) == null) {
            // If this is the first activity, don't do any fancy animations,
            // because there is nothing for it to animate on top of.
            ActivityOptions.abort(options);
            return;
        }

        if (!allowMoveToFront) {
            // The transition animation and starting window are not needed if
            // {@code allowMoveToFront} is false, because the activity won't be visible.
            ActivityOptions.abort(options);
            return;
        }

        final DisplayContent dc = mDisplayContent;
        if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
                "Prepare open transition: starting " + r);
@@ -5024,11 +5035,6 @@ class Task extends TaskFragment {
            mWmService.mStartingSurfaceController.showStartingWindow(r, prev, newTask,
                    isTaskSwitch, sourceRecord);
        }
        } else {
            // If this is the first activity, don't do any fancy animations,
            // because there is nothing for it to animate on top of.
            ActivityOptions.abort(options);
        }
    }

    /** On Task switch, finds the top activity that supports PiP. */