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

Commit ae07cf71 authored by Shawn Lin's avatar Shawn Lin Committed by Android (Google) Code Review
Browse files

Merge "Support DisplayShape"

parents c894d0ad 2742c68f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -48692,6 +48692,7 @@ package android.view {
    method public float getRefreshRate();
    method public int getRotation();
    method @Nullable public android.view.RoundedCorner getRoundedCorner(int);
    method @NonNull public android.view.DisplayShape getShape();
    method @Deprecated public void getSize(android.graphics.Point);
    method public int getState();
    method public android.view.Display.Mode[] getSupportedModes();
@@ -48772,6 +48773,13 @@ package android.view {
    method @NonNull public android.view.DisplayCutout.Builder setWaterfallInsets(@NonNull android.graphics.Insets);
  }
  public final class DisplayShape implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.graphics.Path getPath();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.view.DisplayShape> CREATOR;
  }
  public final class DragAndDropPermissions implements android.os.Parcelable {
    method public int describeContents();
    method public void release();
@@ -52153,6 +52161,7 @@ package android.view {
    method @Deprecated @NonNull public android.view.WindowInsets consumeStableInsets();
    method @Deprecated @NonNull public android.view.WindowInsets consumeSystemWindowInsets();
    method @Nullable public android.view.DisplayCutout getDisplayCutout();
    method @Nullable public android.view.DisplayShape getDisplayShape();
    method @NonNull public android.graphics.Insets getInsets(int);
    method @NonNull public android.graphics.Insets getInsetsIgnoringVisibility(int);
    method @Deprecated @NonNull public android.graphics.Insets getMandatorySystemGestureInsets();
@@ -52188,6 +52197,7 @@ package android.view {
    ctor public WindowInsets.Builder(@NonNull android.view.WindowInsets);
    method @NonNull public android.view.WindowInsets build();
    method @NonNull public android.view.WindowInsets.Builder setDisplayCutout(@Nullable android.view.DisplayCutout);
    method @NonNull public android.view.WindowInsets.Builder setDisplayShape(@NonNull android.view.DisplayShape);
    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);
+4 −0
Original line number Diff line number Diff line
@@ -2888,6 +2888,10 @@ package android.view {
    method @NonNull public android.view.Display.Mode.Builder setResolution(int, int);
  }

  public final class DisplayShape implements android.os.Parcelable {
    method @NonNull public static android.view.DisplayShape fromSpecString(@NonNull String, float, int, int);
  }

  public class FocusFinder {
    method public static void sort(android.view.View[], int, int, android.view.ViewGroup, boolean);
  }
+22 −0
Original line number Diff line number Diff line
@@ -1008,6 +1008,28 @@ public final class Display {
        }
    }

    /**
     * Returns the {@link DisplayShape} which is based on display coordinates.
     *
     * To get the {@link DisplayShape} based on the window frame, use
     * {@link WindowInsets#getDisplayShape()} instead.
     *
     * @see DisplayShape
     */
    @SuppressLint("VisiblySynchronized")
    @NonNull
    public DisplayShape getShape() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            final DisplayShape displayShape = mDisplayInfo.displayShape;
            final @Surface.Rotation int rotation = getLocalRotation();
            if (displayShape != null && rotation != mDisplayInfo.rotation) {
                return displayShape.setRotation(rotation);
            }
            return displayShape;
        }
    }

    /**
     * Gets the pixel format of the display.
     * @return One of the constants defined in {@link android.graphics.PixelFormat}.
+8 −1
Original line number Diff line number Diff line
@@ -323,6 +323,9 @@ public final class DisplayInfo implements Parcelable {
    @Surface.Rotation
    public int installOrientation;

    @Nullable
    public DisplayShape displayShape;

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

    @Override
@@ -448,6 +452,7 @@ public final class DisplayInfo implements Parcelable {
        brightnessDefault = other.brightnessDefault;
        roundedCorners = other.roundedCorners;
        installOrientation = other.installOrientation;
        displayShape = other.displayShape;
    }

    public void readFromParcel(Parcel source) {
@@ -506,6 +511,7 @@ public final class DisplayInfo implements Parcelable {
            userDisabledHdrTypes[i] = source.readInt();
        }
        installOrientation = source.readInt();
        displayShape = source.readTypedObject(DisplayShape.CREATOR);
    }

    @Override
@@ -562,6 +568,7 @@ public final class DisplayInfo implements Parcelable {
            dest.writeInt(userDisabledHdrTypes[i]);
        }
        dest.writeInt(installOrientation);
        dest.writeTypedObject(displayShape, flags);
    }

    @Override
+19 −0
Original line number Diff line number Diff line
/**
 * Copyright (c) 2022, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.view;

parcelable DisplayShape;
Loading