Merge "The old overlay should be destroyed if orientation changes." into gingerbread
This commit is contained in:
@@ -319,6 +319,7 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
|
|||||||
// Callback is disabled by default
|
// Callback is disabled by default
|
||||||
mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
|
mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
|
||||||
mOrientation = 0;
|
mOrientation = 0;
|
||||||
|
mOrientationChanged = false;
|
||||||
cameraService->setCameraBusy(cameraId);
|
cameraService->setCameraBusy(cameraId);
|
||||||
cameraService->loadSound();
|
cameraService->loadSound();
|
||||||
LOG1("Client::Client X (pid %d)", callingPid);
|
LOG1("Client::Client X (pid %d)", callingPid);
|
||||||
@@ -496,6 +497,7 @@ status_t CameraService::Client::setPreviewDisplay(const sp<ISurface>& surface) {
|
|||||||
// Force the destruction of any previous overlay
|
// Force the destruction of any previous overlay
|
||||||
sp<Overlay> dummy;
|
sp<Overlay> dummy;
|
||||||
mHardware->setOverlay(dummy);
|
mHardware->setOverlay(dummy);
|
||||||
|
mOverlayRef = 0;
|
||||||
} else {
|
} else {
|
||||||
mSurface->unregisterBuffers();
|
mSurface->unregisterBuffers();
|
||||||
}
|
}
|
||||||
@@ -539,11 +541,12 @@ status_t CameraService::Client::setOverlay() {
|
|||||||
CameraParameters params(mHardware->getParameters());
|
CameraParameters params(mHardware->getParameters());
|
||||||
params.getPreviewSize(&w, &h);
|
params.getPreviewSize(&w, &h);
|
||||||
|
|
||||||
if (w != mOverlayW || h != mOverlayH) {
|
if (w != mOverlayW || h != mOverlayH || mOrientationChanged) {
|
||||||
// Force the destruction of any previous overlay
|
// Force the destruction of any previous overlay
|
||||||
sp<Overlay> dummy;
|
sp<Overlay> dummy;
|
||||||
mHardware->setOverlay(dummy);
|
mHardware->setOverlay(dummy);
|
||||||
mOverlayRef = 0;
|
mOverlayRef = 0;
|
||||||
|
mOrientationChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t result = NO_ERROR;
|
status_t result = NO_ERROR;
|
||||||
@@ -810,6 +813,7 @@ String8 CameraService::Client::getParameters() const {
|
|||||||
|
|
||||||
status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
|
status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
|
||||||
LOG1("sendCommand (pid %d)", getCallingPid());
|
LOG1("sendCommand (pid %d)", getCallingPid());
|
||||||
|
int orientation;
|
||||||
Mutex::Autolock lock(mLock);
|
Mutex::Autolock lock(mLock);
|
||||||
status_t result = checkPidAndHardware();
|
status_t result = checkPidAndHardware();
|
||||||
if (result != NO_ERROR) return result;
|
if (result != NO_ERROR) return result;
|
||||||
@@ -821,20 +825,24 @@ status_t CameraService::Client::sendCommand(int32_t cmd, int32_t arg1, int32_t a
|
|||||||
}
|
}
|
||||||
switch (arg1) {
|
switch (arg1) {
|
||||||
case 0:
|
case 0:
|
||||||
mOrientation = ISurface::BufferHeap::ROT_0;
|
orientation = ISurface::BufferHeap::ROT_0;
|
||||||
break;
|
break;
|
||||||
case 90:
|
case 90:
|
||||||
mOrientation = ISurface::BufferHeap::ROT_90;
|
orientation = ISurface::BufferHeap::ROT_90;
|
||||||
break;
|
break;
|
||||||
case 180:
|
case 180:
|
||||||
mOrientation = ISurface::BufferHeap::ROT_180;
|
orientation = ISurface::BufferHeap::ROT_180;
|
||||||
break;
|
break;
|
||||||
case 270:
|
case 270:
|
||||||
mOrientation = ISurface::BufferHeap::ROT_270;
|
orientation = ISurface::BufferHeap::ROT_270;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
if (mOrientation != orientation) {
|
||||||
|
mOrientation = orientation;
|
||||||
|
if (mOverlayRef != 0) mOrientationChanged = true;
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,7 +164,9 @@ private:
|
|||||||
int mOverlayW;
|
int mOverlayW;
|
||||||
int mOverlayH;
|
int mOverlayH;
|
||||||
int mPreviewCallbackFlag;
|
int mPreviewCallbackFlag;
|
||||||
int mOrientation;
|
int mOrientation; // Current display orientation
|
||||||
|
// True if display orientation has been changed. This is only used in overlay.
|
||||||
|
int mOrientationChanged;
|
||||||
|
|
||||||
// Ensures atomicity among the public methods
|
// Ensures atomicity among the public methods
|
||||||
mutable Mutex mLock;
|
mutable Mutex mLock;
|
||||||
|
|||||||
Reference in New Issue
Block a user