Set the light status flag based on right window
The flag needs to be set based on the top window that is either reaching beneath the status bar or is dimming. Bug: 19233606 Change-Id: I7b97f6869e3b7d5ae2b7030122b311ee9e13871f
This commit is contained in:
@@ -365,6 +365,11 @@ public interface WindowManagerPolicy {
|
||||
* @return true if window is on default display.
|
||||
*/
|
||||
public boolean isDefaultDisplay();
|
||||
|
||||
/**
|
||||
* Check whether the window is currently dimming.
|
||||
*/
|
||||
public boolean isDimming();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -457,6 +457,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
static final Rect mTmpNavigationFrame = new Rect();
|
||||
|
||||
WindowState mTopFullscreenOpaqueWindowState;
|
||||
WindowState mTopFullscreenOpaqueOrDimmingWindowState;
|
||||
HashSet<IApplicationToken> mAppsToBeHidden = new HashSet<IApplicationToken>();
|
||||
HashSet<IApplicationToken> mAppsThatDismissKeyguard = new HashSet<IApplicationToken>();
|
||||
boolean mTopIsFullscreen;
|
||||
@@ -3972,6 +3973,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
@Override
|
||||
public void beginPostLayoutPolicyLw(int displayWidth, int displayHeight) {
|
||||
mTopFullscreenOpaqueWindowState = null;
|
||||
mTopFullscreenOpaqueOrDimmingWindowState = null;
|
||||
mAppsToBeHidden.clear();
|
||||
mAppsThatDismissKeyguard.clear();
|
||||
mForceStatusBar = false;
|
||||
@@ -4060,6 +4062,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
&& attrs.height == WindowManager.LayoutParams.MATCH_PARENT) {
|
||||
if (DEBUG_LAYOUT) Slog.v(TAG, "Fullscreen window: " + win);
|
||||
mTopFullscreenOpaqueWindowState = win;
|
||||
if (mTopFullscreenOpaqueOrDimmingWindowState == null) {
|
||||
mTopFullscreenOpaqueOrDimmingWindowState = win;
|
||||
}
|
||||
if (!mAppsThatDismissKeyguard.isEmpty() &&
|
||||
mDismissKeyguard == DISMISS_KEYGUARD_NONE) {
|
||||
if (DEBUG_LAYOUT) Slog.v(TAG,
|
||||
@@ -4085,6 +4090,11 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mTopFullscreenOpaqueOrDimmingWindowState == null
|
||||
&& win.isVisibleOrBehindKeyguardLw() && !win.isGoneForLayoutLw()
|
||||
&& win.isDimming()) {
|
||||
mTopFullscreenOpaqueOrDimmingWindowState = win;
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@@ -6051,6 +6061,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
if (mForcingShowNavBar && win.getSurfaceLayer() < mForcingShowNavBarLayer) {
|
||||
tmpVisibility &= ~PolicyControl.adjustClearableFlags(win, View.SYSTEM_UI_CLEARABLE_FLAGS);
|
||||
}
|
||||
tmpVisibility = updateLightStatusBarLw(tmpVisibility);
|
||||
final int visibility = updateSystemBarsLw(win, mLastSystemUiFlags, tmpVisibility);
|
||||
final int diff = visibility ^ mLastSystemUiFlags;
|
||||
final boolean needsMenu = win.getNeedsMenuLw(mTopFullscreenOpaqueWindowState);
|
||||
@@ -6079,6 +6090,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
return diff;
|
||||
}
|
||||
|
||||
private int updateLightStatusBarLw(int vis) {
|
||||
WindowState statusColorWin = isStatusBarKeyguard() && !mHideLockScreen
|
||||
? mStatusBar
|
||||
: mTopFullscreenOpaqueOrDimmingWindowState;
|
||||
|
||||
if (statusColorWin != null) {
|
||||
if (statusColorWin == mTopFullscreenOpaqueWindowState) {
|
||||
// If the top fullscreen-or-dimming window is also the top fullscreen, respect
|
||||
// its light flag.
|
||||
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
vis |= PolicyControl.getSystemUiVisibility(statusColorWin, null)
|
||||
& View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
} else if (statusColorWin != null && statusColorWin.isDimming()) {
|
||||
// Otherwise if it's dimming, clear the light flag.
|
||||
vis &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
}
|
||||
}
|
||||
return vis;
|
||||
}
|
||||
|
||||
private int updateSystemBarsLw(WindowState win, int oldVis, int vis) {
|
||||
// apply translucent bar vis flags
|
||||
WindowState transWin = isStatusBarKeyguard() && !mHideLockScreen
|
||||
@@ -6383,6 +6414,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
pw.print(prefix); pw.print("mTopFullscreenOpaqueWindowState=");
|
||||
pw.println(mTopFullscreenOpaqueWindowState);
|
||||
}
|
||||
if (mTopFullscreenOpaqueOrDimmingWindowState != null) {
|
||||
pw.print(prefix); pw.print("mTopFullscreenOpaqueOrDimmingWindowState=");
|
||||
pw.println(mTopFullscreenOpaqueOrDimmingWindowState);
|
||||
}
|
||||
if (mForcingShowNavBar) {
|
||||
pw.print(prefix); pw.print("mForcingShowNavBar=");
|
||||
pw.println(mForcingShowNavBar); pw.print( "mForcingShowNavBarLayer=");
|
||||
|
||||
@@ -1288,6 +1288,15 @@ final class WindowState implements WindowManagerPolicy.WindowState {
|
||||
return displayContent.isDefaultDisplay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDimming() {
|
||||
TaskStack stack = getStack();
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
return stack.isDimming(mWinAnimator);
|
||||
}
|
||||
|
||||
public void setShowToOwnerOnlyLocked(boolean showToOwnerOnly) {
|
||||
mShowToOwnerOnly = showToOwnerOnly;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user