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

Commit 60ee2564 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

The fullest of fullscreen modes.

View.setSystemUiVisibility() now properly accepts a
bitfield, including:

  * SYSTEM_UI_FLAG_LOW_PROFILE: "lights out mode"
    (previously known, erroneously, as STATUS_BAR_HIDDEN)

  * SYSTEM_UI_FLAG_HIDE_NAVIGATION: for when you need every
    single pixel on a device that also has a navigation bar

These flags are painstakingly aggregated across the entire
view hierarchy and carefully delivered to the status bar
service, which in turn gently passes them along to the bar
implementation.

To really get access to the whole screen, you need to use
HIDE_NAVIGATION in conjunction with FLAG_FULLSCREEN and
FLAG_LAYOUT_IN_SCREEN. See development/samples/Overscan for
an example of how to do this.

Change-Id: I5fbfe009d9ceebbbf71db73f14a7008ea7c1d4da
parent 2043b01b
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -22661,8 +22661,11 @@ package android.view {
    field protected static final int[] SELECTED_STATE_SET;
    field protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SET;
    field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000
    field public static final int STATUS_BAR_HIDDEN = 1; // 0x1
    field public static final int STATUS_BAR_VISIBLE = 0; // 0x0
    field public static final deprecated int STATUS_BAR_HIDDEN = 1; // 0x1
    field public static final deprecated int STATUS_BAR_VISIBLE = 0; // 0x0
    field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2
    field public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
    field public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
    field public static android.util.Property TRANSLATION_X;
    field public static android.util.Property TRANSLATION_Y;
    field protected static final java.lang.String VIEW_LOG_TAG = "View";
+55 −9
Original line number Diff line number Diff line
@@ -1784,18 +1784,51 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
    public static final int OVER_SCROLL_NEVER = 2;
    /**
     * View has requested the status bar to be visible (the default).
     * View has requested the system UI (status bar) to be visible (the default).
     *
     * @see #setSystemUiVisibility(int)
     */
    public static final int STATUS_BAR_VISIBLE = 0;
    public static final int SYSTEM_UI_FLAG_VISIBLE = 0;
    /**
     * View has requested the status bar to be hidden.
     * View has requested the system UI to enter an unobtrusive "low profile" mode.
     *
     * This is for use in games, book readers, video players, or any other "immersive" application
     * where the usual system chrome is deemed too distracting. 
     *
     * In low profile mode, the status bar and/or navigation icons may dim.
     *
     * @see #setSystemUiVisibility(int)
     */
    public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 0x00000001;
    /**
     * View has requested that the system navigation be temporarily hidden.
     *
     * This is an even less obtrusive state than that called for by
     * {@link #SYSTEM_UI_FLAG_LOW_PROFILE}; on devices that draw essential navigation controls
     * (Home, Back, and the like) on screen, <code>SYSTEM_UI_FLAG_HIDE_NAVIGATION</code> will cause
     * those to disappear. This is useful (in conjunction with the
     * {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN FLAG_FULLSCREEN} and 
     * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN FLAG_LAYOUT_IN_SCREEN}
     * window flags) for displaying content using every last pixel on the display.
     *
     * There is a limitation: because navigation controls are so important, the least user
     * interaction will cause them to reappear immediately.
     *
     * @see #setSystemUiVisibility(int)
     */
    public static final int STATUS_BAR_HIDDEN = 0x00000001;
    public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 0x00000002;
    /**
     * @deprecated Use {@link #SYSTEM_UI_FLAG_LOW_PROFILE} instead.
     */
    public static final int STATUS_BAR_HIDDEN = SYSTEM_UI_FLAG_LOW_PROFILE;
    /**
     * @deprecated Use {@link #SYSTEM_UI_FLAG_VISIBLE} instead.
     */
    public static final int STATUS_BAR_VISIBLE = SYSTEM_UI_FLAG_VISIBLE;
    /**
     * @hide
@@ -1889,7 +1922,7 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
    /**
     * @hide
     */
    public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = STATUS_BAR_HIDDEN;
    public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = 0x0000FFFF;
    /**
     * Controls the over-scroll mode for this view.
@@ -1934,7 +1967,17 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
     * This view's request for the visibility of the status bar.
     * @hide
     */
    @ViewDebug.ExportedProperty()
    @ViewDebug.ExportedProperty(flagMapping = {
        @ViewDebug.FlagToString(mask = SYSTEM_UI_FLAG_LOW_PROFILE,
                                equals = SYSTEM_UI_FLAG_LOW_PROFILE,
                                name = "SYSTEM_UI_FLAG_LOW_PROFILE", outputIf = true),
        @ViewDebug.FlagToString(mask = SYSTEM_UI_FLAG_HIDE_NAVIGATION,
                                equals = SYSTEM_UI_FLAG_HIDE_NAVIGATION,
                                name = "SYSTEM_UI_FLAG_HIDE_NAVIGATION", outputIf = true),
        @ViewDebug.FlagToString(mask = PUBLIC_STATUS_BAR_VISIBILITY_MASK,
                                equals = SYSTEM_UI_FLAG_VISIBLE,
                                name = "SYSTEM_UI_FLAG_VISIBLE", outputIf = true)
    })
    int mSystemUiVisibility;
    /**
@@ -12537,7 +12580,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
    /**
     * Request that the visibility of the status bar be changed.
     * @param visibility  Either {@link #STATUS_BAR_VISIBLE} or {@link #STATUS_BAR_HIDDEN}.
     * @param visibility  Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or
     * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}.
     */
    public void setSystemUiVisibility(int visibility) {
        if (visibility != mSystemUiVisibility) {
@@ -12550,7 +12594,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
    /**
     * Returns the status bar visibility that this view has requested.
     * @return Either {@link #STATUS_BAR_VISIBLE} or {@link #STATUS_BAR_HIDDEN}.
     * @return  Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or
     * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}.
     */
    public int getSystemUiVisibility() {
        return mSystemUiVisibility;
@@ -13653,7 +13698,8 @@ public class View implements Drawable.Callback2, KeyEvent.Callback, Accessibilit
         * Called when the status bar changes visibility because of a call to
         * {@link View#setSystemUiVisibility(int)}.
         *
         * @param visibility {@link #STATUS_BAR_VISIBLE} or {@link #STATUS_BAR_HIDDEN}.
         * @param visibility  Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE} or
         * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}.
         */
        public void onSystemUiVisibilityChange(int visibility);
    }
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ oneway interface IStatusBar
    void disable(int state);
    void animateExpand();
    void animateCollapse();
    void setLightsOn(boolean on);
    void setSystemUiVisibility(int vis);
    void topAppWindowChanged(boolean menuVisible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
    void setHardKeyboardStatus(boolean available, boolean enabled);
+7 −7
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int OP_EXPAND      = 1;
    private static final int OP_COLLAPSE    = 2;

    private static final int MSG_SET_LIGHTS_ON          = 7 << MSG_SHIFT;
    private static final int MSG_SET_SYSTEMUI_VISIBILITY          = 7 << MSG_SHIFT;

    private static final int MSG_TOP_APP_WINDOW_CHANGED = 8 << MSG_SHIFT;
    private static final int MSG_SHOW_IME_BUTTON        = 9 << MSG_SHIFT;
@@ -86,7 +86,7 @@ public class CommandQueue extends IStatusBar.Stub {
        public void disable(int state);
        public void animateExpand();
        public void animateCollapse();
        public void setLightsOn(boolean on);
        public void setSystemUiVisibility(int vis);
        public void topAppWindowChanged(boolean visible);
        public void setImeWindowStatus(IBinder token, int vis, int backDisposition);
        public void setHardKeyboardStatus(boolean available, boolean enabled);
@@ -160,10 +160,10 @@ public class CommandQueue extends IStatusBar.Stub {
        }
    }

    public void setLightsOn(boolean on) {
    public void setSystemUiVisibility(int vis) {
        synchronized (mList) {
            mHandler.removeMessages(MSG_SET_LIGHTS_ON);
            mHandler.obtainMessage(MSG_SET_LIGHTS_ON, on ? 1 : 0, 0, null).sendToTarget();
            mHandler.removeMessages(MSG_SET_SYSTEMUI_VISIBILITY);
            mHandler.obtainMessage(MSG_SET_SYSTEMUI_VISIBILITY, vis, 0, null).sendToTarget();
        }
    }

@@ -259,8 +259,8 @@ public class CommandQueue extends IStatusBar.Stub {
                        mCallbacks.animateCollapse();
                    }
                    break;
                case MSG_SET_LIGHTS_ON:
                    mCallbacks.setLightsOn(msg.arg1 != 0);
                case MSG_SET_SYSTEMUI_VISIBILITY:
                    mCallbacks.setSystemUiVisibility(msg.arg1);
                    break;
                case MSG_TOP_APP_WINDOW_CHANGED:
                    mCallbacks.topAppWindowChanged(msg.arg1 != 0);
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac
        }

        disable(switches[0]);
        setLightsOn(switches[1] != 0);
        setSystemUiVisibility(switches[1]);
        topAppWindowChanged(switches[2] != 0);
        // StatusBarManagerService has a back up of IME token and it's restored here.
        setImeWindowStatus(binders.get(0), switches[3], switches[4]);
Loading