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

Commit b73471b4 authored by Tiger Huang's avatar Tiger Huang
Browse files

Remove legacy frames from WindowFrames and DisplayFrames

These frames are used for computing the legacy insets which won't be
used anymore. We should only maintain the new insets system now.

This CL also unhides Rect#inset APIs.

Bug: 149813814
Test: atest WindowFrameTests DisplayPolicyLayoutTests InsetsPolicyTest
            SplashscreenTests ManifestLayoutTests WindowMetricsTests
            WindowInsetsAnimationImeTests WindowInsetsControllerTests
            WindowUntrustedTouchTest DisplayContentTests
Change-Id: I06e40be6342b2ae35f7cc3e6f4ebdbe68edf0499
parent 781e61d2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15483,6 +15483,8 @@ package android.graphics {
    method @NonNull public String flattenToString();
    method public int height();
    method public void inset(int, int);
    method public void inset(@NonNull android.graphics.Insets);
    method public void inset(int, int, int, int);
    method @CheckResult public boolean intersect(int, int, int, int);
    method @CheckResult public boolean intersect(@NonNull android.graphics.Rect);
    method public boolean intersects(int, int, int, int);
+16 −0
Original line number Diff line number Diff line
@@ -238,6 +238,22 @@ public class InsetsState implements Parcelable {
                (legacySystemUiFlags & SYSTEM_UI_FLAG_LAYOUT_STABLE) != 0);
    }

    public Rect calculateInsets(Rect frame, @InsetsType int types, boolean ignoreVisibility) {
        Insets insets = Insets.NONE;
        for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
            InsetsSource source = mSources[type];
            if (source == null) {
                continue;
            }
            int publicType = InsetsState.toPublicType(type);
            if ((publicType & types) == 0) {
                continue;
            }
            insets = Insets.max(source.calculateInsets(frame, ignoreVisibility), insets);
        }
        return insets.toRect();
    }

    public Rect calculateVisibleInsets(Rect frame, @SoftInputModeFlags int softInputMode) {
        Insets insets = Insets.NONE;
        for (int type = FIRST_TYPE; type <= LAST_TYPE; type++) {
+9 −8
Original line number Diff line number Diff line
@@ -1023,6 +1023,15 @@ public final class ViewRootImpl implements ViewParent,
                }
                mForceDecorViewVisibility = (mWindowAttributes.privateFlags
                        & PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY) != 0;

                if (mView instanceof RootViewSurfaceTaker) {
                    PendingInsetsController pendingInsetsController =
                            ((RootViewSurfaceTaker) mView).providePendingInsetsController();
                    if (pendingInsetsController != null) {
                        pendingInsetsController.replayAndAttach(mInsetsController);
                    }
                }

                try {
                    mOrigWindowType = mWindowAttributes.type;
                    mAttachInfo.mRecomputeGlobalAttributes = true;
@@ -1160,14 +1169,6 @@ public final class ViewRootImpl implements ViewParent,
                mFirstInputStage = nativePreImeStage;
                mFirstPostImeInputStage = earlyPostImeStage;
                mPendingInputEventQueueLengthCounterName = "aq:pending:" + counterSuffix;

                if (mView instanceof RootViewSurfaceTaker) {
                    PendingInsetsController pendingInsetsController =
                            ((RootViewSurfaceTaker) mView).providePendingInsetsController();
                    if (pendingInsetsController != null) {
                        pendingInsetsController.replayAndAttach(mInsetsController);
                    }
                }
            }
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -1344,6 +1344,9 @@ public final class WindowInsets {
            if ((types & NAVIGATION_BARS) != 0) {
                result.append("navigationBars |");
            }
            if ((types & CAPTION_BAR) != 0) {
                result.append("captionBar |");
            }
            if ((types & IME) != 0) {
                result.append("ime |");
            }
+9 −9
Original line number Diff line number Diff line
@@ -239,9 +239,9 @@ message DisplayAreaChildProto {
message DisplayFramesProto {
    option (.android.msg_privacy).dest = DEST_AUTOMATIC;

    optional .android.graphics.RectProto stable_bounds = 1;
    optional .android.graphics.RectProto dock = 2;
    optional .android.graphics.RectProto current = 3;
    optional .android.graphics.RectProto stable_bounds = 1 [deprecated=true];
    optional .android.graphics.RectProto dock = 2 [deprecated=true];
    optional .android.graphics.RectProto current = 3 [deprecated=true];
}

message DisplayRotationProto {
@@ -499,19 +499,19 @@ message WindowFramesProto {
    option (.android.msg_privacy).dest = DEST_AUTOMATIC;

    optional .android.graphics.RectProto containing_frame = 1;
    optional .android.graphics.RectProto content_frame = 2;
    optional .android.graphics.RectProto decor_frame = 3;
    optional .android.graphics.RectProto content_frame = 2 [deprecated=true];
    optional .android.graphics.RectProto decor_frame = 3 [deprecated=true];
    optional .android.graphics.RectProto display_frame = 4;
    optional .android.graphics.RectProto frame = 5;
    optional .android.graphics.RectProto outset_frame = 6;
    optional .android.graphics.RectProto overscan_frame = 7 [deprecated=true];
    optional .android.graphics.RectProto parent_frame = 8;
    optional .android.graphics.RectProto visible_frame = 9;
    optional .android.graphics.RectProto visible_frame = 9 [deprecated=true];
    optional .android.view.DisplayCutoutProto cutout = 10;
    optional .android.graphics.RectProto content_insets = 11;
    optional .android.graphics.RectProto content_insets = 11 [deprecated=true];
    optional .android.graphics.RectProto overscan_insets = 12 [deprecated=true];
    optional .android.graphics.RectProto visible_insets = 13;
    optional .android.graphics.RectProto stable_insets = 14;
    optional .android.graphics.RectProto visible_insets = 13 [deprecated=true];
    optional .android.graphics.RectProto stable_insets = 14 [deprecated=true];
    optional .android.graphics.RectProto outsets = 15;
}

Loading