summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.h
diff options
context:
space:
mode:
authorChien-Yu Chen <cychen@google.com>2015-02-09 13:29:57 -0800
committerChien-Yu Chen <cychen@google.com>2015-02-12 15:05:30 -0800
commit3068d73c6c7e1f44523b1466b903a9c82408b258 (patch)
tree197720671edfdcc2c75a7d05a13c60be2b17fb75 /services/camera/libcameraservice/CameraService.h
parent8f7b7fa417566e9a6a29ea9f0e220b3cd6d1a9e3 (diff)
downloadframeworks_av-3068d73c6c7e1f44523b1466b903a9c82408b258.zip
frameworks_av-3068d73c6c7e1f44523b1466b903a9c82408b258.tar.gz
frameworks_av-3068d73c6c7e1f44523b1466b903a9c82408b258.tar.bz2
camera: implement flashlight control
Implement flashlight API for module v2.4 by calling module APIs and by for hal v2 and v3 by using CameraDeviceBase. Bug: 2682206 Change-Id: Ib8b77f6fd462489d672f27e14fe37801d35b7544
Diffstat (limited to 'services/camera/libcameraservice/CameraService.h')
-rw-r--r--services/camera/libcameraservice/CameraService.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 7d0df3a..84bcdb8 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -36,6 +36,8 @@
#include <camera/CameraParameters.h>
#include <camera/ICameraServiceListener.h>
+#include "CameraFlashlight.h"
+
#include "common/CameraModule.h"
@@ -70,6 +72,9 @@ public:
// HAL Callbacks
virtual void onDeviceStatusChanged(int cameraId,
int newStatus);
+ virtual void onTorchStatusChanged(const String16& cameraId,
+ ICameraServiceListener::TorchStatus
+ newStatus);
/////////////////////////////////////////////////////////////////////
// ICameraService
@@ -112,6 +117,9 @@ public:
/*out*/
String16* parameters);
+ virtual status_t setTorchMode(const String16& cameraId, bool enabled,
+ const sp<IBinder>& clientBinder);
+
// OK = supports api of that version, -EOPNOTSUPP = does not support
virtual status_t supportsCameraApi(
int cameraId, int apiVersion);
@@ -408,6 +416,32 @@ private:
int32_t cameraId,
const StatusVector *rejectSourceStates = NULL);
+ // flashlight control
+ sp<CameraFlashlight> mFlashlight;
+ // guard mTorchStatusMap and mTorchClientMap
+ Mutex mTorchStatusMutex;
+ // camera id -> torch status
+ KeyedVector<String16, ICameraServiceListener::TorchStatus> mTorchStatusMap;
+ // camera id -> torch client binder
+ // only store the last client that turns on each camera's torch mode
+ KeyedVector<String16, sp<IBinder> > mTorchClientMap;
+
+ // check and handle if torch client's process has died
+ void handleTorchClientBinderDied(const wp<IBinder> &who);
+
+ // handle torch mode status change and invoke callbacks. mTorchStatusMutex
+ // should be locked.
+ void onTorchStatusChangedLocked(const String16& cameraId,
+ ICameraServiceListener::TorchStatus newStatus);
+
+ // get a camera's torch status. mTorchStatusMutex should be locked.
+ ICameraServiceListener::TorchStatus getTorchStatusLocked(
+ const String16 &cameraId) const;
+
+ // set a camera's torch status. mTorchStatusMutex should be locked.
+ status_t setTorchStatusLocked(const String16 &cameraId,
+ ICameraServiceListener::TorchStatus status);
+
// IBinder::DeathRecipient implementation
virtual void binderDied(const wp<IBinder> &who);