summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSunid Wilson <sunidw@codeaurora.org>2012-03-19 11:46:47 -0700
committerSteve Kondik <shade@chemlab.org>2012-07-08 23:48:45 -0700
commita4905d0e32d65bee0adb455b32ecbb49b5491257 (patch)
treeca9753ef0610e34f81f64606842c11e472361c71 /services
parent605f6411e8cf512e8cfadf67598e68e976cd5c78 (diff)
downloadframeworks_base-a4905d0e32d65bee0adb455b32ecbb49b5491257.zip
frameworks_base-a4905d0e32d65bee0adb455b32ecbb49b5491257.tar.gz
frameworks_base-a4905d0e32d65bee0adb455b32ecbb49b5491257.tar.bz2
camera: Send proper preview window updates to HAL
During setPreviewWindow call camera_preview_window instance will be passed to the HAL. camera_preview_window instance will never change when ANativeWindow is updated. Hence HAL tries to use old preview window handle not knowing that the preview window is updated. Added the check in camera interface to reset the preview handle based on whether ANativeWindow instance is changed or not. CRs-Fixed: 341892 Change-Id: I6743f24cbd4467025d6fe21098c7ce6813017d5e Frameworks: Allow CameraService to set window when preview is not running Change-Id: Iab3f652ed3a7639c660e85c98a837215985a3296 Camera: Enable metadata callback after snapshot Change-Id: I734fc596b7549d4dcc00aee466e1c4be02e38c8d CRs-fixed: 346728
Diffstat (limited to 'services')
-rwxr-xr-x[-rw-r--r--]services/camera/libcameraservice/CameraHardwareInterface.h5
-rw-r--r--services/camera/libcameraservice/CameraService.cpp32
-rw-r--r--services/camera/libcameraservice/CameraService.h4
3 files changed, 36 insertions, 5 deletions
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 57f923f..9a29e8f 100644..100755
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -115,6 +115,11 @@ public:
LOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
if (mDevice->ops->set_preview_window) {
+ LOGV("%s buf %p mPreviewWindow %p", __FUNCTION__, buf.get(), mPreviewWindow.get());
+ if (mPreviewWindow.get() && (buf.get() != mPreviewWindow.get())) {
+ mDevice->ops->set_preview_window(mDevice, 0);
+ }
+
mPreviewWindow = buf;
mHalPreviewWindow.user = this;
LOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
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();
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 0d29105..33f7226 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -182,7 +182,9 @@ private:
int mPreviewCallbackFlag;
int mOrientation; // Current display orientation
bool mPlayShutterSound;
-
+#ifdef QCOM_HARDWARE
+ bool mFaceDetection;
+#endif
// Ensures atomicity among the public methods
mutable Mutex mLock;
// This is a binder of Surface or SurfaceTexture.