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

Commit 8a201490 authored by wilsonshih's avatar wilsonshih
Browse files

Do not transfer starting window if requested orientation isn't match.

Redraw splash screen to another orientation can cause flicker because
there is no suitable transition currently, jumpcut to next orientation
also seems bad.
By not transfer starting window, next open transition will happen when
next window has drawn, the starting window can still transfer to next
activity if no any window has drawn during the first open transition.

Bug: 333928700
Test: atest TransitionTests
Test: cold launch app with different orientation request, verify no
flicker happen due to redraw splash screen.

Change-Id: I7d85dbb918e43ffda57ac9602425703a28196911
parent 328fca2c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4643,6 +4643,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                // at #postWindowRemoveCleanupLocked
                return false;
            }
            // Do not transfer if the orientation doesn't match, redraw starting window while it is
            // on top will cause flicker.
            if (fromActivity.getRequestedConfigurationOrientation()
                    != getRequestedConfigurationOrientation()) {
                return false;
            }
            // In this case, the starting icon has already been displayed, so start
            // letting windows get shown immediately without any more transitions.
            if (fromActivity.mVisible) {
+9 −4
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.function.Predicate;

/**
@@ -3254,9 +3253,15 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
                    // Whether this is in a Task with embedded activity.
                    flags |= FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
                }
                if (parentTask.forAllActivities(ActivityRecord::hasStartingWindow)) {
                    // The starting window should cover all windows inside the leaf Task.
                final ActivityRecord starting = parentTask.topActivityContainsStartingWindow();
                if (starting != null) {
                    if (starting == record || (starting.mStartingData != null
                            && starting.mStartingData.mAssociatedTask != null)) {
                        flags |= FLAG_IS_BEHIND_STARTING_WINDOW;
                    } else if (record != null && parentTask.mChildren.indexOf(record)
                            < parentTask.mChildren.indexOf(starting)) {
                        flags |= FLAG_IS_BEHIND_STARTING_WINDOW;
                    }
                }
                if (isWindowFillingTask(wc, parentTask)) {
                    // Whether the container fills its parent Task bounds.
+6 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLESS;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
@@ -1664,7 +1665,11 @@ public class TransitionTests extends WindowTestsBase {
        final Task task = createTask(mDisplayContent);
        final ActivityRecord activity0 = createActivityRecord(task);
        final ActivityRecord activity1 = createActivityRecord(task);
        doReturn(true).when(activity1).hasStartingWindow();
        final WindowManager.LayoutParams attrs =
                new WindowManager.LayoutParams(TYPE_APPLICATION_STARTING);
        final TestWindowState startingWindow = createWindowState(attrs, activity1);
        activity1.mStartingData = mock(StartingData.class);
        activity1.addWindow(startingWindow);

        // Start states.
        changes.put(activity0,