summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
Diffstat (limited to 'services/camera')
-rw-r--r--services/camera/libcameraservice/Android.mk8
-rw-r--r--services/camera/libcameraservice/CameraClient.cpp7
-rw-r--r--services/camera/libcameraservice/CameraService.cpp24
3 files changed, 39 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk
index eff47c8..3e2ac14 100644
--- a/services/camera/libcameraservice/Android.mk
+++ b/services/camera/libcameraservice/Android.mk
@@ -40,6 +40,14 @@ LOCAL_C_INCLUDES += \
system/media/camera/include \
external/jpeg
+ifeq ($(BOARD_USES_QCOM_LEGACY_CAM_PARAMS),true)
+ LOCAL_CFLAGS += -DQCOM_LEGACY_CAM_PARAMS
+endif
+
+ifeq ($(BOARD_HAVE_HTC_FFC), true)
+LOCAL_CFLAGS += -DBOARD_HAVE_HTC_FFC
+endif
+
LOCAL_MODULE:= libcameraservice
include $(BUILD_SHARED_LIBRARY)
diff --git a/services/camera/libcameraservice/CameraClient.cpp b/services/camera/libcameraservice/CameraClient.cpp
index 1cdb938..967562d 100644
--- a/services/camera/libcameraservice/CameraClient.cpp
+++ b/services/camera/libcameraservice/CameraClient.cpp
@@ -251,8 +251,10 @@ void CameraClient::disconnect() {
// Release the held ANativeWindow resources.
if (mPreviewWindow != 0) {
#ifdef QCOM_HARDWARE
+#ifndef NO_UPDATE_PREVIEW
mHardware->setPreviewWindow(0);
#endif
+#endif
disconnectWindow(mPreviewWindow);
mPreviewWindow = 0;
#ifndef QCOM_HARDWARE
@@ -297,9 +299,14 @@ status_t CameraClient::setPreviewWindow(const sp<IBinder>& binder,
result = mHardware->setPreviewWindow(window);
}
#ifdef QCOM_HARDWARE
+#ifndef NO_UPDATE_PREVIEW
} else {
+ if (window != 0) {
+ native_window_set_buffers_transform(window.get(), mOrientation);
+ }
result = mHardware->setPreviewWindow(window);
#endif
+#endif
}
if (result == NO_ERROR) {
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();