summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorTyler Luu <tluu@ti.com>2011-11-09 17:20:31 -0600
committerIliyan Malchev <malchev@google.com>2011-12-05 10:40:20 -0800
commit39371f31292f050f7fd75f7d36c7c9eeffd4ae64 (patch)
tree40044c2daaddce0304b886ce4af6a587882e8ca6 /camera
parent0c7ae887ee41852f275887fd543fae810668e2d1 (diff)
downloadhardware_ti_omap4xxx-39371f31292f050f7fd75f7d36c7c9eeffd4ae64.zip
hardware_ti_omap4xxx-39371f31292f050f7fd75f7d36c7c9eeffd4ae64.tar.gz
hardware_ti_omap4xxx-39371f31292f050f7fd75f7d36c7c9eeffd4ae64.tar.bz2
CameraHal: Fix preview not starting after surface is abdandoned
If an application gets backgrounded (HOME key) without stopping preview and releasing camera, preview would previously not restart when application is resumed. ANativeWindowDisplayAdapter would detect that the preview surface was abandoned and stop sending buffers to CameraAdapter. We were previously not doing anything when CameraService called setPreviewWindow when a display adapter was already created. To fix this issue, we need to send the preview window and restart preview. Change-Id: I36089b0046f9861897d32c50b52128a41e2de2a5 Signed-off-by: Tyler Luu <tluu@ti.com>
Diffstat (limited to 'camera')
-rw-r--r--camera/ANativeWindowDisplayAdapter.cpp4
-rw-r--r--camera/CameraHal.cpp15
2 files changed, 13 insertions, 6 deletions
diff --git a/camera/ANativeWindowDisplayAdapter.cpp b/camera/ANativeWindowDisplayAdapter.cpp
index a7b2e86..e6a4c87 100644
--- a/camera/ANativeWindowDisplayAdapter.cpp
+++ b/camera/ANativeWindowDisplayAdapter.cpp
@@ -269,6 +269,10 @@ int ANativeWindowDisplayAdapter::setPreviewWindow(preview_stream_ops_t* window)
return BAD_VALUE;
}
+ if ( window == mANativeWindow ) {
+ return ALREADY_EXISTS;
+ }
+
///Destroy the existing window object, if it exists
destroy();
diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp
index c7ba87f..c64b7e2 100644
--- a/camera/CameraHal.cpp
+++ b/camera/CameraHal.cpp
@@ -1713,12 +1713,15 @@ status_t CameraHal::setPreviewWindow(struct preview_stream_ops *window)
// Start the preview since the window is now available
ret = startPreview();
}
- }else
- {
- /* If mDisplayAdpater is already created. No need to do anything.
- * We get a surface handle directly now, so we can reconfigure surface
- * itself in DisplayAdapter if dimensions have changed
- */
+ } else {
+ // Update the display adapter with the new window that is passed from CameraService
+ ret = mDisplayAdapter->setPreviewWindow(window);
+ if ( (NO_ERROR == ret) && previewEnabled() ) {
+ restartPreview();
+ } else if (ret == ALREADY_EXISTS) {
+ // ALREADY_EXISTS should be treated as a noop in this case
+ ret = NO_ERROR;
+ }
}
LOG_FUNCTION_NAME_EXIT;