Loading services/camera/libcameraservice/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,8 @@ LOCAL_SHARED_LIBRARIES:= \ LOCAL_MODULE:= libcameraservice ifeq ($(BOARD_HAVE_HTC_FFC), true) LOCAL_CFLAGS += -DBOARD_HAVE_HTC_FFC endif include $(BUILD_SHARED_LIBRARY) services/camera/libcameraservice/CameraService.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -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> Loading Loading @@ -66,6 +68,23 @@ 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; Loading Loading @@ -157,6 +176,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(); Loading Loading
services/camera/libcameraservice/Android.mk +4 −0 Original line number Diff line number Diff line Loading @@ -21,4 +21,8 @@ LOCAL_SHARED_LIBRARIES:= \ LOCAL_MODULE:= libcameraservice ifeq ($(BOARD_HAVE_HTC_FFC), true) LOCAL_CFLAGS += -DBOARD_HAVE_HTC_FFC endif include $(BUILD_SHARED_LIBRARY)
services/camera/libcameraservice/CameraService.cpp +23 −0 Original line number Diff line number Diff line Loading @@ -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> Loading Loading @@ -66,6 +68,23 @@ 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; Loading Loading @@ -157,6 +176,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(); Loading