Merge "WM: Stop tampering with sysuiVisibility for layout"
This commit is contained in:
@@ -2666,17 +2666,21 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
// The status bar is the only window allowed to exhibit keyguard behavior.
|
||||
attrs.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
||||
}
|
||||
}
|
||||
|
||||
private int getImpliedSysUiFlagsForLayout(LayoutParams attrs) {
|
||||
int impliedFlags = 0;
|
||||
if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) {
|
||||
attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
impliedFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
|
||||
}
|
||||
final boolean forceWindowDrawsStatusBarBackground =
|
||||
(attrs.privateFlags & PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND) != 0;
|
||||
if ((attrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0
|
||||
|| forceWindowDrawsStatusBarBackground
|
||||
&& attrs.height == MATCH_PARENT && attrs.width == MATCH_PARENT) {
|
||||
attrs.subtreeSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
impliedFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
}
|
||||
return impliedFlags;
|
||||
}
|
||||
|
||||
void readLidState() {
|
||||
@@ -4832,7 +4836,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
final int fl = PolicyControl.getWindowFlags(win, attrs);
|
||||
final int pfl = attrs.privateFlags;
|
||||
final int sim = attrs.softInputMode;
|
||||
final int sysUiFl = PolicyControl.getSystemUiVisibility(win, null);
|
||||
final int requestedSysUiFl = PolicyControl.getSystemUiVisibility(win, null);
|
||||
final int sysUiFl = requestedSysUiFl | getImpliedSysUiFlagsForLayout(attrs);
|
||||
|
||||
final Rect pf = mTmpParentFrame;
|
||||
final Rect df = mTmpDisplayFrame;
|
||||
|
||||
@@ -23,6 +23,8 @@ import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.graphics.PixelFormat;
|
||||
import android.platform.test.annotations.Presubmit;
|
||||
import android.support.test.filters.SmallTest;
|
||||
@@ -94,4 +96,13 @@ public class PhoneWindowManagerLayoutTest extends PhoneWindowManagerTestBase {
|
||||
assertInsetByTopBottom(mAppWindow.contentFrame, STATUS_BAR_HEIGHT, NAV_BAR_HEIGHT);
|
||||
assertInsetByTopBottom(mAppWindow.decorFrame, 0, NAV_BAR_HEIGHT);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addingWindow_doesNotTamperWithSysuiFlags() {
|
||||
mAppWindow.attrs.flags |= FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||
mPolicy.addWindow(mAppWindow);
|
||||
|
||||
assertEquals(0, mAppWindow.attrs.systemUiVisibility);
|
||||
assertEquals(0, mAppWindow.attrs.subtreeSystemUiVisibility);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user