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

Commit d0e23be2 authored by shawnlin's avatar shawnlin
Browse files

Add a new flag ALWAYS for layoutInDisplayCutoutMode

In R, we will allow cutouts on long edges of a display.
We need to add a new flag for this.

Test: atest PhoneWindowTest
Bug: 146875740
Change-Id: Iebb5f14c0a693f8229fef67d80f2afc3029c3deb
parent 36404200
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -53678,6 +53678,7 @@ package android.view {
    field public static final int LAST_SUB_WINDOW = 1999; // 0x7cf
    field public static final int LAST_SYSTEM_WINDOW = 2999; // 0xbb7
    field public static final int LAYOUT_CHANGED = 1; // 0x1
    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3; // 0x3
    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0; // 0x0
    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2; // 0x2
    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1; // 0x1
+22 −8
Original line number Diff line number Diff line
@@ -2402,7 +2402,8 @@ public interface WindowManager extends ViewManager {
                flag = true,
                value = {LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT,
                        LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES,
                        LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER})
                        LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER,
                        LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS})
        @interface LayoutInDisplayCutoutMode {}

        /**
@@ -2414,6 +2415,7 @@ public interface WindowManager extends ViewManager {
         * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
         * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
         * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER
         * @see #LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
         * @see DisplayCutout
         * @see android.R.attr#windowLayoutInDisplayCutoutMode
         *         android:windowLayoutInDisplayCutoutMode
@@ -2446,13 +2448,6 @@ public interface WindowManager extends ViewManager {
         */
        public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0;

        /**
         * @deprecated use {@link #LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES}
         * @hide
         */
        @Deprecated
        public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 1;

        /**
         * The window is always allowed to extend into the {@link DisplayCutout} areas on the short
         * edges of the screen.
@@ -2516,6 +2511,25 @@ public interface WindowManager extends ViewManager {
         */
        public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2;

        /**
         * The window is always allowed to extend into the {@link DisplayCutout} areas on the all
         * edges of the screen.
         *
         * <p>
         * The window must make sure that no important content overlaps with the
         * {@link DisplayCutout}.
         *
         * <p>
         * In this mode, the window extends under cutouts on the all edges of the display in both
         * portrait and landscape, regardless of whether the window is hiding the system bars.
         *
         * @see DisplayCutout
         * @see WindowInsets#getDisplayCutout()
         * @see #layoutInDisplayCutoutMode
         * @see android.R.attr#windowLayoutInDisplayCutoutMode
         *         android:windowLayoutInDisplayCutoutMode
         */
        public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3;

        /**
         * When this window has focus, disable touch pad pointer gesture processing.
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.FLAG_SPLIT_TOUCH;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION;
import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_BAR_BACKGROUNDS;

import android.annotation.NonNull;
@@ -2466,7 +2466,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        if (a.hasValue(R.styleable.Window_windowLayoutInDisplayCutoutMode)) {
            int mode = a.getInt(R.styleable.Window_windowLayoutInDisplayCutoutMode, -1);
            if (mode < LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT
                    || mode > LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER) {
                    || mode > LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS) {
                throw new UnsupportedOperationException("Unknown windowLayoutInDisplayCutoutMode: "
                        + a.getString(R.styleable.Window_windowLayoutInDisplayCutoutMode));
            }
+10 −0
Original line number Diff line number Diff line
@@ -2217,6 +2217,16 @@
            Corresponds to <code>LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER</code>.
            -->
            <enum name="never" value="2" />
            <!-- <p>
            The window is always allowed to extend into the <code>DisplayCutout</code> areas on the
            all edges of the screen.
            <p>
            The window must make sure that no important content overlaps with the
            <code>DisplayCutout</code>.
            <p>
            Corresponds to <code>LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS</code>.
            -->
            <enum name="always" value="3" />
        </attr>
    </declare-styleable>

+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@
    <style name="LayoutInDisplayCutoutModeNever">
        <item name="android:windowLayoutInDisplayCutoutMode">never</item>
    </style>
    <style name="LayoutInDisplayCutoutModeAlways">
        <item name="android:windowLayoutInDisplayCutoutMode">always</item>
    </style>
    <style name="WindowBackgroundColorLiteral">
        <item name="android:windowBackground">#00FF00</item>
    </style>
Loading