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

Commit 31c41f49 authored by Louis Chang's avatar Louis Chang
Browse files

Consolidate fillsParentBounds with matchParentBounds

Bug: 409417223
Test: TaskFragmentTest
Test: wm presubmit
Flag: com.android.window.flags.refactor_match_parent_bounds
Change-Id: I7e9994b35e6f2d12e6460eb944a68255b2e8a51b
parent bcd480d7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -177,6 +177,16 @@ flag {
    }
}

flag {
    namespace: "windowing_sdk"
    name: "refactor_match_parent_bounds"
    description: "Consolidate fillsParentBounds with matchParentBounds."
    bug: "409417223"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "fix_bal_reparent_existing_task"
+10 −3
Original line number Diff line number Diff line
@@ -441,12 +441,19 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
     * Indicates whether this container chooses not to override any bounds from its parent, either
     * because it doesn't request to override them or the request is dropped during configuration
     * resolution. In this case, it will inherit the bounds of the first ancestor which specifies a
     * bounds subject to policy constraints.
     * bounds subject to policy constraints. Or this container is fullscreen windowingMode.
     *
     * @return {@code true} if this container level uses bounds from parent level. {@code false}
     *         otherwise.
     * @return {@code true} if this container level uses bounds from parent level, or is
     *         fullscreen. {@code false} otherwise.
     */
    public boolean matchParentBounds() {
        if (!com.android.window.flags.Flags.refactorMatchParentBounds()) {
            return getResolvedOverrideBounds().isEmpty();
        }

        final int windowingMode = getWindowingMode();
        if (windowingMode == WINDOWING_MODE_PINNED) return false;
        if (windowingMode == WINDOWING_MODE_FULLSCREEN) return true;
        return getResolvedOverrideBounds().isEmpty();
    }

+8 −4
Original line number Diff line number Diff line
@@ -3399,12 +3399,16 @@ class TaskFragment extends WindowContainer<WindowContainer> {

    @Override
    boolean fillsParent() {
        if (!com.android.window.flags.Flags.refactorMatchParentBounds()) {
            // From the perspective of policy, we still want to report that this task fills parent
        // in fullscreen windowing mode even it doesn't match parent bounds because there will be
        // letterbox around its real content.
            // in fullscreen windowing mode even it doesn't match parent bounds because there
            // will be letterbox around its real content.
            return getWindowingMode() == WINDOWING_MODE_FULLSCREEN || matchParentBounds();
        }

        return matchParentBounds();
    }

    @Override
    protected boolean onChildVisibleRequestedChanged(@Nullable WindowContainer child) {
        if (!super.onChildVisibleRequestedChanged(child)) return false;
+7 −4
Original line number Diff line number Diff line
@@ -1650,13 +1650,16 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
     * lifecycle. A container may fill its parent but have no content in it, so it would be
     * equivalent to not existing.
     *
     * TODO(b/409417223): Consolidate with {@link #matchParentBounds}.
     * TODO b/409417223 - remove this method and replace it with #matchParentBounds
     */
    boolean fillsParentBounds() {
        if (!com.android.window.flags.Flags.refactorMatchParentBounds()) {
            final int windowingMode = getWindowingMode();
            return windowingMode == WINDOWING_MODE_FULLSCREEN
                    || (windowingMode != WINDOWING_MODE_PINNED && matchParentBounds());
        }
        return matchParentBounds();
    }

    /**
     * Returns true if this container or its children have content that fills it.
+1 −0
Original line number Diff line number Diff line
@@ -1036,6 +1036,7 @@ public class TaskFragmentTest extends WindowTestsBase {
        final TaskFragment tf = createTaskFragmentWithActivity(task);
        final ActivityRecord activity = tf.getTopMostActivity();
        tf.setVisibleRequested(true);
        activity.visibleIgnoringKeyguard = true;
        tf.setOverrideOrientation(SCREEN_ORIENTATION_BEHIND);

        // Should report the override orientation