阅读背景:

如果在服务中使用Android相机锁定/崩溃,屏幕关闭

来源:互联网 

If I try to use a camera in a service with the screen off, the camera eventually becomes locked and unusable, the phone will reboot, or the camera driver will segfault (mm-camera). The only way to recover from the camera locking or mm-camera segfaulting is to reboot the device. It seems that the camera is tied directly to the screen in such a way if the screen is not on the camera doesn't work properly. If the phone is plugged into my computer and Android Debugging is running, then the camera does not experience the same issue. I have taken several variations of code and even tried using OpenCV’s VideoCapture class which doesn't need a Surface and bypasses android.hardware.Camera completely, but the results are the same: if I run it with the screen on it works fine, if I run it with the screen off the camera will lock. Is this a bug with the camera code or was this purposely put in? Has anyone had an success with using the camera with the screen off?If I try to use a camera in a service with the




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: