Camera doesn't be released sometimes after application re-installed
I'm developing a camera application. Sometimes I tried to re-install the app when it is in foreground. In the installation process, the application will be killed, and the the `onPause()` won't be invoked, in which I stop the preview and release the camera resource. Under normal circumstances, the system will automatically close and release the camera, and I got the following log.

<!-- language: lang-java -->

    03-14 15:48:36.316: E/CameraHardwareSec(83): Could not dequeue gralloc buffer!
    03-14 15:48:36.316: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): calling mSecCamera->stopPreview() and waiting
    03-14 15:48:36.363: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): return from wait
    03-14 15:48:36.363: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): exiting
    03-14 15:48:36.363: W/SecCamera(83): int android::SecCamera::stopPreview(): doing nothing because m_flag_camera_start is zero
    03-14 15:48:36.363: W/SecCamera(83): int android::SecCamera::stopRecord(): doing nothing because m_flag_record_start is zero
    03-14 15:48:36.363: I/SecCamera(83): DeinitCamera: m_cam_fd(29)
    03-14 15:48:36.371: I/SecCamera(83): DeinitCamera: m_cam_fd2(30)
    03-14 15:48:36.386: E/CameraHardwareSec(83): preview window is NULL!
    03-14 15:48:36.386: I/CameraService(83): Destroying camera 0
    03-14 15:48:36.386: I/CameraHardwareSec(83): int android::HAL_camera_device_close(hw_device_t*)
    03-14 15:48:36.386: I/SecCamera(83): DeinitCamera : already deinitialized
    03-14 15:48:36.390: W/AudioFlinger(83): session id 89 not found for pid 83
    03-14 15:48:36.394: W/AudioFlinger(83): session id 90 not found for pid 83

However sometimes these log information didn't print out. And I guess it means the camera was not released. So when the app restarted, it throws a runtime exception "`failed to connect to camera service`" when trying open the camera.

Does anyone have any idea about why the system didn't release the camera when killed it.
Camera doesn't be released sometimes after application re-installed
===

I'm developing a camera application. Sometimes I tried to re-install the app when it is in foreground. In the installation process, the application will be killed, and the the `onPause()` won't be invoked, in which I stop the preview and release the camera resource. Under normal circumstances, the system will automatically close and release the camera, and I got the following log.

<!-- language: lang-java -->

    03-14 15:48:36.316: E/CameraHardwareSec(83): Could not dequeue gralloc buffer!
    03-14 15:48:36.316: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): calling mSecCamera->stopPreview() and waiting
    03-14 15:48:36.363: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): return from wait
    03-14 15:48:36.363: I/CameraHardwareSec(83): int android::CameraHardwareSec::previewThreadWrapper(): exiting
    03-14 15:48:36.363: W/SecCamera(83): int android::SecCamera::stopPreview(): doing nothing because m_flag_camera_start is zero
    03-14 15:48:36.363: W/SecCamera(83): int android::SecCamera::stopRecord(): doing nothing because m_flag_record_start is zero
    03-14 15:48:36.363: I/SecCamera(83): DeinitCamera: m_cam_fd(29)
    03-14 15:48:36.371: I/SecCamera(83): DeinitCamera: m_cam_fd2(30)
    03-14 15:48:36.386: E/CameraHardwareSec(83): preview window is NULL!
    03-14 15:48:36.386: I/CameraService(83): Destroying camera 0
    03-14 15:48:36.386: I/CameraHardwareSec(83): int android::HAL_camera_device_close(hw_device_t*)
    03-14 15:48:36.386: I/SecCamera(83): DeinitCamera : already deinitialized
    03-14 15:48:36.390: W/AudioFlinger(83): session id 89 not found for pid 83
    03-14 15:48:36.394: W/AudioFlinger(83): session id 90 not found for pid 83

However sometimes these log information didn't print out. And I guess it means the camera was not released. So when the app restarted, it throws a runtime exception "`failed to connect to camera service`" when trying open the camera.

Does anyone have any idea about why the system didn't release the camera when killed it.