Loading camera/libcameraservice/CameraService.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -915,24 +915,24 @@ String8 CameraService::Client::getParameters() const void CameraService::Client::postAutoFocus(bool focused) { LOGV("postAutoFocus"); mCameraClient->autoFocusCallback(focused); mCameraClient->notifyCallback(CAMERA_MSG_FOCUS, (int32_t)focused, 0); } void CameraService::Client::postShutter() { mCameraClient->shutterCallback(); mCameraClient->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0); } void CameraService::Client::postRaw(const sp<IMemory>& mem) { LOGD("postRaw"); mCameraClient->rawCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_RAW_IMAGE, mem); } void CameraService::Client::postJpeg(const sp<IMemory>& mem) { LOGD("postJpeg"); mCameraClient->jpegCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mem); } void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size) Loading Loading @@ -960,7 +960,7 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, si LOGE("failed to allocate space for frame callback"); return; } mCameraClient->previewCallback(frame); mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame) Loading @@ -970,7 +970,7 @@ void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame) LOGW("frame is a null pointer"); return; } mCameraClient->recordingCallback(frame); mCameraClient->dataCallback(CAMERA_MSG_VIDEO_FRAME, frame); } void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) Loading Loading @@ -1004,7 +1004,7 @@ void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) copyFrameAndPostCopiedFrame(heap, offset, size); } else { LOGV("frame is directly sent out without copying"); mCameraClient->previewCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, mem); } // Is this is one-shot only? Loading @@ -1018,7 +1018,7 @@ void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) void CameraService::Client::postError(status_t error) { mCameraClient->errorCallback(error); mCameraClient->notifyCallback(CAMERA_MSG_ERROR, error, 0); } status_t CameraService::dump(int fd, const Vector<String16>& args) Loading include/ui/Camera.h +18 −8 Original line number Diff line number Diff line Loading @@ -63,6 +63,23 @@ namespace android { #define FRAME_CALLBACK_FLAG_CAMERA 0x05 #define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07 // msgType in notifyCallback function enum { CAMERA_MSG_ERROR, CAMERA_MSG_SHUTTER, CAMERA_MSG_FOCUS, CAMERA_MSG_ZOOM }; // msgType in dataCallback function enum { CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME, CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, CAMERA_MSG_COMPRESSED_IMAGE }; class ICameraService; class ICamera; class Surface; Loading Loading @@ -136,15 +153,8 @@ public: void setAutoFocusCallback(autofocus_callback cb, void *cookie); // ICameraClient interface virtual void shutterCallback(); virtual void rawCallback(const sp<IMemory>& picture); virtual void jpegCallback(const sp<IMemory>& picture); virtual void previewCallback(const sp<IMemory>& frame); virtual void errorCallback(status_t error); virtual void autoFocusCallback(bool focused); virtual void recordingCallback(const sp<IMemory>& frame); virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2); virtual void dataCallback(int32_t msgType, const sp<IMemory>& frame); virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr); sp<ICamera> remote(); Loading include/ui/ICameraClient.h +0 −24 Original line number Diff line number Diff line Loading @@ -29,30 +29,6 @@ class ICameraClient: public IInterface public: DECLARE_META_INTERFACE(CameraClient); // msgType in notifyCallback function enum { ERROR, SHUTTER, FOCUSED, ZOOM } notify_callback_message_type; // msgType in dataCallback function enum { PREVIEW, RECORD, POSTVIEW, RAW, COMPRESSED } data_callback_message_type; virtual void shutterCallback() = 0; virtual void rawCallback(const sp<IMemory>& picture) = 0; virtual void jpegCallback(const sp<IMemory>& picture) = 0; virtual void previewCallback(const sp<IMemory>& frame) = 0; virtual void errorCallback(status_t error) = 0; virtual void autoFocusCallback(bool focused) = 0; virtual void recordingCallback(const sp<IMemory>& frame) = 0; virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0; virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0; Loading include/utils/backup_helpers.h +1 −1 Original line number Diff line number Diff line #ifndef _UTILS_BACKUP_HELPERS_H #define _UTILS_BACKUP_HELPERS_H int back_up_files(int oldSnapshotFD, int newSnapshotFD, int oldDataStream, int back_up_files(int oldSnapshotFD, int oldDataStream, int newSnapshotFD, char const* fileBase, char const* const* files, int fileCount); #define TEST_BACKUP_HELPERS 0 Loading libs/ui/Camera.cpp +54 −64 Original line number Diff line number Diff line Loading @@ -337,76 +337,66 @@ void Camera::setErrorCallback(error_callback cb, void *cookie) mErrorCallbackCookie = cookie; } void Camera::autoFocusCallback(bool focused) // callback from camera service void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) { switch(msgType) { case CAMERA_MSG_ERROR: LOGV("errorCallback"); if (mErrorCallback) { mErrorCallback((status_t)ext1, mErrorCallbackCookie); } break; case CAMERA_MSG_FOCUS: LOGV("autoFocusCallback"); if (mAutoFocusCallback) { mAutoFocusCallback(focused, mAutoFocusCallbackCookie); mAutoFocusCallback((bool)ext1, mAutoFocusCallbackCookie); } } void Camera::shutterCallback() { break; case CAMERA_MSG_SHUTTER: LOGV("shutterCallback"); if (mShutterCallback) { mShutterCallback(mShutterCallbackCookie); } } void Camera::rawCallback(const sp<IMemory>& picture) { LOGV("rawCallback"); if (mRawCallback) { mRawCallback(picture, mRawCallbackCookie); } } // callback from camera service when image is ready void Camera::jpegCallback(const sp<IMemory>& picture) { LOGV("jpegCallback"); if (mJpegCallback) { mJpegCallback(picture, mJpegCallbackCookie); break; default: LOGV("notifyCallback(%d, %d, %d)", msgType, ext1, ext2); break; } } // callback from camera service when preview frame is ready void Camera::previewCallback(const sp<IMemory>& frame) // callback from camera service when frame or image is ready void Camera::dataCallback(int32_t msgType, const sp<IMemory>& dataPtr) { LOGV("frameCallback"); switch(msgType) { case CAMERA_MSG_PREVIEW_FRAME: LOGV("previewCallback"); if (mPreviewCallback) { mPreviewCallback(frame, mPreviewCallbackCookie); mPreviewCallback(dataPtr, mPreviewCallbackCookie); } } // callback from camera service when a recording frame is ready void Camera::recordingCallback(const sp<IMemory>& frame) { break; case CAMERA_MSG_VIDEO_FRAME: LOGV("recordingCallback"); if (mRecordingCallback) { mRecordingCallback(frame, mRecordingCallbackCookie); } mRecordingCallback(dataPtr, mRecordingCallbackCookie); } // callback from camera service when an error occurs in preview or takePicture void Camera::errorCallback(status_t error) { LOGV("errorCallback"); if (mErrorCallback) { mErrorCallback(error, mErrorCallbackCookie); break; case CAMERA_MSG_RAW_IMAGE: LOGV("rawCallback"); if (mRawCallback) { mRawCallback(dataPtr, mRawCallbackCookie); } break; case CAMERA_MSG_COMPRESSED_IMAGE: LOGV("jpegCallback"); if (mJpegCallback) { mJpegCallback(dataPtr, mJpegCallbackCookie); } // callback from camera service void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) { LOGV("notifyCallback"); break; default: LOGV("dataCallback(%d, %p)", msgType, dataPtr.get()); break; } // callback from camera service when image is ready void Camera::dataCallback(int32_t msgType, const sp<IMemory>& frame) { LOGV("dataCallback"); } void Camera::binderDied(const wp<IBinder>& who) { Loading Loading
camera/libcameraservice/CameraService.cpp +8 −8 Original line number Diff line number Diff line Loading @@ -915,24 +915,24 @@ String8 CameraService::Client::getParameters() const void CameraService::Client::postAutoFocus(bool focused) { LOGV("postAutoFocus"); mCameraClient->autoFocusCallback(focused); mCameraClient->notifyCallback(CAMERA_MSG_FOCUS, (int32_t)focused, 0); } void CameraService::Client::postShutter() { mCameraClient->shutterCallback(); mCameraClient->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0); } void CameraService::Client::postRaw(const sp<IMemory>& mem) { LOGD("postRaw"); mCameraClient->rawCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_RAW_IMAGE, mem); } void CameraService::Client::postJpeg(const sp<IMemory>& mem) { LOGD("postJpeg"); mCameraClient->jpegCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_COMPRESSED_IMAGE, mem); } void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size) Loading Loading @@ -960,7 +960,7 @@ void CameraService::Client::copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, si LOGE("failed to allocate space for frame callback"); return; } mCameraClient->previewCallback(frame); mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, frame); } void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame) Loading @@ -970,7 +970,7 @@ void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame) LOGW("frame is a null pointer"); return; } mCameraClient->recordingCallback(frame); mCameraClient->dataCallback(CAMERA_MSG_VIDEO_FRAME, frame); } void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) Loading Loading @@ -1004,7 +1004,7 @@ void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) copyFrameAndPostCopiedFrame(heap, offset, size); } else { LOGV("frame is directly sent out without copying"); mCameraClient->previewCallback(mem); mCameraClient->dataCallback(CAMERA_MSG_PREVIEW_FRAME, mem); } // Is this is one-shot only? Loading @@ -1018,7 +1018,7 @@ void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem) void CameraService::Client::postError(status_t error) { mCameraClient->errorCallback(error); mCameraClient->notifyCallback(CAMERA_MSG_ERROR, error, 0); } status_t CameraService::dump(int fd, const Vector<String16>& args) Loading
include/ui/Camera.h +18 −8 Original line number Diff line number Diff line Loading @@ -63,6 +63,23 @@ namespace android { #define FRAME_CALLBACK_FLAG_CAMERA 0x05 #define FRAME_CALLBACK_FLAG_BARCODE_SCANNER 0x07 // msgType in notifyCallback function enum { CAMERA_MSG_ERROR, CAMERA_MSG_SHUTTER, CAMERA_MSG_FOCUS, CAMERA_MSG_ZOOM }; // msgType in dataCallback function enum { CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_VIDEO_FRAME, CAMERA_MSG_POSTVIEW_FRAME, CAMERA_MSG_RAW_IMAGE, CAMERA_MSG_COMPRESSED_IMAGE }; class ICameraService; class ICamera; class Surface; Loading Loading @@ -136,15 +153,8 @@ public: void setAutoFocusCallback(autofocus_callback cb, void *cookie); // ICameraClient interface virtual void shutterCallback(); virtual void rawCallback(const sp<IMemory>& picture); virtual void jpegCallback(const sp<IMemory>& picture); virtual void previewCallback(const sp<IMemory>& frame); virtual void errorCallback(status_t error); virtual void autoFocusCallback(bool focused); virtual void recordingCallback(const sp<IMemory>& frame); virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2); virtual void dataCallback(int32_t msgType, const sp<IMemory>& frame); virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr); sp<ICamera> remote(); Loading
include/ui/ICameraClient.h +0 −24 Original line number Diff line number Diff line Loading @@ -29,30 +29,6 @@ class ICameraClient: public IInterface public: DECLARE_META_INTERFACE(CameraClient); // msgType in notifyCallback function enum { ERROR, SHUTTER, FOCUSED, ZOOM } notify_callback_message_type; // msgType in dataCallback function enum { PREVIEW, RECORD, POSTVIEW, RAW, COMPRESSED } data_callback_message_type; virtual void shutterCallback() = 0; virtual void rawCallback(const sp<IMemory>& picture) = 0; virtual void jpegCallback(const sp<IMemory>& picture) = 0; virtual void previewCallback(const sp<IMemory>& frame) = 0; virtual void errorCallback(status_t error) = 0; virtual void autoFocusCallback(bool focused) = 0; virtual void recordingCallback(const sp<IMemory>& frame) = 0; virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) = 0; virtual void dataCallback(int32_t msgType, const sp<IMemory>& data) = 0; Loading
include/utils/backup_helpers.h +1 −1 Original line number Diff line number Diff line #ifndef _UTILS_BACKUP_HELPERS_H #define _UTILS_BACKUP_HELPERS_H int back_up_files(int oldSnapshotFD, int newSnapshotFD, int oldDataStream, int back_up_files(int oldSnapshotFD, int oldDataStream, int newSnapshotFD, char const* fileBase, char const* const* files, int fileCount); #define TEST_BACKUP_HELPERS 0 Loading
libs/ui/Camera.cpp +54 −64 Original line number Diff line number Diff line Loading @@ -337,76 +337,66 @@ void Camera::setErrorCallback(error_callback cb, void *cookie) mErrorCallbackCookie = cookie; } void Camera::autoFocusCallback(bool focused) // callback from camera service void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) { switch(msgType) { case CAMERA_MSG_ERROR: LOGV("errorCallback"); if (mErrorCallback) { mErrorCallback((status_t)ext1, mErrorCallbackCookie); } break; case CAMERA_MSG_FOCUS: LOGV("autoFocusCallback"); if (mAutoFocusCallback) { mAutoFocusCallback(focused, mAutoFocusCallbackCookie); mAutoFocusCallback((bool)ext1, mAutoFocusCallbackCookie); } } void Camera::shutterCallback() { break; case CAMERA_MSG_SHUTTER: LOGV("shutterCallback"); if (mShutterCallback) { mShutterCallback(mShutterCallbackCookie); } } void Camera::rawCallback(const sp<IMemory>& picture) { LOGV("rawCallback"); if (mRawCallback) { mRawCallback(picture, mRawCallbackCookie); } } // callback from camera service when image is ready void Camera::jpegCallback(const sp<IMemory>& picture) { LOGV("jpegCallback"); if (mJpegCallback) { mJpegCallback(picture, mJpegCallbackCookie); break; default: LOGV("notifyCallback(%d, %d, %d)", msgType, ext1, ext2); break; } } // callback from camera service when preview frame is ready void Camera::previewCallback(const sp<IMemory>& frame) // callback from camera service when frame or image is ready void Camera::dataCallback(int32_t msgType, const sp<IMemory>& dataPtr) { LOGV("frameCallback"); switch(msgType) { case CAMERA_MSG_PREVIEW_FRAME: LOGV("previewCallback"); if (mPreviewCallback) { mPreviewCallback(frame, mPreviewCallbackCookie); mPreviewCallback(dataPtr, mPreviewCallbackCookie); } } // callback from camera service when a recording frame is ready void Camera::recordingCallback(const sp<IMemory>& frame) { break; case CAMERA_MSG_VIDEO_FRAME: LOGV("recordingCallback"); if (mRecordingCallback) { mRecordingCallback(frame, mRecordingCallbackCookie); } mRecordingCallback(dataPtr, mRecordingCallbackCookie); } // callback from camera service when an error occurs in preview or takePicture void Camera::errorCallback(status_t error) { LOGV("errorCallback"); if (mErrorCallback) { mErrorCallback(error, mErrorCallbackCookie); break; case CAMERA_MSG_RAW_IMAGE: LOGV("rawCallback"); if (mRawCallback) { mRawCallback(dataPtr, mRawCallbackCookie); } break; case CAMERA_MSG_COMPRESSED_IMAGE: LOGV("jpegCallback"); if (mJpegCallback) { mJpegCallback(dataPtr, mJpegCallbackCookie); } // callback from camera service void Camera::notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2) { LOGV("notifyCallback"); break; default: LOGV("dataCallback(%d, %p)", msgType, dataPtr.get()); break; } // callback from camera service when image is ready void Camera::dataCallback(int32_t msgType, const sp<IMemory>& frame) { LOGV("dataCallback"); } void Camera::binderDied(const wp<IBinder>& who) { Loading