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

Commit 5be69389 authored by Louis Chang's avatar Louis Chang
Browse files

Defer resuming activity while applying WCT

The WCT ought to be an atomic operation, so it should make sense
to defer the activity resuming while processing the ops.

If the activity has to be relaunched while applying the WCT,
still relaunching it to the RESUMED state if it is currently in
the RESUMED state.

Bug: 345189844
Test: atest ActivityLifecycleFreeformTests
Change-Id: I7c47d3210081c22820da850d84e304952bc66875
parent 18bc6e82
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10278,7 +10278,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (rootTask != null && rootTask.mTranslucentActivityWaiting == this) {
            rootTask.checkTranslucentActivityWaiting(null);
        }
        final boolean andResume = shouldBeResumed(null /*activeActivity*/);
        final boolean andResume = isState(RESUMED) || shouldBeResumed(null /*activeActivity*/);
        List<ResultInfo> pendingResults = null;
        List<ReferrerIntent> pendingNewIntents = null;
        if (andResume) {
+7 −0
Original line number Diff line number Diff line
@@ -609,6 +609,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
        int effects = TRANSACT_EFFECTS_NONE;
        ProtoLog.v(WM_DEBUG_WINDOW_ORGANIZER, "Apply window transaction, syncId=%d", syncId);
        mService.deferWindowLayout();
        mService.mTaskSupervisor.beginDeferResume();
        boolean deferResume = true;
        mService.mTaskSupervisor.setDeferRootVisibilityUpdate(true /* deferUpdate */);
        final boolean shouldDeferTransitionReady = transition != null && !t.isEmpty()
                && (transition.isCollecting() || Flags.alwaysDeferTransitionWhenApplyWct());
@@ -750,6 +752,8 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            }
            if ((effects & TRANSACT_EFFECTS_LIFECYCLE) != 0) {
                mService.mTaskSupervisor.setDeferRootVisibilityUpdate(false /* deferUpdate */);
                mService.mTaskSupervisor.endDeferResume();
                deferResume = false;
                // Already calls ensureActivityConfig
                mService.mRootWindowContainer.ensureActivitiesVisible();
                mService.mRootWindowContainer.resumeFocusedTasksTopActivities();
@@ -771,6 +775,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                transition.continueTransitionReady();
            }
            mService.mTaskSupervisor.setDeferRootVisibilityUpdate(false /* deferUpdate */);
            if (deferResume) {
                mService.mTaskSupervisor.endDeferResume();
            }
            mService.continueWindowLayout();
        }
        return effects;