Fix missing dock divider.

When invisible the dock divider would have its bounds adjusted to size
0, 0 and that would be sent to Surface Flinger. When it becomes visible
we immediately adjust the size of the surface, but it's too late for
Surface Flinger and it returns wrong size to the renderer. By not
adjusting the dock divider bounds when it's invisible, Surface Flinger
will always hold good size. The position will be adjusted when the
divider gets visible.

Bug: 25612050

Change-Id: Iab0798d6545ae0f8b46eabfe7e4100079779bd06
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 080a2d1..86024ac 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -729,8 +729,18 @@
             mVisibleFrame.set(mContentFrame);
             mStableFrame.set(mContentFrame);
         } else if (mAttrs.type == TYPE_DOCK_DIVIDER) {
-            mDisplayContent.getDockedDividerController().positionDockedStackedDivider(mFrame);
-            mContentFrame.set(mFrame);
+            if (isVisibleLw()) {
+                // We don't adjust the dock divider frame for reasons other than performance. The
+                // real reason is that if it gets adjusted before it is shown for the first time,
+                // it would get size (0, 0). This causes a problem when we finally show the dock
+                // divider and try to draw to it. We do set the surface size at that moment to
+                // the correct size, but it's too late for the Surface Flinger to make it
+                // available for view rendering and as a result the renderer receives size 1, 1.
+                // This way we just keep the divider at the original size and Surface Flinger
+                // will return the correct value to the renderer.
+                mDisplayContent.getDockedDividerController().positionDockedStackedDivider(mFrame);
+                mContentFrame.set(mFrame);
+            }
         } else {
             mContentFrame.set(Math.max(mContentFrame.left, mFrame.left),
                     Math.max(mContentFrame.top, mFrame.top),