我正在开发相机应用程序。有时我试图在前台应用程序重新安装应用程序。在安装过程中,应用程序将被终止,并且不会调用onPause()
,我将停止预览并释放相机资源。在正常情况下,系统会自动关闭并释放相机,并且我得到以下日志。重新安装应用程序后有时不会发布相机
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
但是,有时这些日志信息没有打印出来。我想这意味着相机没有被释放。因此,当应用程序重新启动时,尝试打开相机时会引发运行时异常“failed to connect to camera service
”。
有没有人有任何想法,为什么系统没有释放相机杀死它。
我已经添加了第一行,但没有添加第二行和第三行。据我所知,元素被Google Play等市场用作过滤器。 –
2012-03-14 09:00:42