Camera: Disconnect camera after checking flash unit
Disconnect camera device after opening it just to check if
it has a flash unit. Leave it open if torch is being turned on.
Bug: 28170202
Change-Id: Ic4a70a1b4be28625449ed52cbf6c5d214089adb7
diff --git a/services/camera/libcameraservice/CameraFlashlight.h b/services/camera/libcameraservice/CameraFlashlight.h
index 4d5fe8d..5cde372 100644
--- a/services/camera/libcameraservice/CameraFlashlight.h
+++ b/services/camera/libcameraservice/CameraFlashlight.h
@@ -203,7 +203,11 @@
status_t getSmallestSurfaceSize(int32_t *width, int32_t *height);
// protected by mLock
- status_t hasFlashUnitLocked(const String8& cameraId, bool *hasFlash);
+ // If this function opens camera device in order to check if it has a flash unit, the
+ // camera device will remain open if keepDeviceOpen is true and the camera device will be
+ // closed if keepDeviceOpen is false. If camera device is already open when calling this
+ // function, keepDeviceOpen is ignored.
+ status_t hasFlashUnitLocked(const String8& cameraId, bool *hasFlash, bool keepDeviceOpen);
CameraModule *mCameraModule;
const camera_module_callbacks_t *mCallbacks;