Fix issue #3291975: Google services frame work crash...

..observed after adding Google account from Gtalk

Change-Id: Ide0646e01ded6f661e4e8de990a21e4d4330b416
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index ba7692d..3cf8138 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -4958,7 +4958,7 @@
             }
             Binder.restoreCallingIdentity(ident);
 
-            if (frame.isEmpty()) {
+            if (frame.isEmpty() || maxLayer == 0) {
                 return null;
             }
 
@@ -4990,6 +4990,10 @@
             rawss = Surface.screenshot(dw, dh, 0, maxLayer);
         }
 
+        if (rawss == null) {
+            return null;
+        }
+        
         Bitmap bm = Bitmap.createBitmap(sw, sh, rawss.getConfig());
         Matrix matrix = new Matrix();
         ScreenRotationAnimation.createRotationMatrix(rot, dw, dh, matrix);