From 69a5ad0504643b03471e245ce3546e5abfacbecb 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 Fix 3/3 for b/5593964. (I'm bundling this fix with b/5573610 because it is preview-related, though strictly speaking not part of b/b/5573610. It has been with us since the beginning.) 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 Signed-off-by: Iliyan Malchev --- camera/CameraHal.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'camera') diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 7e18330..8e14fec 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -1715,10 +1715,11 @@ status_t CameraHal::setPreviewWindow(struct preview_stream_ops *window) } }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 - */ + // Update the display adapter with the new window that is passed from CameraService + ret = mDisplayAdapter->setPreviewWindow(window); + if (previewEnabled()) { + restartPreview(); + } } LOG_FUNCTION_NAME_EXIT; -- cgit v1.1