diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 31 | ||||
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 10 |
3 files changed, 26 insertions, 17 deletions
diff --git a/api/current.txt b/api/current.txt index 3325dc6edf61..94cdc9e6159e 100644 --- a/api/current.txt +++ b/api/current.txt @@ -27777,9 +27777,9 @@ package android.view { field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000 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_ALLOW_TRANSIENT = 2048; // 0x800 field public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4 field public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2 + field public static final int SYSTEM_UI_FLAG_IMMERSIVE = 2048; // 0x800 field public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400 field public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200 field public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100 diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 4a3803ec6f15..07beb36aa7e8 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -2375,20 +2375,29 @@ public class View implements Drawable.Callback, KeyEvent.Callback, public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400; /** - * Flag for {@link #setSystemUiVisibility(int)}: View would like to receive touch events - * when hiding the status bar with {@link #SYSTEM_UI_FLAG_FULLSCREEN} and/or hiding the - * navigation bar with {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION} instead of having the system - * clear these flags upon interaction. The system may compensate by temporarily overlaying - * semi-transparent system bars while also delivering the event. - */ - public static final int SYSTEM_UI_FLAG_ALLOW_TRANSIENT = 0x00000800; + * Flag for {@link #setSystemUiVisibility(int)}: View would like to remain interactive when + * hiding the status bar with {@link #SYSTEM_UI_FLAG_FULLSCREEN} and/or hiding the navigation + * bar with {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}. Use this flag to create an immersive + * experience while also hiding the system bars. If this flag is not set, + * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION} will be force cleared by the system on any user + * interaction, and {@link #SYSTEM_UI_FLAG_FULLSCREEN} will be force-cleared by the system + * if the user swipes from the top of the screen. + * <p>When system bars are hidden in immersive mode, they can be revealed temporarily with + * system gestures, such as swiping from the top of the screen. These transient system bars + * will overlay app’s content, may have some degree of transparency, and will automatically + * hide after a short timeout. + * </p><p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_FULLSCREEN} and + * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only has an effect when used in combination + * with one or both of those flags.</p> + */ + public static final int SYSTEM_UI_FLAG_IMMERSIVE = 0x00000800; /** * Flag for {@link #setSystemUiVisibility(int)}: View would like the status bar to have * transparency. * * <p>The transparency request may be denied if the bar is in another mode with a specific - * style, like {@link #SYSTEM_UI_FLAG_ALLOW_TRANSIENT transient mode}. + * style, like {@link #SYSTEM_UI_FLAG_IMMERSIVE immersive mode}. */ public static final int SYSTEM_UI_FLAG_TRANSPARENT_STATUS = 0x00001000; @@ -2397,7 +2406,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * transparency. * * <p>The transparency request may be denied if the bar is in another mode with a specific - * style, like {@link #SYSTEM_UI_FLAG_ALLOW_TRANSIENT transient mode}. + * style, like {@link #SYSTEM_UI_FLAG_IMMERSIVE immersive mode}. */ public static final int SYSTEM_UI_FLAG_TRANSPARENT_NAVIGATION = 0x00002000; @@ -16653,7 +16662,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @param visibility Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE}, * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, {@link #SYSTEM_UI_FLAG_FULLSCREEN}, * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, - * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_ALLOW_TRANSIENT}, + * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_IMMERSIVE}, * {@link #SYSTEM_UI_FLAG_TRANSPARENT_STATUS}, * and {@link #SYSTEM_UI_FLAG_TRANSPARENT_NAVIGATION}. */ @@ -16671,7 +16680,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @return Bitwise-or of flags {@link #SYSTEM_UI_FLAG_LOW_PROFILE}, * {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, {@link #SYSTEM_UI_FLAG_FULLSCREEN}, * {@link #SYSTEM_UI_FLAG_LAYOUT_STABLE}, {@link #SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}, - * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_ALLOW_TRANSIENT}, + * {@link #SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}, {@link #SYSTEM_UI_FLAG_IMMERSIVE}, * {@link #SYSTEM_UI_FLAG_TRANSPARENT_STATUS}, * and {@link #SYSTEM_UI_FLAG_TRANSPARENT_NAVIGATION}. */ diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 8fc61155b776..55d19172430b 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2692,7 +2692,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final int sysui = mLastSystemUiFlags; boolean navVisible = (sysui & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0; boolean navTransparent = (sysui & View.SYSTEM_UI_FLAG_TRANSPARENT_NAVIGATION) != 0; - boolean transientAllowed = (sysui & View.SYSTEM_UI_FLAG_ALLOW_TRANSIENT) != 0; + boolean transientAllowed = (sysui & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0; navTransparent &= !transientAllowed; // transient trumps transparent // When the navigation bar isn't visible, we put up a fake @@ -5054,13 +5054,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (statusBarHasFocus) { int flags = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION - | View.SYSTEM_UI_FLAG_ALLOW_TRANSIENT; + | View.SYSTEM_UI_FLAG_IMMERSIVE; vis = (vis & ~flags) | (mLastSystemUiFlags & flags); } // update status bar boolean transientAllowed = - (vis & View.SYSTEM_UI_FLAG_ALLOW_TRANSIENT) != 0; + (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0; boolean hideStatusBarWM = (mFocusedWindow.getAttrs().flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0; @@ -5105,7 +5105,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { private boolean isTransientNavigationAllowed(int vis) { return mNavigationBar != null && (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0 - && (vis & View.SYSTEM_UI_FLAG_ALLOW_TRANSIENT) != 0; + && (vis & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0; } // Temporary helper that allows testing immersive mode on existing apps @@ -5133,7 +5133,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (sForced.contains(parseActivity(focused))) { vis |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | - View.SYSTEM_UI_FLAG_ALLOW_TRANSIENT; + View.SYSTEM_UI_FLAG_IMMERSIVE; } return vis; } |