Reset ANativeWindow crop on buffer geometry changes.

This changes the ANativeWindow API and the two implementations to reset
the window's crop rectangle to be uncropped when the window's buffer
geometry is changed.

Bug: 3359604
Change-Id: I64283dc8382ae687787ec0bebe6a5d5b4a0dcd6b
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index e21bab7..1e9bd74 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -827,13 +827,15 @@
 
 int Surface::crop(Rect const* rect)
 {
-    // empty/invalid rects are not allowed
-    if (rect->isEmpty())
-        return BAD_VALUE;
-
     Mutex::Autolock _l(mSurfaceLock);
     // TODO: validate rect size
-    mNextBufferCrop = *rect;
+
+    if (rect == NULL || rect->isEmpty()) {
+        mNextBufferCrop = Rect(0,0);
+    } else {
+        mNextBufferCrop = *rect;
+    }
+
     return NO_ERROR;
 }
 
@@ -884,6 +886,9 @@
         // EGLConfig validation.
         mFormat = format;
     }
+
+    mNextBufferCrop = Rect(0,0);
+
     return NO_ERROR;
 }