diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-07-20 05:35:02 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-07-20 05:35:02 +0800 |
commit | 13528f78f961426680b42986772159e34ba82ad8 (patch) | |
tree | 7634ce4dee2632d5c93890f69544919844caabb2 /services/camera | |
parent | 2e29de7cab35e4cf7c8f177b546cc95b101ed5c8 (diff) | |
download | frameworks_base-13528f78f961426680b42986772159e34ba82ad8.zip frameworks_base-13528f78f961426680b42986772159e34ba82ad8.tar.gz frameworks_base-13528f78f961426680b42986772159e34ba82ad8.tar.bz2 |
Disconnect the native window in CameraService::Client::disconnect.
bug:5048372
Change-Id: I6886907a672ddf5580b988ca5bc13e3dc26d4385
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index 0eff776..07002ac 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -458,6 +458,17 @@ status_t CameraService::Client::connect(const sp<ICameraClient>& client) { return NO_ERROR; } +static void disconnectWindow(const sp<ANativeWindow>& window) { + if (window != 0) { + status_t result = native_window_disconnect(window.get(), + NATIVE_WINDOW_API_CAMERA); + if (result != NO_ERROR) { + LOGW("native_window_disconnect failed: %s (%d)", strerror(-result), + result); + } + } +} + void CameraService::Client::disconnect() { int callingPid = getCallingPid(); LOG1("disconnect E (pid %d)", callingPid); @@ -489,6 +500,7 @@ void CameraService::Client::disconnect() { // Release the held ANativeWindow resources. if (mPreviewWindow != 0) { + disconnectWindow(mPreviewWindow); mPreviewWindow = 0; mHardware->setPreviewWindow(mPreviewWindow); } @@ -502,17 +514,6 @@ void CameraService::Client::disconnect() { // ---------------------------------------------------------------------------- -static void disconnectWindow(const sp<ANativeWindow>& window) { - if (window != 0) { - status_t result = native_window_disconnect(window.get(), - NATIVE_WINDOW_API_CAMERA); - if (result != NO_ERROR) { - LOGW("native_window_disconnect failed: %s (%d)", strerror(-result), - result); - } - } -} - status_t CameraService::Client::setPreviewWindow(const sp<IBinder>& binder, const sp<ANativeWindow>& window) { Mutex::Autolock lock(mLock); |