diff options
| -rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 29 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowStateAnimator.java | 6 |
2 files changed, 26 insertions, 9 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index 6f7f1fb59553..c5168744415d 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2164,6 +2164,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private int mLastBottomInset = 0; private int mLastRightInset = 0; private int mLastSystemUiVisibility = 0; + private int mLastWindowSystemUiVisibility = 0; public DecorView(Context context, int featureId) { @@ -2750,6 +2751,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } @Override + public void onWindowSystemUiVisibilityChanged(int visible) { + mLastWindowSystemUiVisibility = visible; + updateColorViews(null /* insets */); + } + + @Override public WindowInsets onApplyWindowInsets(WindowInsets insets) { mFrameOffsets.set(insets.getSystemWindowInsets()); insets = updateColorViews(insets); @@ -2791,7 +2798,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } WindowManager.LayoutParams attrs = getAttributes(); - int sysUiVisibility = attrs.systemUiVisibility | attrs.subtreeSystemUiVisibility; + int sysUiVisibility = attrs.systemUiVisibility | mLastWindowSystemUiVisibility; // When we expand the window with FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, we still need // to ensure that the rest of the view hierarchy doesn't notice it, unless they've @@ -2812,16 +2819,24 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { lp.rightMargin = consumedRight; lp.bottomMargin = consumedBottom; mContentRoot.setLayoutParams(lp); + + if (insets == null) { + // The insets have changed, but we're not currently in the process + // of dispatching them. + requestApplyInsets(); + } + } + if (insets != null) { + insets = insets.replaceSystemWindowInsets( + insets.getSystemWindowInsetLeft(), + insets.getSystemWindowInsetTop(), + insets.getSystemWindowInsetRight() - consumedRight, + insets.getSystemWindowInsetBottom() - consumedBottom); } } if (insets != null) { - insets = insets.consumeStableInsets().replaceSystemWindowInsets( - insets.getSystemWindowInsetLeft(), - insets.getSystemWindowInsetTop(), - insets.getSystemWindowInsetRight() - consumedRight, - insets.getSystemWindowInsetBottom() - consumedBottom - ); + insets = insets.consumeStableInsets(); } return insets; } diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java index da97876d90cc..ff17d78ac00b 100644 --- a/services/core/java/com/android/server/wm/WindowStateAnimator.java +++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java @@ -16,6 +16,7 @@ package com.android.server.wm; +import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static com.android.server.wm.WindowManagerService.DEBUG_ANIM; import static com.android.server.wm.WindowManagerService.DEBUG_LAYERS; @@ -1271,9 +1272,10 @@ class WindowStateAnimator { // not always reporting the correct system decor rect. In such // cases, we take into account the specified content insets as well. if ((w.mSystemUiVisibility & SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN) - == SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN) { + == SYSTEM_UI_FLAGS_LAYOUT_STABLE_FULLSCREEN + || (w.mAttrs.flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0) { // Don't apply the workaround to apps explicitly requesting - // fullscreen layout. + // fullscreen layout or when the bars are transparent. clipRect.intersect(mClipRect); } else { final int offsetTop = Math.max(clipRect.top, w.mContentInsets.top); |