Camera: Allow finalizeOutputConfiguration not adding new surface

If the application calls finalizeOutputConfiguration without adding new
surface, as long as there is at least one surface in the
OutputConfiguration, do not throw exception.

Add logic to not allow finalizeOutputConfigurations twice on a
particular stream.

Test: testDeferredSurfaces cts and GoogleCameraApp manual test.
Bug: 35137641
Change-Id: I96061231e9b884e73c92520e7f2c021db32fa731
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index 2f6d414..012beb4 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -215,6 +215,7 @@
         int format;
         android_dataspace dataSpace;
         int32_t consumerUsage;
+        bool finalized = false;
         OutputStreamInfo() :
                 width(-1), height(-1), format(-1), dataSpace(HAL_DATASPACE_UNKNOWN),
                 consumerUsage(0) {}