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

Commit 8461a9a7 authored by Shawn Lin's avatar Shawn Lin Committed by Automerger Merge Worker
Browse files

Merge "Provides apps the rounded corners info" into sc-dev am: 7de88bce

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5d7fd9c752e1b39f103df430aea3cadef6c64f29
parents 7c6ac239 7de88bce
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -46152,6 +46152,7 @@ package android.view {
    method @Deprecated public void getRectSize(android.graphics.Rect);
    method public float getRefreshRate();
    method public int getRotation();
    method @Nullable public android.view.RoundedCorner getRoundedCorner(int);
    method @Deprecated public void getSize(android.graphics.Point);
    method public int getState();
    method public android.view.Display.Mode[] getSupportedModes();
@@ -47406,6 +47407,20 @@ package android.view {
    field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
  }
  public final class RoundedCorner implements android.os.Parcelable {
    ctor public RoundedCorner(int, int, int, int);
    method public int describeContents();
    method @NonNull public android.graphics.Point getCenter();
    method public int getPosition();
    method public int getRadius();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.view.RoundedCorner> CREATOR;
    field public static final int POSITION_BOTTOM_LEFT = 3; // 0x3
    field public static final int POSITION_BOTTOM_RIGHT = 2; // 0x2
    field public static final int POSITION_TOP_LEFT = 0; // 0x0
    field public static final int POSITION_TOP_RIGHT = 1; // 0x1
  }
  public class ScaleGestureDetector {
    ctor public ScaleGestureDetector(android.content.Context, android.view.ScaleGestureDetector.OnScaleGestureListener);
    ctor public ScaleGestureDetector(android.content.Context, android.view.ScaleGestureDetector.OnScaleGestureListener, android.os.Handler);
@@ -49415,6 +49430,7 @@ package android.view {
    method @NonNull public android.graphics.Insets getInsets(int);
    method @NonNull public android.graphics.Insets getInsetsIgnoringVisibility(int);
    method @Deprecated @NonNull public android.graphics.Insets getMandatorySystemGestureInsets();
    method @Nullable public android.view.RoundedCorner getRoundedCorner(int);
    method @Deprecated public int getStableInsetBottom();
    method @Deprecated public int getStableInsetLeft();
    method @Deprecated public int getStableInsetRight();
@@ -49448,6 +49464,7 @@ package android.view {
    method @NonNull public android.view.WindowInsets.Builder setInsets(int, @NonNull android.graphics.Insets);
    method @NonNull public android.view.WindowInsets.Builder setInsetsIgnoringVisibility(int, @NonNull android.graphics.Insets) throws java.lang.IllegalArgumentException;
    method @Deprecated @NonNull public android.view.WindowInsets.Builder setMandatorySystemGestureInsets(@NonNull android.graphics.Insets);
    method @NonNull public android.view.WindowInsets.Builder setRoundedCorner(int, @Nullable android.view.RoundedCorner);
    method @Deprecated @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets);
    method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets);
    method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets);
+26 −0
Original line number Diff line number Diff line
@@ -895,6 +895,32 @@ public final class Display {
        }
    }

    /**
     * Returns the {@link RoundedCorner} of the given position if there is one.
     *
     * @param position the position of the rounded corner on the display.
     *
     * @return the rounded corner of the given position. Returns {@code null} if there is none.
     */
    @SuppressLint("VisiblySynchronized")
    @Nullable
    public RoundedCorner getRoundedCorner(@RoundedCorner.Position int position) {
        synchronized (this) {
            updateDisplayInfoLocked();
            RoundedCorners roundedCorners;
            if (mMayAdjustByFixedRotation) {
                roundedCorners = getDisplayAdjustments().adjustRoundedCorner(
                        mDisplayInfo.roundedCorners,
                        mDisplayInfo.rotation,
                        mDisplayInfo.logicalWidth,
                        mDisplayInfo.logicalHeight);
            } else {
                roundedCorners = mDisplayInfo.roundedCorners;
            }
            return roundedCorners == null ? null : roundedCorners.getRoundedCorner(position);
        }
    }

    /**
     * Gets the pixel format of the display.
     * @return One of the constants defined in {@link android.graphics.PixelFormat}.
+17 −0
Original line number Diff line number Diff line
@@ -151,6 +151,23 @@ public class DisplayAdjustments {
                : realCutout;
    }

    /**
     * Returns the adjusted {@link RoundedCorners} if available. Otherwise the original
     * {@link RoundedCorners} is returned.
     */
    @Nullable
    public RoundedCorners adjustRoundedCorner(@Nullable RoundedCorners realRoundedCorners,
            @Surface.Rotation int realRotation, int displayWidth, int displayHeight) {
        final FixedRotationAdjustments rotationAdjustments = mFixedRotationAdjustments;
        if (realRoundedCorners == null || rotationAdjustments == null
                || rotationAdjustments.mRotation == realRotation) {
            return realRoundedCorners;
        }

        return realRoundedCorners.rotate(
                rotationAdjustments.mRotation, displayWidth, displayHeight);
    }

    /** Returns the adjusted rotation if available. Otherwise the original rotation is returned. */
    @Surface.Rotation
    public int getRotation(@Surface.Rotation int realRotation) {
+11 −1
Original line number Diff line number Diff line
@@ -302,6 +302,12 @@ public final class DisplayInfo implements Parcelable {
     */
    public float brightnessDefault;

    /**
     * The {@link RoundedCorners} if present, otherwise {@code null}.
     */
    @Nullable
    public RoundedCorners roundedCorners;

    public static final @android.annotation.NonNull Creator<DisplayInfo> CREATOR = new Creator<DisplayInfo>() {
        @Override
        public DisplayInfo createFromParcel(Parcel source) {
@@ -370,7 +376,8 @@ public final class DisplayInfo implements Parcelable {
                && refreshRateOverride == other.refreshRateOverride
                && brightnessMinimum == other.brightnessMinimum
                && brightnessMaximum == other.brightnessMaximum
                && brightnessDefault == other.brightnessDefault;
                && brightnessDefault == other.brightnessDefault
                && Objects.equals(roundedCorners, other.roundedCorners);
    }

    @Override
@@ -419,6 +426,7 @@ public final class DisplayInfo implements Parcelable {
        brightnessMinimum = other.brightnessMinimum;
        brightnessMaximum = other.brightnessMaximum;
        brightnessDefault = other.brightnessDefault;
        roundedCorners = other.roundedCorners;
    }

    public void readFromParcel(Parcel source) {
@@ -469,6 +477,7 @@ public final class DisplayInfo implements Parcelable {
        brightnessMinimum = source.readFloat();
        brightnessMaximum = source.readFloat();
        brightnessDefault = source.readFloat();
        roundedCorners = source.readTypedObject(RoundedCorners.CREATOR);
    }

    @Override
@@ -518,6 +527,7 @@ public final class DisplayInfo implements Parcelable {
        dest.writeFloat(brightnessMinimum);
        dest.writeFloat(brightnessMaximum);
        dest.writeFloat(brightnessDefault);
        dest.writeTypedObject(roundedCorners, flags);
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -653,6 +653,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
    private void updateState(InsetsState newState) {
        mState.setDisplayFrame(newState.getDisplayFrame());
        mState.setDisplayCutout(newState.getDisplayCutout());
        mState.setRoundedCorners(newState.getRoundedCorners());
        @InsetsType int disabledUserAnimationTypes = 0;
        @InsetsType int[] cancelledUserAnimationTypes = {0};
        for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) {
Loading