我在我的应用中使用自定义相机。它在大多数设备上都能正常工作,但相机会在一些较新的设备中冻结(注8,OnePlus 5)。在S7和OnePlus3(使用Android O)中正常工作。相机冻结但应用程序在按下捕获按钮之前不会崩溃。
我认为这不是预览尺寸/图片尺寸错误的问题,因为我使用getSupportedPreviewSizes中的一个来生成最佳预览尺寸。这是日志:
<Product>
还有其他人遇到过这个问题吗?或者知道这背后的原因是什么?
以下是代码:
03-06 08:16:52.744 15930-15930/my.example.app D/AppTracker: App Event: stop
03-06 08:16:52.748 15930-15930/my.example.app D/UI: Activity paused:
MainActivity
03-06 08:16:52.761 15930-15930/my.example.app D/UI: Activity created: CustomCameraActivity
03-06 08:16:52.813 15930-15930/my.example.app D/CustomCameraActivity: viewCardPhoto height :530 width :-2
03-06 08:16:52.814 15930-15930/my.example.app D/UI: Activity started: CustomCameraActivity
03-06 08:16:52.817 15930-15930/my.example.app D/UI: Activity resumed: CustomCameraActivity
03-06 08:16:52.817 15930-15930/my.example.app D/AppTracker: App Event: start
03-06 08:16:52.870 15930-15930/my.example.app **E/libc: Access denied finding property "camera.hal1.packagelist"**
03-06 08:16:52.861 15930-15930/my.example.app W/example.app: type=1400 audit(0.0:39722): avc: denied { read } for name="u:object_r:camera_prop:s0" dev="tmpfs" ino=17899 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:camera_prop:s0 tclass=file permissive=0
03-06 08:16:53.060 15930-15930/my.example.app I/CustomCameraActivity: setting camera preview size
03-06 08:16:53.065 15930-15930/my.example.app D/CustomCameraActivity: width: 1080 hieght: 2034
03-06 08:16:53.065 15930-15930/my.example.app D/CustomCameraActivity: sc W: 1080 sc H: 2034
03-06 08:16:53.069 15930-15930/my.example.app **E/CustomCameraActivity: Error starting camera preview: setParameters failed**
03-06 08:16:53.478 15930-15930/my.example.app D/UI: Activity save instance state: CardHolderActivity
03-06 08:16:53.485 15930-15930/my.example.app D/UI: Activity stopped: MainActivity