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

Commit dc9ca092 authored by Adam Powell's avatar Adam Powell Committed by Android Git Automerger
Browse files

am 98465f99: Merge "Add Configuration data for round displays" into mnc-dev

* commit '98465f99':
  Add Configuration data for round displays
parents 74a7809b 98465f99
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -9630,6 +9630,7 @@ package android.content.res {
    method public boolean equals(android.content.res.Configuration);
    method public int getLayoutDirection();
    method public boolean isLayoutSizeAtLeast(int);
    method public boolean isScreenRound();
    method public static boolean needNewResources(int, int);
    method public void readFromParcel(android.os.Parcel);
    method public void setLayoutDirection(java.util.Locale);
@@ -9672,6 +9673,10 @@ package android.content.res {
    field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10
    field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0
    field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20
    field public static final int SCREENLAYOUT_ROUND_MASK = 768; // 0x300
    field public static final int SCREENLAYOUT_ROUND_NO = 256; // 0x100
    field public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0; // 0x0
    field public static final int SCREENLAYOUT_ROUND_YES = 512; // 0x200
    field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3
    field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf
    field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2
@@ -34536,6 +34541,7 @@ package android.view {
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
    field public static final int FLAG_PRESENTATION = 8; // 0x8
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_ROUND = 16; // 0x10
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int STATE_DOZE = 3; // 0x3
+6 −0
Original line number Diff line number Diff line
@@ -9940,6 +9940,7 @@ package android.content.res {
    method public boolean equals(android.content.res.Configuration);
    method public int getLayoutDirection();
    method public boolean isLayoutSizeAtLeast(int);
    method public boolean isScreenRound();
    method public static boolean needNewResources(int, int);
    method public void readFromParcel(android.os.Parcel);
    method public void setLayoutDirection(java.util.Locale);
@@ -9982,6 +9983,10 @@ package android.content.res {
    field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10
    field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0
    field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20
    field public static final int SCREENLAYOUT_ROUND_MASK = 768; // 0x300
    field public static final int SCREENLAYOUT_ROUND_NO = 256; // 0x100
    field public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0; // 0x0
    field public static final int SCREENLAYOUT_ROUND_YES = 512; // 0x200
    field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3
    field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf
    field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2
@@ -36798,6 +36803,7 @@ package android.view {
    field public static final int DEFAULT_DISPLAY = 0; // 0x0
    field public static final int FLAG_PRESENTATION = 8; // 0x8
    field public static final int FLAG_PRIVATE = 4; // 0x4
    field public static final int FLAG_ROUND = 16; // 0x10
    field public static final int FLAG_SECURE = 2; // 0x2
    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
    field public static final int STATE_DOZE = 3; // 0x3
+60 −5
Original line number Diff line number Diff line
@@ -156,9 +156,34 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     * value indicating that a layout dir has been set to RTL. */
    public static final int SCREENLAYOUT_LAYOUTDIR_RTL = 0x02 << SCREENLAYOUT_LAYOUTDIR_SHIFT;

    /** Constant for {@link #screenLayout}: bits that encode roundness of the screen. */
    public static final int SCREENLAYOUT_ROUND_MASK = 0x300;
    /** @hide Constant for {@link #screenLayout}: bit shift to get to screen roundness bits */
    public static final int SCREENLAYOUT_ROUND_SHIFT = 8;
    /**
     * Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_ROUND_MASK} value indicating
     * that it is unknown whether or not the screen has a round shape.
     */
    public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0x00;
    /**
     * Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_ROUND_MASK} value indicating
     * that the screen does not have a rounded shape.
     */
    public static final int SCREENLAYOUT_ROUND_NO = 0x1 << SCREENLAYOUT_ROUND_SHIFT;
    /**
     * Constant for {@link #screenLayout}: a {@link #SCREENLAYOUT_ROUND_MASK} value indicating
     * that the screen has a rounded shape. Corners may not be visible to the user;
     * developers should pay special attention to the {@link android.view.WindowInsets} delivered
     * to views for more information about ensuring content is not obscured.
     *
     * <p>Corresponds to the <code>-round</code> resource qualifier.</p>
     */
    public static final int SCREENLAYOUT_ROUND_YES = 0x2 << SCREENLAYOUT_ROUND_SHIFT;

    /** Constant for {@link #screenLayout}: a value indicating that screenLayout is undefined */
    public static final int SCREENLAYOUT_UNDEFINED = SCREENLAYOUT_SIZE_UNDEFINED |
            SCREENLAYOUT_LONG_UNDEFINED | SCREENLAYOUT_LAYOUTDIR_UNDEFINED;
            SCREENLAYOUT_LONG_UNDEFINED | SCREENLAYOUT_LAYOUTDIR_UNDEFINED |
            SCREENLAYOUT_ROUND_UNDEFINED;

    /**
     * Special flag we generate to indicate that the screen layout requires
@@ -174,18 +199,22 @@ public final class Configuration implements Parcelable, Comparable<Configuration
     * <p>The {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
     * of the screen.  They may be one of
     * {@link #SCREENLAYOUT_SIZE_SMALL}, {@link #SCREENLAYOUT_SIZE_NORMAL},
     * {@link #SCREENLAYOUT_SIZE_LARGE}, or {@link #SCREENLAYOUT_SIZE_XLARGE}.
     * {@link #SCREENLAYOUT_SIZE_LARGE}, or {@link #SCREENLAYOUT_SIZE_XLARGE}.</p>
     * 
     * <p>The {@link #SCREENLAYOUT_LONG_MASK} defines whether the screen
     * is wider/taller than normal.  They may be one of
     * {@link #SCREENLAYOUT_LONG_NO} or {@link #SCREENLAYOUT_LONG_YES}.
     * {@link #SCREENLAYOUT_LONG_NO} or {@link #SCREENLAYOUT_LONG_YES}.</p>
     * 
     * <p>The {@link #SCREENLAYOUT_LAYOUTDIR_MASK} defines whether the screen layout
     * is either LTR or RTL.  They may be one of
     * {@link #SCREENLAYOUT_LAYOUTDIR_LTR} or {@link #SCREENLAYOUT_LAYOUTDIR_RTL}.
     * {@link #SCREENLAYOUT_LAYOUTDIR_LTR} or {@link #SCREENLAYOUT_LAYOUTDIR_RTL}.</p>
     *
     * <p>The {@link #SCREENLAYOUT_ROUND_MASK} defines whether the screen has a rounded
     * shape. They may be one of {@link #SCREENLAYOUT_ROUND_NO} or {@link #SCREENLAYOUT_ROUND_YES}.
     * </p>
     *
     * <p>See <a href="{@docRoot}guide/practices/screens_support.html">Supporting
     * Multiple Screens</a> for more information.
     * Multiple Screens</a> for more information.</p>
     */
    public int screenLayout;

@@ -1327,6 +1356,16 @@ public final class Configuration implements Parcelable, Comparable<Configuration
        return screenLayout&~SCREENLAYOUT_LAYOUTDIR_MASK;
    }

    /**
     * Return whether the screen has a round shape. Apps may choose to change styling based
     * on this property, such as the alignment or layout of text or informational icons.
     *
     * @return true if the screen is rounded, false otherwise
     */
    public boolean isScreenRound() {
        return (screenLayout & SCREENLAYOUT_ROUND_MASK) == SCREENLAYOUT_ROUND_YES;
    }

    /**
     *
     * @hide
@@ -1425,6 +1464,17 @@ public final class Configuration implements Parcelable, Comparable<Configuration
                break;
        }

        switch (config.screenLayout & Configuration.SCREENLAYOUT_ROUND_MASK) {
            case Configuration.SCREENLAYOUT_ROUND_YES:
                parts.add("round");
                break;
            case Configuration.SCREENLAYOUT_ROUND_NO:
                parts.add("notround");
                break;
            default:
                break;
        }

        switch (config.orientation) {
            case Configuration.ORIENTATION_LANDSCAPE:
                parts.add("land");
@@ -1640,6 +1690,11 @@ public final class Configuration implements Parcelable, Comparable<Configuration
            delta.screenLayout |= change.screenLayout & SCREENLAYOUT_LONG_MASK;
        }

        if ((base.screenLayout & SCREENLAYOUT_ROUND_MASK) !=
                (change.screenLayout & SCREENLAYOUT_ROUND_MASK)) {
            delta.screenLayout |= change.screenLayout & SCREENLAYOUT_ROUND_MASK;
        }

        if ((base.uiMode & UI_MODE_TYPE_MASK) != (change.uiMode & UI_MODE_TYPE_MASK)) {
            delta.uiMode |= change.uiMode & UI_MODE_TYPE_MASK;
        }
+11 −0
Original line number Diff line number Diff line
@@ -171,6 +171,17 @@ public final class Display {
     */
    public static final int FLAG_PRESENTATION = 1 << 3;

    /**
     * Display flag: Indicates that the display has a round shape.
     * <p>
     * This flag identifies displays that are circular, elliptical or otherwise
     * do not permit the user to see all the way to the logical corners of the display.
     * </p>
     *
     * @see #getFlags
     */
    public static final int FLAG_ROUND = 1 << 4;

    /**
     * Display flag: Indicates that the contents of the display should not be scaled
     * to fit the physical screen dimensions.  Used for development only to emulate
+3 −0
Original line number Diff line number Diff line
@@ -609,6 +609,9 @@ public final class DisplayInfo implements Parcelable {
        if ((flags & Display.FLAG_SCALING_DISABLED) != 0) {
            result.append(", FLAG_SCALING_DISABLED");
        }
        if ((flags & Display.FLAG_ROUND) != 0) {
            result.append(", FLAG_ROUND");
        }
        return result.toString();
    }
}
Loading