From b2ae06294ad21d74df93ad0f5ca3e2f355f77436 Mon Sep 17 00:00:00 2001 From: Tyler Luu Date: Wed, 9 Nov 2011 17:20:31 -0600 Subject: 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 --- camera/ANativeWindowDisplayAdapter.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'camera/ANativeWindowDisplayAdapter.cpp') 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(); -- cgit v1.1