diff options
author | Wu-cheng Li <wuchengli@google.com> | 2010-09-27 20:50:22 -0700 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2010-09-27 20:50:22 -0700 |
commit | b36f2df1daf7e733be7c51f93792f8fc4252544c (patch) | |
tree | 67cc64d0fd46312a304aafd24cdd1167d793c919 /services | |
parent | 214a2bdcf6f8f26a0218f2d7a8d822c7b3a71d03 (diff) | |
parent | 2c423a4dc0988e3195c781d56f119514789b604b (diff) | |
download | frameworks_av-b36f2df1daf7e733be7c51f93792f8fc4252544c.zip frameworks_av-b36f2df1daf7e733be7c51f93792f8fc4252544c.tar.gz frameworks_av-b36f2df1daf7e733be7c51f93792f8fc4252544c.tar.bz2 |
resolved conflicts for merge of 191a25e1 to master
Change-Id: I6f4940e337a992bf84e50bc1d22432593937499c
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 18 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 4 |
2 files changed, 16 insertions, 6 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index f943a10..808c679 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -320,6 +320,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP; mOrientation = 0; + mOrientationChanged = false; mPlayShutterSound = true; cameraService->setCameraBusy(cameraId); cameraService->loadSound(); @@ -491,6 +492,7 @@ status_t CameraService::Client::setPreviewDisplay(const sp<Surface>& surface) { // Force the destruction of any previous overlay sp<Overlay> dummy; mHardware->setOverlay(dummy); + mOverlayRef = 0; } } if (surface != 0) { @@ -518,11 +520,12 @@ status_t CameraService::Client::setOverlay() { CameraParameters params(mHardware->getParameters()); params.getPreviewSize(&w, &h); - if (w != mOverlayW || h != mOverlayH) { + if (w != mOverlayW || h != mOverlayH || mOrientationChanged) { // Force the destruction of any previous overlay sp<Overlay> dummy; mHardware->setOverlay(dummy); mOverlayRef = 0; + mOrientationChanged = false; } status_t result = NO_ERROR; @@ -802,6 +805,7 @@ status_t CameraService::Client::enableShutterSound(bool enable) { status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) { LOG1("sendCommand (pid %d)", getCallingPid()); + int orientation; Mutex::Autolock lock(mLock); status_t result = checkPidAndHardware(); if (result != NO_ERROR) return result; @@ -813,20 +817,24 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a } switch (arg1) { case 0: - mOrientation = ISurface::BufferHeap::ROT_0; + orientation = ISurface::BufferHeap::ROT_0; break; case 90: - mOrientation = ISurface::BufferHeap::ROT_90; + orientation = ISurface::BufferHeap::ROT_90; break; case 180: - mOrientation = ISurface::BufferHeap::ROT_180; + orientation = ISurface::BufferHeap::ROT_180; break; case 270: - mOrientation = ISurface::BufferHeap::ROT_270; + orientation = ISurface::BufferHeap::ROT_270; break; default: return BAD_VALUE; } + if (mOrientation != orientation) { + mOrientation = orientation; + if (mOverlayRef != 0) mOrientationChanged = true; + } return OK; } else if (cmd == CAMERA_CMD_ENABLE_SHUTTER_SOUND) { switch (arg1) { diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index 2b5c511..d57364a 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -173,7 +173,9 @@ private: int mOverlayW; int mOverlayH; int mPreviewCallbackFlag; - int mOrientation; + int mOrientation; // Current display orientation + // True if display orientation has been changed. This is only used in overlay. + int mOrientationChanged; bool mPlayShutterSound; // Ensures atomicity among the public methods |