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

Commit 020607df authored by Garfield Tan's avatar Garfield Tan
Browse files

Fix ActivityManagerManifestLayoutTests#testMinimalSizeDocked.

There are 2 bugs causing it to fail. The first one is we refactored the
code so that the way of getting bounds before resizing stopped to work
so we need to explicitly pass previous bounds into
adjustForMinimalTaskDimension(). The second one is getDisplayedBounds()
is not adjusted for minimal task dimension but used to calculate
containing frame.

Bug: 120794631
Test: atest ActivityManagerManifestLayoutTests#testMinimalSizeDocked &
go/wm-smoke.
Change-Id: I5fd9ea17506bbe292b7b68464894d000ddce034e
parent 3e24ffd2
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -4914,7 +4914,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai

        // Update override configurations of all tasks in the stack.
        final Rect taskBounds = tempTaskBounds != null ? tempTaskBounds : bounds;
        final Rect insetBounds = tempTaskInsetBounds != null ? tempTaskInsetBounds : taskBounds;

        mTmpBounds.clear();
        mTmpInsetBounds.clear();
@@ -4922,7 +4921,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        for (int i = mTaskHistory.size() - 1; i >= 0; i--) {
            final TaskRecord task = mTaskHistory.get(i);
            if (task.isResizeable()) {
                task.updateOverrideConfiguration(taskBounds, insetBounds);
                task.updateOverrideConfiguration(taskBounds, tempTaskInsetBounds);
            }

            if (task.hasDisplayedBounds()) {
+8 −5
Original line number Diff line number Diff line
@@ -1716,7 +1716,7 @@ class TaskRecord extends ConfigurationContainer {
        updateTaskDescription();
    }

    private void adjustForMinimalTaskDimensions(Rect bounds) {
    private void adjustForMinimalTaskDimensions(Rect bounds, Rect previousBounds) {
        if (bounds == null) {
            return;
        }
@@ -1747,9 +1747,8 @@ class TaskRecord extends ConfigurationContainer {
            return;
        }

        final Rect configBounds = getRequestedOverrideBounds();
        if (adjustWidth) {
            if (!configBounds.isEmpty() && bounds.right == configBounds.right) {
            if (!previousBounds.isEmpty() && bounds.right == previousBounds.right) {
                bounds.left = bounds.right - minWidth;
            } else {
                // Either left bounds match, or neither match, or the previous bounds were
@@ -1758,7 +1757,7 @@ class TaskRecord extends ConfigurationContainer {
            }
        }
        if (adjustHeight) {
            if (!configBounds.isEmpty() && bounds.bottom == configBounds.bottom) {
            if (!previousBounds.isEmpty() && bounds.bottom == previousBounds.bottom) {
                bounds.top = bounds.bottom - minHeight;
            } else {
                // Either top bounds match, or neither match, or the previous bounds were
@@ -2113,11 +2112,15 @@ class TaskRecord extends ConfigurationContainer {
    // TODO(b/113900640): remove this once ActivityRecord is changed to not need it anymore.
    void computeResolvedOverrideConfiguration(Configuration inOutConfig, Configuration parentConfig,
            Configuration overrideConfig) {
        // Save previous bounds because adjustForMinimalTaskDimensions uses that to determine if it
        // changes left bound vs. right bound, or top bound vs. bottom bound.
        mTmpBounds.set(inOutConfig.windowConfiguration.getBounds());

        inOutConfig.setTo(overrideConfig);

        Rect outOverrideBounds = inOutConfig.windowConfiguration.getBounds();
        if (outOverrideBounds != null && !outOverrideBounds.isEmpty()) {
            adjustForMinimalTaskDimensions(outOverrideBounds);
            adjustForMinimalTaskDimensions(outOverrideBounds, mTmpBounds);

            int windowingMode = overrideConfig.windowConfiguration.getWindowingMode();
            if (windowingMode == WINDOWING_MODE_UNDEFINED) {