Camera2: Add basic concurrency guards.
- Serialize access through ICamera interface
- Serialize access to internal parameter structure
Bug: 6243944
Change-Id: I82c9811c1d059b2bca5cca7e3d73890120dbbe59
diff --git a/services/camera/libcameraservice/Camera2Client.h b/services/camera/libcameraservice/Camera2Client.h
index 2476f35..2bdf7d4 100644
--- a/services/camera/libcameraservice/Camera2Client.h
+++ b/services/camera/libcameraservice/Camera2Client.h
@@ -78,8 +78,16 @@
/** ICamera interface-related private members */
+ // Mutex that must be locked by methods implementing the ICamera interface.
+ // Ensures serialization between incoming ICamera calls
+ mutable Mutex mICameraLock;
+
status_t setPreviewWindow(const sp<IBinder>& binder,
const sp<ANativeWindow>& window);
+ void stopPreviewLocked();
+
+ // Mutex that must be locked before accessing mParams, mParamsFlattened
+ mutable Mutex mParamsLock;
String8 mParamsFlattened;
// Current camera state; this is the contents of the CameraParameters object
// in a more-efficient format. The enum values are mostly based off the