OSDN Git Service

Fix wrongly laid out navigation color view
authorAdrian Roos <roosa@google.com>
Thu, 15 Oct 2015 22:38:38 +0000 (15:38 -0700)
committerAdrian Roos <roosa@google.com>
Thu, 15 Oct 2015 22:39:46 +0000 (15:39 -0700)
The SystemUI visibility listener in DecorView
gets called between the measure and layout passes
and is therefore not allowed to change layout parameters.

This change makes sure that changes to the color view
layout parameters are applied eagerly when the insets
change instead of waiting for the views to become visible.

Bug: 24614374

Change-Id: If9df18f582163d0869c28a852c36697b1ce50621

core/java/com/android/internal/policy/PhoneWindow.java

index a7bdbe0..8e8d352 100644 (file)
@@ -3010,16 +3010,16 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                 int vis = show ? VISIBLE : INVISIBLE;
                 visibilityChanged = state.targetVisibility != vis;
                 state.targetVisibility = vis;
+                LayoutParams lp = (LayoutParams) view.getLayoutParams();
+                if (lp.height != resolvedHeight || lp.width != resolvedWidth
+                        || lp.gravity != resolvedGravity || lp.rightMargin != rightMargin) {
+                    lp.height = resolvedHeight;
+                    lp.width = resolvedWidth;
+                    lp.gravity = resolvedGravity;
+                    lp.rightMargin = rightMargin;
+                    view.setLayoutParams(lp);
+                }
                 if (show) {
-                    LayoutParams lp = (LayoutParams) view.getLayoutParams();
-                    if (lp.height != resolvedHeight || lp.width != resolvedWidth
-                            || lp.gravity != resolvedGravity || lp.rightMargin != rightMargin) {
-                        lp.height = resolvedHeight;
-                        lp.width = resolvedWidth;
-                        lp.gravity = resolvedGravity;
-                        lp.rightMargin = rightMargin;
-                        view.setLayoutParams(lp);
-                    }
                     view.setBackgroundColor(color);
                 }
             }