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.cpp32
1 files changed, 28 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f6825d7..8d95d65 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -374,8 +374,11 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
(void *)cameraId);
// Enable zoom, error, focus, and metadata messages by default
- enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS |
- CAMERA_MSG_PREVIEW_METADATA);
+ enableMsgType(CAMERA_MSG_ERROR | CAMERA_MSG_ZOOM | CAMERA_MSG_FOCUS
+#ifndef QCOM_HARDWARE
+ | CAMERA_MSG_PREVIEW_METADATA
+#endif
+ );
// Callback is disabled by default
mPreviewCallbackFlag = CAMERA_FRAME_CALLBACK_FLAG_NOOP;
@@ -383,6 +386,9 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
mPlayShutterSound = true;
cameraService->setCameraBusy(cameraId);
cameraService->loadSound();
+#ifdef QCOM_HARDWARE
+ mFaceDetection = false;
+#endif
LOG1("Client::Client X (pid %d)", callingPid);
}
@@ -522,9 +528,9 @@ void CameraService::Client::disconnect() {
// Release the held ANativeWindow resources.
if (mPreviewWindow != 0) {
+ mHardware->setPreviewWindow(0);
disconnectWindow(mPreviewWindow);
mPreviewWindow = 0;
- mHardware->setPreviewWindow(mPreviewWindow);
}
mHardware.clear();
@@ -564,6 +570,8 @@ status_t CameraService::Client::setPreviewWindow(const sp<IBinder>& binder,
native_window_set_buffers_transform(window.get(), mOrientation);
result = mHardware->setPreviewWindow(window);
}
+ } else {
+ result = mHardware->setPreviewWindow(window);
}
if (result == NO_ERROR) {
@@ -623,7 +631,10 @@ void CameraService::Client::setPreviewCallbackFlag(int callback_flag) {
// start preview mode
status_t CameraService::Client::startPreview() {
LOG1("startPreview (pid %d)", getCallingPid());
- enableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#ifdef QCOM_HARDWARE
+ if (mFaceDetection)
+ enableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#endif
return startCameraMode(CAMERA_PREVIEW_MODE);
}
@@ -908,6 +919,14 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a
}
else if (cmd == CAMERA_CMD_HISTOGRAM_OFF) {
disableMsgType(CAMERA_MSG_STATS_DATA);
+#ifdef QCOM_HARDWARE
+ } else if (cmd == CAMERA_CMD_START_FACE_DETECTION) {
+ mFaceDetection = true;
+ enableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+ } else if (cmd == CAMERA_CMD_STOP_FACE_DETECTION) {
+ mFaceDetection = false;
+ disableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#endif
}
@@ -1161,6 +1180,11 @@ void CameraService::Client::handleCompressedPicture(const sp<IMemory>& mem) {
if (!mburstCnt) {
LOG1("mburstCnt = %d", mburstCnt);
disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
+#ifdef QCOM_HARDWARE
+ if (mFaceDetection) {
+ enableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+ }
+#endif
}
sp<ICameraClient> c = mCameraClient;
mLock.unlock();