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

Commit 56327ff9 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Revert^2 "Reduce unnecessary visibility update after resumed"

When starting/resuming activity, ensureVisibilityAndConfig has
already done the update. The invocation in completeResumeLocked
is just duplicated.

This reverts commit cc946a4d.
Previously the updateCompatDisplayInsets is called from
ensureActivitiesVisible -> ensureActivityConfiguration
-> updateReportedConfigurationAndSend. Which intends to
capture the configuration in a stable state. So now only
need to call updateCompatDisplayInsets directly.

Bug: 297502610
Test: ActivityRecordTests#testCompleteResume_updateCompatDisplayInsets
Test: WMShellFlickerTestsOther:RestartAppInSizeCompatModeTest# \
          appWindowRemainInsideVisibleBounds
Test: CtsStatsdAtomHostTestCases:SizeCompatRestartButtonStatsTests# \
          testSizeCompatRestartButtonAppearedButNotClicked

Change-Id: I2537b1b8e3484188eead3eae5e0d534a67a72e70
parent cc946a4d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -6541,7 +6541,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // Schedule an idle timeout in case the app doesn't do it for us.
        mTaskSupervisor.scheduleIdleTimeout(this);
        mTaskSupervisor.reportResumedActivityLocked(this);
        mTaskSupervisor.mStoppingActivities.remove(this);
        if (getDisplayArea().allResumedActivitiesComplete()) {
            // Construct the compat environment at a relatively stable state if needed.
            updateCompatDisplayInsets();
            mRootWindowContainer.executeAppTransitionForAllDisplay();
        }
        resumeKeyDispatchingLocked();
        final Task rootTask = getRootTask();
+0 −15
Original line number Diff line number Diff line
@@ -2064,21 +2064,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        }
    }

    boolean reportResumedActivityLocked(ActivityRecord r) {
        // A resumed activity cannot be stopping. remove from list
        mStoppingActivities.remove(r);

        final Task rootTask = r.getRootTask();
        if (rootTask.getDisplayArea().allResumedActivitiesComplete()) {
            mRootWindowContainer.ensureActivitiesVisible();
            // Make sure activity & window visibility should be identical
            // for all displays in this stage.
            mRootWindowContainer.executeAppTransitionForAllDisplay();
            return true;
        }
        return false;
    }

    // Called when WindowManager has finished animating the launchingBehind activity to the back.
    private void handleLaunchTaskBehindCompleteLocked(ActivityRecord r) {
        final Task task = r.getTask();
+2 −0
Original line number Diff line number Diff line
@@ -1894,6 +1894,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            // Don't do recursive work.
            return;
        }
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "RWC_ensureActivitiesVisible");
        mTaskSupervisor.beginActivityVisibilityUpdate();
        try {
            // First the front root tasks. In case any are not fullscreen and are in front of home.
@@ -1903,6 +1904,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            }
        } finally {
            mTaskSupervisor.endActivityVisibilityUpdate();
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
    }

+9 −0
Original line number Diff line number Diff line
@@ -1639,6 +1639,15 @@ public class ActivityRecordTests extends WindowTestsBase {
        clearInvocations(mDefaultDisplay);
    }

    @Test
    public void testCompleteResume_updateCompatDisplayInsets() {
        final ActivityRecord activity = new ActivityBuilder(mAtm).setCreateTask(true).build();
        doReturn(true).when(activity).shouldCreateCompatDisplayInsets();
        activity.setState(RESUMED, "test");
        activity.completeResumeLocked();
        assertNotNull(activity.getCompatDisplayInsets());
    }

    /**
     * Verify destroy activity request completes successfully.
     */