Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c9823ac authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Properly redispatch systemUiVisibility flags" into lmp-dev

parents b84b1058 ce4a0cf9
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -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) {
@@ -2749,6 +2750,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
            updateColorViews(null /* insets */);
        }

        @Override
        public void onWindowSystemUiVisibilityChanged(int visible) {
            mLastWindowSystemUiVisibility = visible;
            updateColorViews(null /* insets */);
        }

        @Override
        public WindowInsets onApplyWindowInsets(WindowInsets insets) {
            mFrameOffsets.set(insets.getSystemWindowInsets());
@@ -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.consumeStableInsets().replaceSystemWindowInsets(
                    insets = insets.replaceSystemWindowInsets(
                            insets.getSystemWindowInsetLeft(),
                            insets.getSystemWindowInsetTop(),
                            insets.getSystemWindowInsetRight() - consumedRight,
                        insets.getSystemWindowInsetBottom() - consumedBottom
                );
                            insets.getSystemWindowInsetBottom() - consumedBottom);
                }
            }

            if (insets != null) {
                insets = insets.consumeStableInsets();
            }
            return insets;
        }
+4 −2
Original line number Diff line number Diff line
@@ -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);