From ff2064e7dcad3c85005fc4564e04fde184240df9 Mon Sep 17 00:00:00 2001 From: tbalden Date: Sat, 23 Mar 2013 23:06:45 +0100 Subject: Camera: QCOM legacy definitions,HTC cam switch,NO_UPDATE_PREVIEW Updating Camera parameters, and service with several compatibility patches: 1., QCOM legacy CameraParameters and functions: Adding these will make ICS qcomm camera blobs work on JB 4.2. Use BOARD_USES_QCOM_LEGACY_CAM_PARAMS := true in BoardConfig to use this. Also fixes the problem of legacy qcom camera blobs with recent libcameraservice QCOM_HARDWARE changes, where the orientation is messed up on first preview: the fix is leaving out setPreviewWindow(window) for legacy qcomm cam blobs. 2., Also adding NO_UPDATE_PREVIEW flag for legacy purposes. 3., Adding adding the set orientation patch: Always set buffers orientation when setting the qcom camera preview window Fixes the rotated preview on TouchPad https://github.com/CyanogenMod/android_frameworks_base/commit/1a8e41a3c7434737db89b604352575f8b3109e7a 4., camera: Full support for HTC camera switch 5., Adding more parameters for HTC Explorer Change-Id: I2bfc72b8ef027665356788f1db7f96b31d037dbe --- services/camera/libcameraservice/CameraService.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'services/camera/libcameraservice/CameraService.cpp') 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 #include #include +#include +#include #include #include @@ -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 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(); -- cgit v1.1