Android->SystemUiVisibility:添加View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR,用于第三方应用全屏显示(状态栏不会上滑显示)
This commit is contained in:
@ -2613,6 +2613,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
*/
|
||||
public static final int SYSTEM_UI_FLAG_MULTI_HALF_WINDOW = 0x00002000;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final int SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR = 0x00004000;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #SYSTEM_UI_FLAG_LOW_PROFILE} instead.
|
||||
*/
|
||||
|
||||
@ -3909,6 +3909,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
// It's a system nav bar or a portrait screen; nav bar goes on bottom.
|
||||
int top = displayHeight - overscanBottom
|
||||
- mNavigationBarHeightForRotation[displayRotation];
|
||||
|
||||
if(mFocusedWindow != null){
|
||||
int visible = PolicyControl.getSystemUiVisibility(mFocusedWindow, null) & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR;
|
||||
if(visible != 0){
|
||||
top = displayHeight - overscanBottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mTmpNavigationFrame.set(0, top, displayWidth, displayHeight - overscanBottom);
|
||||
mStableBottom = mStableFullscreenBottom = mTmpNavigationFrame.top;
|
||||
if (transientNavBarShowing) {
|
||||
@ -4887,7 +4896,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
+ " lp.flags=0x" + Integer.toHexString(fl));
|
||||
}
|
||||
topIsFullscreen = ((lp.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0
|
||||
|| (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0)
|
||||
|| (mLastSystemUiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) || ((mLastSystemUiFlags & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR) != 0)
|
||||
//&& (lp.flags & WindowManager.LayoutParams.FLAG_HALF_SCREEN_WINDOW) == 0;
|
||||
&& lp.align != WindowManagerPolicy.WINDOW_ALIGN_RIGHT;
|
||||
topIsMultiWindow = mTopFullscreenOpaqueWindowState!=null?
|
||||
@ -5031,6 +5040,32 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
|
||||
@Override
|
||||
public int focusChangedLw(WindowState lastFocus, WindowState newFocus) {
|
||||
if(lastFocus != null && newFocus != null && mFocusedWindow != null){
|
||||
int visible = PolicyControl.getSystemUiVisibility(lastFocus, null) & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR;
|
||||
if(visible != 0){
|
||||
if(lastFocus.getOwningPackage().equals(newFocus.getOwningPackage())){
|
||||
if(DEBUG)Slog.w(TAG,"Not showing bar, lastFocus win SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR and newfocus packageName == lastFocus");
|
||||
return 0;
|
||||
}else if(newFocus.getOwningPackage().equals("android")){
|
||||
if(DEBUG)Slog.w(TAG,"Not showing bar, lastFocus win SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR and newFocus win is android ");
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
int visible2 = PolicyControl.getSystemUiVisibility(mFocusedWindow, null) & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR;
|
||||
if(visible2 != 0){
|
||||
if(mFocusedWindow.getOwningPackage().equals(newFocus.getOwningPackage())){
|
||||
if(DEBUG)Slog.w(TAG,"Not showing bar, lastFocus win SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR and newfocus packageName == lastFocus");
|
||||
return 0;
|
||||
}else if(newFocus.getOwningPackage().equals("android")){
|
||||
if(DEBUG)Slog.w(TAG,"Not showing bar, lastFocus win SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR and newFocus win is android ");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
mFocusedWindow = newFocus;
|
||||
if ((updateSystemUiVisibilityLw()&SYSTEM_UI_CHANGING_LAYOUT) != 0) {
|
||||
// If the navigation bar has been hidden or shown, we need to do another
|
||||
@ -5864,6 +5899,16 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
if (DEBUG) Slog.d(TAG, "Not showing transient bar, wrong swipe target");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isNavBarEmpty(mLastSystemUiFlags)){
|
||||
int visible = mLastSystemUiFlags & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR;
|
||||
if(visible != 0){
|
||||
if(DEBUG)Slog.w(TAG, "Not showing bar, SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR");
|
||||
return;
|
||||
}
|
||||
}
|
||||
//(mLastSystemUiFlags & View.SYSTEM_UI_FLAG_LAYOUT_ALWAYS_HIDE_SYSTEMBAR) != 0;
|
||||
|
||||
if (sb) mStatusBarController.showTransient();
|
||||
if (nb) mNavigationBarController.showTransient();
|
||||
mImmersiveModeConfirmation.confirmCurrentPrompt();
|
||||
@ -7049,6 +7094,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
&& canHideNavigationBar();
|
||||
}
|
||||
|
||||
private static boolean isNavBarEmpty(int systemUiFlags) {
|
||||
final int disableNavigationBar = (View.STATUS_BAR_DISABLE_HOME
|
||||
| View.STATUS_BAR_DISABLE_BACK
|
||||
| View.STATUS_BAR_DISABLE_RECENT);
|
||||
|
||||
return (systemUiFlags & disableNavigationBar) == disableNavigationBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return whether the navigation or status bar can be made translucent
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user