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

Commit bfcb60ab authored by Jeff Brown's avatar Jeff Brown
Browse files

Adjust layers for system overlays.

Prevent system overlays from showing above the notification bar.

Allow secure system overlays to be fullscreen, for the pointer
location view.

Show the drag layer above the notification bar.

Change-Id: Ic8d663792a243cca2cd9952d241d001e0357d551
parent 9fefa3c7
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -177,7 +177,14 @@ public interface WindowManager extends ViewManager {
            @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
            @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
            @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
            @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
            @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
            @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
            @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
            @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
            @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
            @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
            @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
            @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS")
        })
        public int type;
+18 −10
Original line number Diff line number Diff line
@@ -189,16 +189,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    static final int STATUS_BAR_SUB_PANEL_LAYER = 14;
    static final int STATUS_BAR_LAYER = 15;
    static final int STATUS_BAR_PANEL_LAYER = 16;
    // the navigation bar, if available, shows atop most things
    static final int NAVIGATION_BAR_LAYER = 17;
    // the on-screen volume indicator and controller shown when the user
    // changes the device volume
    static final int VOLUME_OVERLAY_LAYER = 18;
    static final int VOLUME_OVERLAY_LAYER = 17;
    // things in here CAN NOT take focus, but are shown on top of everything else.
    static final int SYSTEM_OVERLAY_LAYER = 18;
    // the navigation bar, if available, shows atop most things
    static final int NAVIGATION_BAR_LAYER = 19;
    // the drag layer: input for drag-and-drop is associated with this window,
    // which sits above all other focusable windows
    static final int DRAG_LAYER = 19;
    // things in here CAN NOT take focus, but are shown on top of everything else.
    static final int SYSTEM_OVERLAY_LAYER = 20;
    static final int DRAG_LAYER = 20;
    static final int SECURE_SYSTEM_OVERLAY_LAYER = 21;
    static final int BOOT_PROGRESS_LAYER = 22;
    // the (mouse) pointer layer
@@ -894,10 +894,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    WindowManager.LayoutParams.MATCH_PARENT,
                    WindowManager.LayoutParams.MATCH_PARENT);
            lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
            lp.flags = 
                WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE|
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE|
                WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
            lp.flags = WindowManager.LayoutParams.FLAG_FULLSCREEN
                    | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                    | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                    | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
            lp.format = PixelFormat.TRANSLUCENT;
            lp.setTitle("PointerLocation");
            WindowManager wm = (WindowManager)
@@ -995,6 +995,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                // These types of windows can't receive input events.
                attrs.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
                attrs.flags &= ~WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
                break;
        }
    }
@@ -1993,6 +1994,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                                    "Laying out navigation bar window: (%d,%d - %d,%d)",
                                    pf.left, pf.top, pf.right, pf.bottom));
                    }
                } else if (attrs.type == TYPE_SECURE_SYSTEM_OVERLAY
                        && ((fl & FLAG_FULLSCREEN) != 0)) {
                    // Fullscreen secure system overlays get what they ask for.
                    pf.left = df.left = mUnrestrictedScreenLeft;
                    pf.top = df.top = mUnrestrictedScreenTop;
                    pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth;
                    pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight;
                } else {
                    pf.left = df.left = cf.left = mRestrictedScreenLeft;
                    pf.top = df.top = cf.top = mRestrictedScreenTop;
+2 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ struct InputWindowInfo {
        TYPE_STATUS_BAR_SUB_PANEL  = FIRST_SYSTEM_WINDOW+17,
        TYPE_POINTER            = FIRST_SYSTEM_WINDOW+18,
        TYPE_NAVIGATION_BAR     = FIRST_SYSTEM_WINDOW+19,
        TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20,
        TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21,
        LAST_SYSTEM_WINDOW      = 2999,
    };