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

Commit bcfd23e7 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Allow associating the starting window after a trampoline launches.

An app can create a task fragment from a trampoline activity after the
initial launch. If the initial transition has already occurred, the
starting window cannot be associated with the task because the task
will not participate in the follow-up transition. By checking whether
the task's bounds equal the activity's bounds, we can determine if the
currently launched activity is in an adjacent embedded.

This also avoids transferring the starting window between activities of
different sizes, as redrawing it in such cases can look strange.

Bug: 439021625
Flag: EXEMPT bugfix
Test: cold launch with sample app several times and verify no flicker.

Change-Id: I261722cc466f51d8c3557e1dcbeee2800519ddb5
parent 5230bd5d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -350,6 +350,7 @@ import com.android.server.uri.NeededUriGrants;
import com.android.server.uri.UriPermissionOwner;
import com.android.server.wm.ActivityMetricsLogger.TransitionInfoSnapshot;
import com.android.server.wm.WindowManagerService.H;
import com.android.server.wm.utils.RegionUtils;
import com.android.window.flags.Flags;

import dalvik.annotation.optimization.NeverCompile;
@@ -2701,7 +2702,7 @@ final class ActivityRecord extends WindowToken {
                || mStartingData.mAssociatedTask != null) {
            return;
        }
        if (task.isVisible() && !task.inTransition()) {
        if (task.isVisible() && !task.inTransition() && !task.getBounds().equals(getBounds())) {
            // Don't associated with task if the task is visible especially when the activity is
            // embedded. We just need to show splash screen on the activity in case the first frame
            // is not ready.
@@ -4536,7 +4537,11 @@ final class ActivityRecord extends WindowToken {
            }
            // Do not transfer if the orientation doesn't match, redraw starting window while it is
            // on top will cause flicker.
            if (!isStartingOrientationCompatible(fromActivity)) {
            if (!isStartingOrientationCompatible(fromActivity)
                    // Also, do not transfer if the sizes of the activities are different and the
                    // starting window is not attached to the task.
                    || (fromActivity.mStartingData.mAssociatedTask == null
                    && !RegionUtils.sizeEquals(fromActivity.getBounds(), getBounds()))) {
                return false;
            }