diff options
author | Wu-cheng Li <wuchengli@google.com> | 2011-07-19 14:47:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-19 14:47:20 -0700 |
commit | eb12309583a2e8361392087536474fa4bcd8b60c (patch) | |
tree | a6465025439f5638f8ae15af0b5af9996c3eb4d9 | |
parent | f2cc48fe8bea26bd07cb943b8308a19336536867 (diff) | |
parent | 13528f78f961426680b42986772159e34ba82ad8 (diff) | |
download | frameworks_base-eb12309583a2e8361392087536474fa4bcd8b60c.zip frameworks_base-eb12309583a2e8361392087536474fa4bcd8b60c.tar.gz frameworks_base-eb12309583a2e8361392087536474fa4bcd8b60c.tar.bz2 |
Merge "Disconnect the native window in CameraService::Client::disconnect."
-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 637ccd8..96b26e7 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); |