summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraFlashlight.h
diff options
context:
space:
mode:
authorChien-Yu Chen <cychen@google.com>2015-02-25 16:04:22 -0800
committerChien-Yu Chen <cychen@google.com>2015-03-03 14:07:57 -0800
commitd231fd61ca94441183abda9766ce6906a5b4c3cf (patch)
tree67dd34bd33fd1fcddb9182b34d5ddc754a259d16 /services/camera/libcameraservice/CameraFlashlight.h
parent88da526d97442c80731e01bfc94c6b47c4b0c3c7 (diff)
downloadframeworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.zip
frameworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.tar.gz
frameworks_av-d231fd61ca94441183abda9766ce6906a5b4c3cf.tar.bz2
camera: implement flashlight for HAL v1 devices
Implement flashlight for HAL v1 devices and remove CameraHardwareInterface's dependency on CameraService to avoid circular dependency. Bug: 2682206 Change-Id: Id5bbccef085b607a6189763fd7fbe2e3f26868c8
Diffstat (limited to 'services/camera/libcameraservice/CameraFlashlight.h')
-rw-r--r--services/camera/libcameraservice/CameraFlashlight.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraFlashlight.h b/services/camera/libcameraservice/CameraFlashlight.h
index ae502b9..30f01f0 100644
--- a/services/camera/libcameraservice/CameraFlashlight.h
+++ b/services/camera/libcameraservice/CameraFlashlight.h
@@ -23,6 +23,7 @@
#include "gui/GLConsumer.h"
#include "gui/Surface.h"
#include "common/CameraDeviceBase.h"
+#include "device1/CameraHardwareInterface.h"
namespace android {
@@ -147,6 +148,7 @@ class CameraDeviceClientFlashControl : public FlashControlBase {
status_t getSmallestSurfaceSize(const camera_info& info, int32_t *width,
int32_t *height);
+ // protected by mLock
status_t hasFlashUnitLocked(const String8& cameraId, bool *hasFlash);
CameraModule *mCameraModule;
@@ -170,6 +172,54 @@ class CameraDeviceClientFlashControl : public FlashControlBase {
Mutex mLock;
};
+/**
+ * Flash control for camera module <= v2.3 and camera HAL v1
+ */
+class CameraHardwareInterfaceFlashControl : public FlashControlBase {
+ public:
+ CameraHardwareInterfaceFlashControl(CameraModule& cameraModule,
+ const camera_module_callbacks_t& callbacks);
+ virtual ~CameraHardwareInterfaceFlashControl();
+
+ // FlashControlBase
+ status_t setTorchMode(const String8& cameraId, bool enabled);
+ status_t hasFlashUnit(const String8& cameraId, bool *hasFlash);
+
+ private:
+ // connect to a camera device
+ status_t connectCameraDevice(const String8& cameraId);
+
+ // disconnect and free mDevice
+ status_t disconnectCameraDevice();
+
+ // initialize the preview window
+ status_t initializePreviewWindow(sp<CameraHardwareInterface> device,
+ int32_t width, int32_t height);
+
+ // start preview and enable torch
+ status_t startPreviewAndTorch();
+
+ // get the smallest surface
+ status_t getSmallestSurfaceSize(int32_t *width, int32_t *height);
+
+ // protected by mLock
+ status_t hasFlashUnitLocked(const String8& cameraId, bool *hasFlash);
+
+ CameraModule *mCameraModule;
+ const camera_module_callbacks_t *mCallbacks;
+ sp<CameraHardwareInterface> mDevice;
+ String8 mCameraId;
+ CameraParameters mParameters;
+ bool mTorchEnabled;
+
+ sp<IGraphicBufferProducer> mProducer;
+ sp<IGraphicBufferConsumer> mConsumer;
+ sp<GLConsumer> mSurfaceTexture;
+ sp<ANativeWindow> mAnw;
+
+ Mutex mLock;
+};
+
} // namespace android
#endif