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

Commit 13787213 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Reset mCurrentLaunchCanTurnScreenOn state after new Activity launched" into main

parents fbadf094 8d30f5da
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -936,13 +936,8 @@ class ActivityStarter {
        }
        mLastStartReason = request.reason;
        mLastStartActivityTimeMs = System.currentTimeMillis();
        // Reset the ActivityRecord#mCurrentLaunchCanTurnScreenOn state of last start activity in
        // case the state is not yet consumed during rapid activity launch.
        if (mLastStartActivityRecord != null) {
            mLastStartActivityRecord.setCurrentLaunchCanTurnScreenOn(false);
        }
        mLastStartActivityRecord = null;

        final ActivityRecord previousStart = mLastStartActivityRecord;
        final IApplicationThread caller = request.caller;
        Intent intent = request.intent;
        NeededUriGrants intentGrants = request.intentGrants;
@@ -1370,6 +1365,18 @@ 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;
    }