Fix SurfaceControl.setDisplaySurface() such that it accepts a null Surface

also fix a typo that made us call the wrong Surface ctor

Bug: 8225509
Change-Id: I23f92179b6003d4c3e0febb35166c1caeafa27f5
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index a218488..5da5b4f 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -320,8 +320,11 @@
         jobject tokenObj, jint nativeSurfaceObject) {
     sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
     if (token == NULL) return;
+    sp<IGraphicBufferProducer> bufferProducer;
     sp<Surface> sur(reinterpret_cast<Surface *>(nativeSurfaceObject));
-    sp<IGraphicBufferProducer> bufferProducer(sur->getIGraphicBufferProducer());
+    if (sur != NULL) {
+        bufferProducer = sur->getIGraphicBufferProducer();
+    }
     SurfaceComposerClient::setDisplaySurface(token, bufferProducer);
 }