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

Commit 5b934b66 authored by Yunfan Chen's avatar Yunfan Chen Committed by Automerger Merge Worker
Browse files

Merge "Move insetsRoundedCornerFrame into InsetsFrameProvider" into...

Merge "Move insetsRoundedCornerFrame into InsetsFrameProvider" into udc-qpr-dev am: 348c3846 am: afdf51cf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23247819



Change-Id: Iea5e7d43d95ce6cc4e6ce4f80d8c034d29424519
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 24e6003f afdf51cf
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@ public class InsetsFrameProvider implements Parcelable {
        return mFlags;
    }

    public boolean hasFlags(@Flags int mask) {
        return (mFlags & mask) == mask;
    }

    public InsetsFrameProvider setInsetsSize(Insets insetsSize) {
        mInsetsSize = insetsSize;
        return this;
+24 −19
Original line number Diff line number Diff line
@@ -58,9 +58,20 @@ public class InsetsSource implements Parcelable {
     */
    public static final int FLAG_SUPPRESS_SCRIM = 1;

    /**
     * Controls whether the insets frame will be used to move {@link RoundedCorner} inward with the
     * insets frame size when calculating the rounded corner insets to other windows.
     *
     * For example, task bar will draw fake rounded corners above itself, so we need to move the
     * rounded corner up by the task bar insets size to make other windows see a rounded corner
     * above the task bar.
     */
    public static final int FLAG_INSETS_ROUNDED_CORNER = 1 << 1;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = true, prefix = "FLAG_", value = {
            FLAG_SUPPRESS_SCRIM,
            FLAG_INSETS_ROUNDED_CORNER,
    })
    public @interface Flags {}

@@ -78,7 +89,6 @@ public class InsetsSource implements Parcelable {
    private @Nullable Rect mVisibleFrame;

    private boolean mVisible;
    private boolean mInsetsRoundedCornerFrame;

    private final Rect mTmpFrame = new Rect();

@@ -98,7 +108,6 @@ public class InsetsSource implements Parcelable {
                ? new Rect(other.mVisibleFrame)
                : null;
        mFlags = other.mFlags;
        mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame;
    }

    public void set(InsetsSource other) {
@@ -108,7 +117,6 @@ public class InsetsSource implements Parcelable {
                ? new Rect(other.mVisibleFrame)
                : null;
        mFlags = other.mFlags;
        mInsetsRoundedCornerFrame = other.mInsetsRoundedCornerFrame;
    }

    public InsetsSource setFrame(int left, int top, int right, int bottom) {
@@ -136,6 +144,11 @@ public class InsetsSource implements Parcelable {
        return this;
    }

    public InsetsSource setFlags(@Flags int flags, @Flags int mask) {
        mFlags = (mFlags & ~mask) | (flags & mask);
        return this;
    }

    public int getId() {
        return mId;
    }
@@ -160,20 +173,15 @@ public class InsetsSource implements Parcelable {
        return mFlags;
    }

    public boolean hasFlags(int flags) {
        return (mFlags & flags) == flags;
    }

    boolean isUserControllable() {
        // If mVisibleFrame is null, it will be the same area as mFrame.
        return mVisibleFrame == null || !mVisibleFrame.isEmpty();
    }

    public boolean insetsRoundedCornerFrame() {
        return mInsetsRoundedCornerFrame;
    }

    public InsetsSource setInsetsRoundedCornerFrame(boolean insetsRoundedCornerFrame) {
        mInsetsRoundedCornerFrame = insetsRoundedCornerFrame;
        return this;
    }

    /**
     * Calculates the insets this source will cause to a client window.
     *
@@ -317,6 +325,9 @@ public class InsetsSource implements Parcelable {
        if ((flags & FLAG_SUPPRESS_SCRIM) != 0) {
            joiner.add("SUPPRESS_SCRIM");
        }
        if ((flags & FLAG_INSETS_ROUNDED_CORNER) != 0) {
            joiner.add("INSETS_ROUNDED_CORNER");
        }
        return joiner.toString();
    }

@@ -347,7 +358,6 @@ public class InsetsSource implements Parcelable {
        }
        pw.print(" visible="); pw.print(mVisible);
        pw.print(" flags="); pw.print(flagsToString(mFlags));
        pw.print(" insetsRoundedCornerFrame="); pw.print(mInsetsRoundedCornerFrame);
        pw.println();
    }

@@ -372,14 +382,12 @@ public class InsetsSource implements Parcelable {
        if (mFlags != that.mFlags) return false;
        if (excludeInvisibleImeFrames && !mVisible && mType == WindowInsets.Type.ime()) return true;
        if (!Objects.equals(mVisibleFrame, that.mVisibleFrame)) return false;
        if (mInsetsRoundedCornerFrame != that.mInsetsRoundedCornerFrame) return false;
        return mFrame.equals(that.mFrame);
    }

    @Override
    public int hashCode() {
        return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mFlags,
                mInsetsRoundedCornerFrame);
        return Objects.hash(mId, mType, mFrame, mVisibleFrame, mVisible, mFlags);
    }

    public InsetsSource(Parcel in) {
@@ -393,7 +401,6 @@ public class InsetsSource implements Parcelable {
        }
        mVisible = in.readBoolean();
        mFlags = in.readInt();
        mInsetsRoundedCornerFrame = in.readBoolean();
    }

    @Override
@@ -414,7 +421,6 @@ public class InsetsSource implements Parcelable {
        }
        dest.writeBoolean(mVisible);
        dest.writeInt(mFlags);
        dest.writeBoolean(mInsetsRoundedCornerFrame);
    }

    @Override
@@ -424,7 +430,6 @@ public class InsetsSource implements Parcelable {
                + " mFrame=" + mFrame.toShortString()
                + " mVisible=" + mVisible
                + " mFlags=[" + flagsToString(mFlags) + "]"
                + (mInsetsRoundedCornerFrame ? " insetsRoundedCornerFrame" : "")
                + "}";
    }

+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.view;

import static android.view.InsetsSource.FLAG_INSETS_ROUNDED_CORNER;
import static android.view.InsetsStateProto.DISPLAY_CUTOUT;
import static android.view.InsetsStateProto.DISPLAY_FRAME;
import static android.view.InsetsStateProto.SOURCES;
@@ -219,7 +220,7 @@ public class InsetsState implements Parcelable {
        final Rect roundedCornerFrame = new Rect(mRoundedCornerFrame);
        for (int i = mSources.size() - 1; i >= 0; i--) {
            final InsetsSource source = mSources.valueAt(i);
            if (source.insetsRoundedCornerFrame()) {
            if (source.hasFlags(FLAG_INSETS_ROUNDED_CORNER)) {
                final Insets insets = source.calculateInsets(roundedCornerFrame, false);
                roundedCornerFrame.inset(insets);
            }
+0 −22
Original line number Diff line number Diff line
@@ -4243,17 +4243,6 @@ public interface WindowManager extends ViewManager {
         */
        public InsetsFrameProvider[] providedInsets;

        /**
         * If specified, the frame that used to calculate relative {@link RoundedCorner} will be
         * the window frame of this window minus the insets that this window provides.
         *
         * Task bar will draw fake rounded corners above itself, so we need this insets to calculate
         * correct rounded corners for this window.
         *
         * @hide
         */
        public boolean insetsRoundedCornerFrame = false;

        /**
         * {@link LayoutParams} to be applied to the window when layout with a assigned rotation.
         * This will make layout during rotation change smoothly.
@@ -4710,7 +4699,6 @@ public interface WindowManager extends ViewManager {
            out.writeBoolean(mFitInsetsIgnoringVisibility);
            out.writeBoolean(preferMinimalPostProcessing);
            out.writeInt(mBlurBehindRadius);
            out.writeBoolean(insetsRoundedCornerFrame);
            out.writeBoolean(mWallpaperTouchEventsEnabled);
            out.writeTypedArray(providedInsets, 0 /* parcelableFlags */);
            checkNonRecursiveParams();
@@ -4782,7 +4770,6 @@ public interface WindowManager extends ViewManager {
            mFitInsetsIgnoringVisibility = in.readBoolean();
            preferMinimalPostProcessing = in.readBoolean();
            mBlurBehindRadius = in.readInt();
            insetsRoundedCornerFrame = in.readBoolean();
            mWallpaperTouchEventsEnabled = in.readBoolean();
            providedInsets = in.createTypedArray(InsetsFrameProvider.CREATOR);
            paramsForRotation = in.createTypedArray(LayoutParams.CREATOR);
@@ -5090,11 +5077,6 @@ public interface WindowManager extends ViewManager {
                changes |= LAYOUT_CHANGED;
            }

            if (insetsRoundedCornerFrame != o.insetsRoundedCornerFrame) {
                insetsRoundedCornerFrame = o.insetsRoundedCornerFrame;
                changes |= LAYOUT_CHANGED;
            }

            if (paramsForRotation != o.paramsForRotation) {
                if ((changes & LAYOUT_CHANGED) == 0) {
                    if (paramsForRotation != null && o.paramsForRotation != null
@@ -5332,10 +5314,6 @@ public interface WindowManager extends ViewManager {
                    sb.append(prefix).append("    ").append(providedInsets[i]);
                }
            }
            if (insetsRoundedCornerFrame) {
                sb.append(" insetsRoundedCornerFrame=");
                sb.append(insetsRoundedCornerFrame);
            }
            if (paramsForRotation != null && paramsForRotation.length != 0) {
                sb.append(System.lineSeparator());
                sb.append(prefix).append("  paramsForRotation:");
+1 −1
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ public class DividerView extends FrameLayout implements View.OnTouchListener {
            for (int i = insetsState.sourceSize() - 1; i >= 0; i--) {
                final InsetsSource source = insetsState.sourceAt(i);
                if (source.getType() == WindowInsets.Type.navigationBars()
                        && source.insetsRoundedCornerFrame()) {
                        && source.hasFlags(InsetsSource.FLAG_INSETS_ROUNDED_CORNER)) {
                    mTempRect.inset(source.calculateVisibleInsets(mTempRect));
                }
            }
Loading