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

Commit 5cd907d3 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Alert Windows behavioral changes

- Introduced TYPE_APPLICATION_OVERLAY window type. Can be used by apps
to display windows on top of other app windows, but below critical
system windows.
- Deprecate alert window types TYPE_PHONE, TYPE_SYSTEM_ALERT,
TYPE_SYSTEM_OVERLAY, TYPE_PRIORITY_PHONE, and TYPE_SYSTEM_ERROR.
Apps should now use TYPE_APP_OVERLAY for this.
- Apps targetting O or greater are not allowed to add the old alert
window types.
Apps targetting less than O can still add the old types.
Apps with permission INTERNAL_SYSTEM_WINDOW (system signature apps) can
still add the old types.
- Z-order old alert windows types below TYPE_APPLICATION_OVERLAY if
they are added by an app without the INTERNAL_SYSTEM_WINDOW permission.

Test: android.server.cts.AlertWindowsTests
Bug: 33256752
Change-Id: I12170955a7a333151d3387c169b51c53c32164fc
parent f9295bcc
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -45684,6 +45684,7 @@ package android.view {
    field public static final int TYPE_APPLICATION = 2; // 0x2
    field public static final int TYPE_APPLICATION_ATTACHED_DIALOG = 1003; // 0x3eb
    field public static final int TYPE_APPLICATION_MEDIA = 1001; // 0x3e9
    field public static final int TYPE_APPLICATION_OVERLAY = 2038; // 0x7f6
    field public static final int TYPE_APPLICATION_PANEL = 1000; // 0x3e8
    field public static final int TYPE_APPLICATION_STARTING = 3; // 0x3
    field public static final int TYPE_APPLICATION_SUB_PANEL = 1002; // 0x3ea
@@ -45693,17 +45694,17 @@ package android.view {
    field public static final int TYPE_INPUT_METHOD = 2011; // 0x7db
    field public static final int TYPE_INPUT_METHOD_DIALOG = 2012; // 0x7dc
    field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9
    field public static final int TYPE_PHONE = 2002; // 0x7d2
    field public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final deprecated int TYPE_PHONE = 2002; // 0x7d2
    field public static final deprecated int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee
    field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1
    field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0
    field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de
    field public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final deprecated int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8
    field public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final int TYPE_TOAST = 2005; // 0x7d5
    field public static final deprecated int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final deprecated int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final deprecated int TYPE_TOAST = 2005; // 0x7d5
    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
    field public float alpha;
    field public float buttonBrightness;
+7 −6
Original line number Diff line number Diff line
@@ -49093,6 +49093,7 @@ package android.view {
    field public static final int TYPE_APPLICATION = 2; // 0x2
    field public static final int TYPE_APPLICATION_ATTACHED_DIALOG = 1003; // 0x3eb
    field public static final int TYPE_APPLICATION_MEDIA = 1001; // 0x3e9
    field public static final int TYPE_APPLICATION_OVERLAY = 2038; // 0x7f6
    field public static final int TYPE_APPLICATION_PANEL = 1000; // 0x3e8
    field public static final int TYPE_APPLICATION_STARTING = 3; // 0x3
    field public static final int TYPE_APPLICATION_SUB_PANEL = 1002; // 0x3ea
@@ -49102,17 +49103,17 @@ package android.view {
    field public static final int TYPE_INPUT_METHOD = 2011; // 0x7db
    field public static final int TYPE_INPUT_METHOD_DIALOG = 2012; // 0x7dc
    field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9
    field public static final int TYPE_PHONE = 2002; // 0x7d2
    field public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final deprecated int TYPE_PHONE = 2002; // 0x7d2
    field public static final deprecated int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee
    field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1
    field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0
    field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de
    field public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final deprecated int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8
    field public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final int TYPE_TOAST = 2005; // 0x7d5
    field public static final deprecated int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final deprecated int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final deprecated int TYPE_TOAST = 2005; // 0x7d5
    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
    field public float alpha;
    field public float buttonBrightness;
+7 −6
Original line number Diff line number Diff line
@@ -45995,6 +45995,7 @@ package android.view {
    field public static final int TYPE_APPLICATION = 2; // 0x2
    field public static final int TYPE_APPLICATION_ATTACHED_DIALOG = 1003; // 0x3eb
    field public static final int TYPE_APPLICATION_MEDIA = 1001; // 0x3e9
    field public static final int TYPE_APPLICATION_OVERLAY = 2038; // 0x7f6
    field public static final int TYPE_APPLICATION_PANEL = 1000; // 0x3e8
    field public static final int TYPE_APPLICATION_STARTING = 3; // 0x3
    field public static final int TYPE_APPLICATION_SUB_PANEL = 1002; // 0x3ea
@@ -46004,17 +46005,17 @@ package android.view {
    field public static final int TYPE_INPUT_METHOD = 2011; // 0x7db
    field public static final int TYPE_INPUT_METHOD_DIALOG = 2012; // 0x7dc
    field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9
    field public static final int TYPE_PHONE = 2002; // 0x7d2
    field public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final deprecated int TYPE_PHONE = 2002; // 0x7d2
    field public static final deprecated int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
    field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee
    field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1
    field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0
    field public static final int TYPE_STATUS_BAR_PANEL = 2014; // 0x7de
    field public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final deprecated int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
    field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8
    field public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final int TYPE_TOAST = 2005; // 0x7d5
    field public static final deprecated int TYPE_SYSTEM_ERROR = 2010; // 0x7da
    field public static final deprecated int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
    field public static final deprecated int TYPE_TOAST = 2005; // 0x7d5
    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
    field public float alpha;
    field public float buttonBrightness;
+1 −0
Original line number Diff line number Diff line
@@ -516,6 +516,7 @@ public class UserManager {
     * <li>{@link LayoutParams#TYPE_SYSTEM_ALERT}</li>
     * <li>{@link LayoutParams#TYPE_SYSTEM_ERROR}</li>
     * <li>{@link LayoutParams#TYPE_SYSTEM_OVERLAY}</li>
     * <li>{@link LayoutParams#TYPE_APPLICATION_OVERLAY}</li>
     *
     * <p>This can only be set by device owners and profile owners on the primary user.
     * The default value is <code>false</code>.
+49 −1
Original line number Diff line number Diff line
@@ -335,7 +335,9 @@ public interface WindowManager extends ViewManager {
                @ViewDebug.IntToString(from = TYPE_QS_DIALOG,
                        to = "TYPE_QS_DIALOG"),
                @ViewDebug.IntToString(from = TYPE_SCREENSHOT,
                        to = "TYPE_SCREENSHOT")
                        to = "TYPE_SCREENSHOT"),
                @ViewDebug.IntToString(from = TYPE_APPLICATION_OVERLAY,
                        to = "TYPE_APPLICATION_OVERLAY")
        })
        public int type;

@@ -462,14 +464,18 @@ public interface WindowManager extends ViewManager {
         * These windows are normally placed above all applications, but behind
         * the status bar.
         * In multiuser systems shows on all users' windows.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_PHONE              = FIRST_SYSTEM_WINDOW+2;

        /**
         * Window type: system window, such as low power alert. These windows
         * are always on top of application windows.
         * In multiuser systems shows only on the owning user's window.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_SYSTEM_ALERT       = FIRST_SYSTEM_WINDOW+3;

        /**
@@ -482,7 +488,9 @@ public interface WindowManager extends ViewManager {
        /**
         * Window type: transient notifications.
         * In multiuser systems shows only on the owning user's window.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_TOAST              = FIRST_SYSTEM_WINDOW+5;

        /**
@@ -490,7 +498,9 @@ public interface WindowManager extends ViewManager {
         * on top of everything else.  These windows must not take input
         * focus, or they will interfere with the keyguard.
         * In multiuser systems shows only on the owning user's window.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_SYSTEM_OVERLAY     = FIRST_SYSTEM_WINDOW+6;

        /**
@@ -498,7 +508,9 @@ public interface WindowManager extends ViewManager {
         * the keyguard is active.  These windows must not take input
         * focus, or they will interfere with the keyguard.
         * In multiuser systems shows on all users' windows.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_PRIORITY_PHONE     = FIRST_SYSTEM_WINDOW+7;

        /**
@@ -517,7 +529,9 @@ public interface WindowManager extends ViewManager {
         * Window type: internal system error windows, appear on top of
         * everything they can.
         * In multiuser systems shows only on the owning user's window.
         * @deprecated for non-system apps. Use {@link #TYPE_APPLICATION_OVERLAY} instead.
         */
        @Deprecated
        public static final int TYPE_SYSTEM_ERROR       = FIRST_SYSTEM_WINDOW+10;

        /**
@@ -702,11 +716,45 @@ public interface WindowManager extends ViewManager {
         */
        public static final int TYPE_PRESENTATION = FIRST_SYSTEM_WINDOW + 37;

        /**
         * Window type: Application overlay windows are displayed above all activity windows
         * (types between {@link #FIRST_APPLICATION_WINDOW} and {@link #LAST_APPLICATION_WINDOW})
         * but below critical system windows like the status bar or IME.
         * <p>
         * The system may change the position, size, or visibility of these windows at anytime
         * to reduce visual clutter to the user and also manage resources.
         * <p>
         * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission.
         * <p>
         * In mult-iuser systems shows only on the owning user's screen.
         */
        public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38;

        /**
         * End of types of system windows.
         */
        public static final int LAST_SYSTEM_WINDOW      = 2999;

        /**
         * Return true if the window type is an alert window.
         *
         * @param type The window type.
         * @return If the window type is an alert window.
         * @hide
         */
        public static boolean isSystemAlertWindowType(int type) {
            switch (type) {
                case TYPE_PHONE:
                case TYPE_PRIORITY_PHONE:
                case TYPE_SYSTEM_ALERT:
                case TYPE_SYSTEM_ERROR:
                case TYPE_SYSTEM_OVERLAY:
                case TYPE_APPLICATION_OVERLAY:
                    return true;
            }
            return false;
        }

        /** @deprecated this is ignored, this value is set automatically when needed. */
        @Deprecated
        public static final int MEMORY_TYPE_NORMAL = 0;
Loading