Implement issue #3201795: Improve transition when keyboard comes up

ViewRoot now does a fade animation between a snapshot of the previous
layout to the new one when its content rect changes.

Also tweaked some things in the window manager to fix problems in
deciding when to animate the movement of a window and when not to.

Change-Id: I9b4b3bd53c8258bd39a2f2fc315e77cfc56a409c
diff --git a/services/java/com/android/server/ScreenRotationAnimation.java b/services/java/com/android/server/ScreenRotationAnimation.java
index 1cc6a2a..a95a6c7 100644
--- a/services/java/com/android/server/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/ScreenRotationAnimation.java
@@ -122,7 +122,9 @@
         mSurface.unlockCanvasAndPost(c);
         Surface.closeTransaction();
 
-        screenshot.recycle();
+        if (screenshot != null) {
+            screenshot.recycle();
+        }
     }
 
     static int deltaRotation(int oldRotation, int newRotation) {