Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4b47852b authored by Apurva Rajguru's avatar Apurva Rajguru Committed by Ricardo Cerqueira
Browse files

Camera: Enable QC Camera feature set.

Change-Id: Ie52b6207293abe5a57d3bbe9d9c43e8c5b070af5
parent 69d8d46c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
+22 −2
Original line number Diff line number Diff line
@@ -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();
+6 −0
Original line number Diff line number Diff line
@@ -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__,
+13 −2
Original line number Diff line number Diff line
@@ -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,9 +359,19 @@ void CameraService::loadSound() {
    LOG1("CameraService::loadSound ref=%d", mSoundRef);
    if (mSoundRef++) return;

    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() {
    Mutex::Autolock lock(mSoundLock);