Defer the Surface.show until animation phase.

This fixes a rotation bug introduced by delaying rendering animation
into the Surface. Now instead of delaying the rendering we delay the
show by eliminating a point where we were showing the Surface too soon.

Change-Id: I63ad3b494963111ffc96569093c8d43517c5408b
diff --git a/services/java/com/android/server/wm/WindowStateAnimator.java b/services/java/com/android/server/wm/WindowStateAnimator.java
index 3a51afe..0cebee7 100644
--- a/services/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/java/com/android/server/wm/WindowStateAnimator.java
@@ -978,7 +978,7 @@
 
         setSurfaceBoundaries(recoveringMemory);
 
-        if (w.mAttachedHidden || !w.isReadyForDisplay() || !w.isDrawnLw()) {
+        if (w.mAttachedHidden || !w.isReadyForDisplay()) {
             if (!mLastHidden) {
                 //dump();
                 mLastHidden = true;
@@ -1136,17 +1136,15 @@
                     + " animating=" + mAnimating
                     + " tok animating="
                     + (mWin.mAppToken != null ? mWin.mAppToken.mAppAnimator.animating : false));
-            if (!showSurfaceRobustlyLocked()) {
-                return false;
-            }
 
             mService.enableScreenIfNeededLocked();
 
             applyEnterAnimationLocked();
 
+            // Force the show in the next prepareSurfaceLocked() call.
             mLastAlpha = -1;
-            mLastHidden = false;
             mDrawState = HAS_DRAWN;
+            mService.scheduleAnimationLocked();
 
             int i = mWin.mChildWindows.size();
             while (i > 0) {