Merge "Add configurable nav bar opacity rules" into nyc-dev
am: 7014a3a893
* commit '7014a3a89392f4148dcbb3bfc805d26b90f55ae3':
Add configurable nav bar opacity rules
This commit is contained in:
@@ -2440,9 +2440,13 @@
|
|||||||
flag). -->
|
flag). -->
|
||||||
<bool name="config_forceWindowDrawsStatusBarBackground">true</bool>
|
<bool name="config_forceWindowDrawsStatusBarBackground">true</bool>
|
||||||
|
|
||||||
<!-- If set, this will force the navigation bar to always be drawn with an opaque
|
<!-- Controls the opacity of the navigation bar depending on the visibility of the
|
||||||
background. -->
|
various workspace stacks.
|
||||||
<bool name="config_forceNavBarAlwaysOpaque">false</bool>
|
0 - Nav bar is always opaque when either the freeform stack or docked stack is visible.
|
||||||
|
1 - Nav bar is always translucent when the freeform stack is visible, otherwise always
|
||||||
|
opaque.
|
||||||
|
-->
|
||||||
|
<integer name="config_navBarOpacityMode">0</integer>
|
||||||
|
|
||||||
<!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
|
<!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
|
||||||
<string translatable="false" name="config_defaultPictureInPictureBounds">"0 0 100 100"</string>
|
<string translatable="false" name="config_defaultPictureInPictureBounds">"0 0 100 100"</string>
|
||||||
|
|||||||
@@ -2394,7 +2394,7 @@
|
|||||||
|
|
||||||
<java-symbol type="string" name="config_packagedKeyboardName" />
|
<java-symbol type="string" name="config_packagedKeyboardName" />
|
||||||
<java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" />
|
<java-symbol type="bool" name="config_forceWindowDrawsStatusBarBackground" />
|
||||||
<java-symbol type="bool" name="config_forceNavBarAlwaysOpaque" />
|
<java-symbol type="integer" name="config_navBarOpacityMode" />
|
||||||
<java-symbol type="color" name="system_bar_background_semi_transparent" />
|
<java-symbol type="color" name="system_bar_background_semi_transparent" />
|
||||||
|
|
||||||
<!-- EditText suggestion popup. -->
|
<!-- EditText suggestion popup. -->
|
||||||
|
|||||||
@@ -211,6 +211,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
static final int SHORT_PRESS_SLEEP_GO_TO_SLEEP = 0;
|
static final int SHORT_PRESS_SLEEP_GO_TO_SLEEP = 0;
|
||||||
static final int SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME = 1;
|
static final int SHORT_PRESS_SLEEP_GO_TO_SLEEP_AND_GO_HOME = 1;
|
||||||
|
|
||||||
|
// Controls navigation bar opacity depending on which workspace stacks are currently
|
||||||
|
// visible.
|
||||||
|
// Nav bar is always opaque when either the freeform stack or docked stack is visible.
|
||||||
|
static final int NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED = 0;
|
||||||
|
// Nav bar is always translucent when the freeform stack is visible, otherwise always opaque.
|
||||||
|
static final int NAV_BAR_TRANSLUCENT_WHEN_FREEFORM_OPAQUE_OTHERWISE = 1;
|
||||||
|
|
||||||
static final int APPLICATION_MEDIA_SUBLAYER = -2;
|
static final int APPLICATION_MEDIA_SUBLAYER = -2;
|
||||||
static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
|
static final int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
|
||||||
static final int APPLICATION_PANEL_SUBLAYER = 1;
|
static final int APPLICATION_PANEL_SUBLAYER = 1;
|
||||||
@@ -539,7 +546,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
boolean mForceStatusBar;
|
boolean mForceStatusBar;
|
||||||
boolean mForceStatusBarFromKeyguard;
|
boolean mForceStatusBarFromKeyguard;
|
||||||
private boolean mForceStatusBarTransparent;
|
private boolean mForceStatusBarTransparent;
|
||||||
boolean mForceNavBarOpaque;
|
int mNavBarOpacityMode = NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED;
|
||||||
boolean mHideLockScreen;
|
boolean mHideLockScreen;
|
||||||
boolean mForcingShowNavBar;
|
boolean mForcingShowNavBar;
|
||||||
int mForcingShowNavBarLayer;
|
int mForcingShowNavBarLayer;
|
||||||
@@ -1729,8 +1736,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
mShortPressWindowBehavior = SHORT_PRESS_WINDOW_PICTURE_IN_PICTURE;
|
mShortPressWindowBehavior = SHORT_PRESS_WINDOW_PICTURE_IN_PICTURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mForceNavBarOpaque = res.getBoolean(
|
mNavBarOpacityMode = res.getInteger(
|
||||||
com.android.internal.R.bool.config_forceNavBarAlwaysOpaque);
|
com.android.internal.R.integer.config_navBarOpacityMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -7093,7 +7100,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
// is visible but also when we are resizing for the transitions when docked stack
|
// is visible but also when we are resizing for the transitions when docked stack
|
||||||
// visibility changes.
|
// visibility changes.
|
||||||
mForceShowSystemBars = dockedStackVisible || freeformStackVisible || resizing;
|
mForceShowSystemBars = dockedStackVisible || freeformStackVisible || resizing;
|
||||||
final boolean forceOpaqueSystemBars = mForceShowSystemBars && !mForceStatusBarFromKeyguard;
|
final boolean forceOpaqueStatusBar = mForceShowSystemBars && !mForceStatusBarFromKeyguard;
|
||||||
|
|
||||||
// apply translucent bar vis flags
|
// apply translucent bar vis flags
|
||||||
WindowState transWin = isStatusBarKeyguard() && !mHideLockScreen
|
WindowState transWin = isStatusBarKeyguard() && !mHideLockScreen
|
||||||
@@ -7118,14 +7125,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((!areTranslucentBarsAllowed() && transWin != mStatusBar)
|
if ((!areTranslucentBarsAllowed() && transWin != mStatusBar)
|
||||||
|| forceOpaqueSystemBars) {
|
|| forceOpaqueStatusBar) {
|
||||||
vis &= ~(View.NAVIGATION_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSLUCENT
|
vis &= ~(View.STATUS_BAR_TRANSLUCENT | View.STATUS_BAR_TRANSPARENT);
|
||||||
| View.SYSTEM_UI_TRANSPARENT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mForceNavBarOpaque) {
|
vis = configureNavBarOpacity(vis, dockedStackVisible, freeformStackVisible, resizing);
|
||||||
vis &= ~(View.NAVIGATION_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSPARENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mForceWindowDrawsStatusBarBackground) {
|
if (mForceWindowDrawsStatusBarBackground) {
|
||||||
vis |= View.STATUS_BAR_TRANSPARENT;
|
vis |= View.STATUS_BAR_TRANSPARENT;
|
||||||
@@ -7199,6 +7203,41 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
return vis;
|
return vis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the current visibility flags with the nav-bar opacity related flags toggled based
|
||||||
|
* on the nav bar opacity rules chosen by {@link #mNavBarOpacityMode}.
|
||||||
|
*/
|
||||||
|
private int configureNavBarOpacity(int visibility, boolean dockedStackVisible,
|
||||||
|
boolean freeformStackVisible, boolean isDockedDividerResizing) {
|
||||||
|
if (mNavBarOpacityMode == NAV_BAR_OPAQUE_WHEN_FREEFORM_OR_DOCKED) {
|
||||||
|
if (dockedStackVisible || freeformStackVisible || isDockedDividerResizing) {
|
||||||
|
visibility = setNavBarOpaqueFlag(visibility);
|
||||||
|
}
|
||||||
|
} else if (mNavBarOpacityMode == NAV_BAR_TRANSLUCENT_WHEN_FREEFORM_OPAQUE_OTHERWISE) {
|
||||||
|
if (isDockedDividerResizing) {
|
||||||
|
visibility = setNavBarOpaqueFlag(visibility);
|
||||||
|
} else if (freeformStackVisible) {
|
||||||
|
visibility = setNavBarTranslucentFlag(visibility);
|
||||||
|
} else {
|
||||||
|
visibility = setNavBarOpaqueFlag(visibility);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!areTranslucentBarsAllowed()) {
|
||||||
|
visibility &= ~View.NAVIGATION_BAR_TRANSLUCENT;
|
||||||
|
}
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int setNavBarOpaqueFlag(int visibility) {
|
||||||
|
return visibility &= ~(View.NAVIGATION_BAR_TRANSLUCENT | View.NAVIGATION_BAR_TRANSPARENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int setNavBarTranslucentFlag(int visibility) {
|
||||||
|
visibility &= ~View.NAVIGATION_BAR_TRANSPARENT;
|
||||||
|
return visibility |= View.NAVIGATION_BAR_TRANSLUCENT;
|
||||||
|
}
|
||||||
|
|
||||||
private void clearClearableFlagsLw() {
|
private void clearClearableFlagsLw() {
|
||||||
int newVal = mResettingSystemUiFlags | View.SYSTEM_UI_CLEARABLE_FLAGS;
|
int newVal = mResettingSystemUiFlags | View.SYSTEM_UI_CLEARABLE_FLAGS;
|
||||||
if (newVal != mResettingSystemUiFlags) {
|
if (newVal != mResettingSystemUiFlags) {
|
||||||
|
|||||||
Reference in New Issue
Block a user