Loading services/camera/libcameraservice/CameraService.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -320,6 +320,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; mOrientation = 0; mPreviewWindowFlag = 0; mOrientationChanged = false; mPlayShutterSound = true; cameraService->setCameraBusy(cameraId); Loading Loading @@ -508,6 +509,8 @@ status_t CameraService::Client::setPreviewDisplay(const sp<Surface>& surface) { if (mUseOverlay) { result = setOverlay(); } else if (mPreviewWindow != 0) { native_window_set_buffers_transform(mPreviewWindow.get(), mPreviewWindowFlag); result = mHardware->setPreviewWindow(mPreviewWindow); } } Loading Loading @@ -633,7 +636,10 @@ status_t CameraService::Client::startPreviewMode() { if (result != NO_ERROR) return result; result = mHardware->startPreview(); } else { // XXX: Set the orientation of the ANativeWindow. if (mPreviewWindow != 0) { native_window_set_buffers_transform(mPreviewWindow.get(), mPreviewWindowFlag); } mHardware->setPreviewWindow(mPreviewWindow); result = mHardware->startPreview(); } Loading Loading @@ -818,15 +824,19 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a switch (arg1) { case 0: orientation = ISurface::BufferHeap::ROT_0; mPreviewWindowFlag = 0; break; case 90: orientation = ISurface::BufferHeap::ROT_90; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_90; break; case 180: orientation = ISurface::BufferHeap::ROT_180; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_180; break; case 270: orientation = ISurface::BufferHeap::ROT_270; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_270; break; default: return BAD_VALUE; Loading services/camera/libcameraservice/CameraService.h +2 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ private: sp<CameraService> mCameraService; // immutable after constructor sp<ICameraClient> mCameraClient; int mCameraId; // immutable after constructor int mCameraFacing; // immutable after constructor pid_t mClientPid; sp<CameraHardwareInterface> mHardware; // cleared after disconnect() bool mUseOverlay; // immutable after constructor Loading @@ -176,6 +177,7 @@ private: int mOrientation; // Current display orientation // True if display orientation has been changed. This is only used in overlay. int mOrientationChanged; int mPreviewWindowFlag; bool mPlayShutterSound; // Ensures atomicity among the public methods Loading Loading
services/camera/libcameraservice/CameraService.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -320,6 +320,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; mOrientation = 0; mPreviewWindowFlag = 0; mOrientationChanged = false; mPlayShutterSound = true; cameraService->setCameraBusy(cameraId); Loading Loading @@ -508,6 +509,8 @@ status_t CameraService::Client::setPreviewDisplay(const sp<Surface>& surface) { if (mUseOverlay) { result = setOverlay(); } else if (mPreviewWindow != 0) { native_window_set_buffers_transform(mPreviewWindow.get(), mPreviewWindowFlag); result = mHardware->setPreviewWindow(mPreviewWindow); } } Loading Loading @@ -633,7 +636,10 @@ status_t CameraService::Client::startPreviewMode() { if (result != NO_ERROR) return result; result = mHardware->startPreview(); } else { // XXX: Set the orientation of the ANativeWindow. if (mPreviewWindow != 0) { native_window_set_buffers_transform(mPreviewWindow.get(), mPreviewWindowFlag); } mHardware->setPreviewWindow(mPreviewWindow); result = mHardware->startPreview(); } Loading Loading @@ -818,15 +824,19 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a switch (arg1) { case 0: orientation = ISurface::BufferHeap::ROT_0; mPreviewWindowFlag = 0; break; case 90: orientation = ISurface::BufferHeap::ROT_90; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_90; break; case 180: orientation = ISurface::BufferHeap::ROT_180; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_180; break; case 270: orientation = ISurface::BufferHeap::ROT_270; mPreviewWindowFlag = NATIVE_WINDOW_TRANSFORM_ROT_270; break; default: return BAD_VALUE; Loading
services/camera/libcameraservice/CameraService.h +2 −0 Original line number Diff line number Diff line Loading @@ -166,6 +166,7 @@ private: sp<CameraService> mCameraService; // immutable after constructor sp<ICameraClient> mCameraClient; int mCameraId; // immutable after constructor int mCameraFacing; // immutable after constructor pid_t mClientPid; sp<CameraHardwareInterface> mHardware; // cleared after disconnect() bool mUseOverlay; // immutable after constructor Loading @@ -176,6 +177,7 @@ private: int mOrientation; // Current display orientation // True if display orientation has been changed. This is only used in overlay. int mOrientationChanged; int mPreviewWindowFlag; bool mPlayShutterSound; // Ensures atomicity among the public methods Loading