summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/camera/Camera.h3
-rw-r--r--services/camera/libcameraservice/CameraClient.cpp24
-rw-r--r--services/camera/libcameraservice/CameraHardwareInterface.h6
-rw-r--r--services/camera/libcameraservice/CameraService.cpp15
4 files changed, 44 insertions, 4 deletions
diff --git a/include/camera/Camera.h b/include/camera/Camera.h
index 234e165..ad4db3b 100644
--- a/include/camera/Camera.h
+++ b/include/camera/Camera.h
@@ -46,6 +46,9 @@ struct CameraInfo {
* right of the screen, the value should be 270.
*/
int orientation;
+#ifdef QCOM_HARDWARE
+ int mode;
+#endif
};
class ICameraService;
diff --git a/services/camera/libcameraservice/CameraClient.cpp b/services/camera/libcameraservice/CameraClient.cpp
index 6be7403..1cdb938 100644
--- a/services/camera/libcameraservice/CameraClient.cpp
+++ b/services/camera/libcameraservice/CameraClient.cpp
@@ -83,8 +83,10 @@ status_t CameraClient::initialize(camera_module_t *module) {
(void *)mCameraId);
// 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
#ifndef OMAP_ICS_CAMERA
| CAMERA_MSG_FOCUS_MOVE
#endif
@@ -248,9 +250,14 @@ void CameraClient::disconnect() {
// Release the held ANativeWindow resources.
if (mPreviewWindow != 0) {
+#ifdef QCOM_HARDWARE
+ mHardware->setPreviewWindow(0);
+#endif
disconnectWindow(mPreviewWindow);
mPreviewWindow = 0;
+#ifndef QCOM_HARDWARE
mHardware->setPreviewWindow(mPreviewWindow);
+#endif
}
mHardware.clear();
@@ -289,6 +296,10 @@ status_t CameraClient::setPreviewWindow(const sp<IBinder>& binder,
native_window_set_buffers_transform(window.get(), mOrientation);
result = mHardware->setPreviewWindow(window);
}
+#ifdef QCOM_HARDWARE
+ } else {
+ result = mHardware->setPreviewWindow(window);
+#endif
}
if (result == NO_ERROR) {
@@ -348,6 +359,9 @@ void CameraClient::setPreviewCallbackFlag(int callback_flag) {
// start preview mode
status_t CameraClient::startPreview() {
LOG1("startPreview (pid %d)", getCallingPid());
+#ifdef QCOM_HARDWARE
+ enableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#endif
return startCameraMode(CAMERA_PREVIEW_MODE);
}
@@ -438,6 +452,9 @@ status_t CameraClient::startRecordingMode() {
// stop preview mode
void CameraClient::stopPreview() {
LOG1("stopPreview (pid %d)", getCallingPid());
+#ifdef QCOM_HARDWARE
+ disableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#endif
Mutex::Autolock lock(mLock);
if (checkPidAndHardware() != NO_ERROR) return;
@@ -555,6 +572,9 @@ status_t CameraClient::takePicture(int msgType) {
picMsgType |= CAMERA_MSG_COMPRESSED_BURST_IMAGE;
#endif
+#ifdef QCOM_HARDWARE
+ disableMsgType(CAMERA_MSG_PREVIEW_METADATA);
+#endif
enableMsgType(picMsgType);
return mHardware->takePicture();
diff --git a/services/camera/libcameraservice/CameraHardwareInterface.h b/services/camera/libcameraservice/CameraHardwareInterface.h
index 9f529a0..d67996e 100644
--- a/services/camera/libcameraservice/CameraHardwareInterface.h
+++ b/services/camera/libcameraservice/CameraHardwareInterface.h
@@ -113,6 +113,12 @@ public:
ALOGV("%s(%s) buf %p", __FUNCTION__, mName.string(), buf.get());
if (mDevice->ops->set_preview_window) {
+#ifdef QCOM_HARDWARE
+ ALOGV("%s buf %p mPreviewWindow %p", __FUNCTION__, buf.get(), mPreviewWindow.get());
+ if (mPreviewWindow.get() && (buf.get() != mPreviewWindow.get())) {
+ mDevice->ops->set_preview_window(mDevice, 0);
+ }
+#endif
mPreviewWindow = buf;
mHalPreviewWindow.user = this;
ALOGV("%s &mHalPreviewWindow %p mHalPreviewWindow.user %p", __FUNCTION__,
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 124d24d..d8365eb 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -37,6 +37,7 @@
#include <utils/Log.h>
#include <utils/String16.h>
+#include <system/camera.h>
#include "CameraService.h"
#include "CameraClient.h"
#include "Camera2Client.h"
@@ -358,8 +359,18 @@ void CameraService::loadSound() {
LOG1("CameraService::loadSound ref=%d", mSoundRef);
if (mSoundRef++) return;
- mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/system/media/audio/ui/camera_click.ogg");
- mSoundPlayer[SOUND_RECORDING] = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
+ char value[PROPERTY_VALUE_MAX];
+ property_get("persist.camera.shutter.disable", value, "0");
+ int disableSound = atoi(value);
+
+ if(!disableSound) {
+ mSoundPlayer[SOUND_SHUTTER] = newMediaPlayer("/system/media/audio/ui/camera_click.ogg");
+ mSoundPlayer[SOUND_RECORDING] = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
+ }
+ else {
+ mSoundPlayer[SOUND_SHUTTER] = NULL;
+ mSoundPlayer[SOUND_RECORDING] = NULL;
+ }
}
void CameraService::releaseSound() {