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

Commit 724a6ecd authored by Rachit Jain's avatar Rachit Jain
Browse files

Defer resume of activity while applying wct

When the hierarchy is changing, defer resuming the activity until it is
ready to let it finish processing the wct.

If the activity does not wait, there will be extra lifecycle states even
if they are applied in the same wct. Update test to not defer resume at
the start.

Flag: EXEMPT (bug fix)
Bug: 369186876
Test: atest CtsWindowManagerDeviceActivity com.android.server.wm.ActivityTaskManagerServiceTests
Change-Id: I2f564f4b7245de94871999a4da122489dba7fd7d
parent ab8211ad
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2280,6 +2280,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
     * sent to the new top resumed activity.
     */
    ActivityRecord updateTopResumedActivityIfNeeded(String reason) {
        if (!readyToResume()) {
            return mTopResumedActivity;
        }
        final ActivityRecord prevTopActivity = mTopResumedActivity;
        final Task topRootTask = mRootWindowContainer.getTopDisplayFocusedRootTask();
        if (topRootTask == null || topRootTask.getTopResumedActivity() == prevTopActivity) {
+0 −2
Original line number Diff line number Diff line
@@ -382,13 +382,11 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase {

    @Test
    public void testResumeNextActivityOnCrashedAppDied() {
        mSupervisor.beginDeferResume();
        final ActivityRecord homeActivity = new ActivityBuilder(mAtm)
                .setTask(mRootWindowContainer.getDefaultTaskDisplayArea().getOrCreateRootHomeTask())
                .build();
        final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
        activity.setState(RESUMED, "test");
        mSupervisor.endDeferResume();

        assertEquals(activity.app, mAtm.mInternal.getTopApp());