summaryrefslogtreecommitdiffstats
path: root/services/camera/libcameraservice/CameraService.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera/libcameraservice/CameraService.cpp')
-rw-r--r--services/camera/libcameraservice/CameraService.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index d8365eb..387a784 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -21,6 +21,8 @@
#include <stdio.h>
#include <sys/types.h>
#include <pthread.h>
+#include <unistd.h>
+#include <fcntl.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -68,6 +70,24 @@ static int getCallingUid() {
// ----------------------------------------------------------------------------
+#if defined(BOARD_HAVE_HTC_FFC)
+#define HTC_SWITCH_CAMERA_FILE_PATH "/sys/android_camera2/htcwc"
+static void htcCameraSwitch(int cameraId)
+{
+ char buffer[16];
+ int fd;
+
+ if (access(HTC_SWITCH_CAMERA_FILE_PATH, W_OK) == 0) {
+ snprintf(buffer, sizeof(buffer), "%d", cameraId);
+
+ fd = open(HTC_SWITCH_CAMERA_FILE_PATH, O_WRONLY);
+ write(fd, buffer, strlen(buffer));
+ close(fd);
+ }
+}
+#endif
+
+
// This is ugly and only safe if we never re-create the CameraService, but
// should be ok for now.
static CameraService *gCameraService;
@@ -158,6 +178,10 @@ sp<ICamera> CameraService::connect(
return NULL;
}
+#if defined(BOARD_HAVE_HTC_FFC)
+ htcCameraSwitch(cameraId);
+#endif
+
Mutex::Autolock lock(mServiceLock);
if (mClient[cameraId] != 0) {
client = mClient[cameraId].promote();