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

Commit 5a24a59d authored by Charles Chen's avatar Charles Chen
Browse files

Verify DisplayArea bounds in WindowMetricsTests

Also add some test APIs to report max bounds value.

Test: atest WindowMetricsTests
Bug: 151414021
Change-Id: I6d0127925d51d2bd2b2879ce133504a46c66350e
parent 68d02e9a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -549,11 +549,13 @@ package android.app {
    method public int getActivityType();
    method public android.graphics.Rect getAppBounds();
    method public android.graphics.Rect getBounds();
    method @NonNull public android.graphics.Rect getMaxBounds();
    method public int getRotation();
    method public int getWindowingMode();
    method public void setActivityType(int);
    method public void setAppBounds(android.graphics.Rect);
    method public void setBounds(android.graphics.Rect);
    method public void setMaxBounds(@Nullable android.graphics.Rect);
    method public void setRotation(int);
    method public void setTo(android.app.WindowConfiguration);
    method public void setWindowingMode(int);
+2 −5
Original line number Diff line number Diff line
@@ -310,7 +310,6 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
     * Sets the maximum bounds to the provided {@link Rect}.
     * @param rect the new bounds value.
     * @see #getMaxBounds()
     * @hide
     */
    public void setMaxBounds(@Nullable Rect rect) {
        if (rect == null) {
@@ -364,10 +363,8 @@ public class WindowConfiguration implements Parcelable, Comparable<WindowConfigu
        return mBounds;
    }

    /**
     * @see #setMaxBounds(Rect)
     * @hide
     */
    /** @see #setMaxBounds(Rect) */
    @NonNull
    public Rect getMaxBounds() {
        return mMaxBounds;
    }
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ message DisplayAreaProto {
    optional WindowContainerProto window_container = 1;
    optional string name = 2 [ (.android.privacy).dest = DEST_EXPLICIT ];
    repeated DisplayAreaChildProto children = 3 [deprecated=true];
    optional bool is_task_display_area = 4;
}

/* represents a generic child of a DisplayArea */
+6 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.window.DisplayAreaOrganizer.FEATURE_UNDEFINED;
import static android.window.DisplayAreaOrganizer.FEATURE_WINDOW_TOKENS;

import static com.android.internal.util.Preconditions.checkState;
import static com.android.server.wm.DisplayAreaProto.IS_TASK_DISPLAY_AREA;
import static com.android.server.wm.DisplayAreaProto.NAME;
import static com.android.server.wm.DisplayAreaProto.WINDOW_CONTAINER;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_ORIENTATION;
@@ -194,6 +195,7 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
        final long token = proto.start(fieldId);
        super.dumpDebug(proto, WINDOW_CONTAINER, logLevel);
        proto.write(NAME, mName);
        proto.write(IS_TASK_DISPLAY_AREA, isTaskDisplayArea());
        proto.end(token);
    }

@@ -354,6 +356,10 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
        return true;
    }

    protected boolean isTaskDisplayArea() {
        return false;
    }

    /**
     * DisplayArea that contains WindowTokens, and orders them according to their type.
     */
+4 −0
Original line number Diff line number Diff line
@@ -1880,6 +1880,10 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
        return lastReparentedStack;
    }

    @Override
    protected boolean isTaskDisplayArea() {
        return true;
    }

    @Override
    void dump(PrintWriter pw, String prefix, boolean dumpAll) {