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

Commit 60e7de86 authored by Louis Chang's avatar Louis Chang
Browse files

Reset mCurrentLaunchCanTurnScreenOn state after transition finishes

When the freeform Activity started, the wm shell also started the
Desktop Windowing mode and launched a DesktopWallpaperActivity on
top in the same transition, which unexpectedly resets the state.
Therefore, the freeform activity was unable to turn the screen on,
even the freeform task was also reordered to top in the same
transition.

Bug: 343450217
Test: ActivityVisibilityTests#testTurnScreenOnWithAttr_Freeform
Change-Id: I64d602770cbb5c8c82d113594f36b7894945bfc7
parent 18bc6e82
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -1365,18 +1365,6 @@ class ActivityStarter {
            request.outActivity[0] = mLastStartActivityRecord;
        }

        // Reset the ActivityRecord#mCurrentLaunchCanTurnScreenOn state of activity started
        // before this one if it is no longer the top-most focusable activity.
        // Doing so in case the state is not yet consumed during rapid activity launch.
        if (previousStart != null && !previousStart.finishing && previousStart.isAttached()
                && previousStart.currentLaunchCanTurnScreenOn()) {
            final ActivityRecord topFocusable = previousStart.getDisplayContent().getActivity(
                    ar -> ar.isFocusable() && !ar.finishing);
            if (previousStart != topFocusable) {
                previousStart.setCurrentLaunchCanTurnScreenOn(false);
            }
        }

        return mLastStartActivityResult;
    }

+11 −2
Original line number Diff line number Diff line
@@ -1374,13 +1374,22 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        // processed all the participants first (in particular, we want to trigger pip-enter first)
        for (int i = 0; i < mParticipants.size(); ++i) {
            final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
            if (ar == null) continue;

            // If the activity was just inserted to an invisible task, it will keep INITIALIZING
            // state. Then no need to notify the callback to avoid clearing some states
            // unexpectedly, e.g. launch-task-behind.
            if (ar != null && (ar.isVisibleRequested()
                    || !ar.isState(ActivityRecord.State.INITIALIZING))) {
            if (ar.isVisibleRequested() || !ar.isState(ActivityRecord.State.INITIALIZING)) {
                mController.dispatchLegacyAppTransitionFinished(ar);
            }

            // Reset the ActivityRecord#mCurrentLaunchCanTurnScreenOn state if it is not the top
            // running activity. Doing so in case the state is not yet consumed during rapid
            // activity launch.
            if (ar.currentLaunchCanTurnScreenOn() && ar.getDisplayContent() != null
                    && ar.getDisplayContent().topRunningActivity() != ar) {
                ar.setCurrentLaunchCanTurnScreenOn(false);
            }
        }

        // Update the input-sink (touch-blocking) state now that the animation is finished.