RafaelBarbosatec / qr_code_dart_scan

A QR code scanner that works on both iOS and Android using dart decoder.
MIT License
15 stars 20 forks source link

After logging back to the background on the scan page, turning on the camera and returning to the scan page will cause the program to freeze #14

Closed PillarChen closed 5 months ago

PillarChen commented 6 months ago

After logging back to the background on the scan page, turning on the camera and returning to the scan page will cause the program to freeze

Android System

error info: I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 5.585ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 19.264ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 21.899ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 47.855ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 45.853ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 55.643ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 54.143ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 84.291ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 33.261ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC ProfileSaver I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked ProfileSaver on HeapTrim for 74.784ms I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on ProfileSaver for 48.656ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on ProfileSaver for 47.367ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 53.618ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 55.883ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 144.348ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 127.059ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 13.715ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 10.281ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 20.387ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 17.363ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 6.868ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 169.786ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 131.164ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 93.233ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 62.569ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 46.377ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 33.928ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 30.034ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 24.800ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 62.542ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 27.544ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 25.523ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 11.106ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 65.538ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 61.930ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 60.484ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 25.371ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 25.043ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 82.353ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 48.008ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 38.509ms I/s0802.test( 9361): Starting a blocking GC Alloc I/s0802.test( 9361): Waiting for a blocking GC Alloc I/s0802.test( 9361): WaitForGcToComplete blocked Alloc on HeapTrim for 6.160ms I/s0802.test( 9361): Starting a blocking GC Alloc I/Camera ( 9361): open | onError I/Camera ( 9361): close I/Camera ( 9361): closeCaptureSession E/CameraCaptureSession( 9361): Session 1: Exception while stopping repeating: E/CameraCaptureSession( 9361): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): The camera device has encountered a serious error E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2534) E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1131) E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526) E/CameraCaptureSession( 9361): at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:1114) E/CameraCaptureSession( 9361): at io.flutter.plugins.camera.Camera.close(Camera.java:1121) E/CameraCaptureSession( 9361): at io.flutter.plugins.camera.Camera$1.onError(Camera.java:302) E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.notifyError(CameraDeviceImpl.java:2022) E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.lambda$Sm85frAzwGZVMAK-NE_gwckYXVQ(Unknown Source:0) E/CameraCaptureSession( 9361): at android.hardware.camera2.impl.-$$Lambda$CameraDeviceImpl$CameraDeviceCallbacks$Sm85frAzwGZVMAK-NE_gwckYXVQ.accept(Unknown Source:8) E/CameraCaptureSession( 9361): at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:271) E/CameraCaptureSession( 9361): at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:195) E/CameraCaptureSession( 9361): at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:86) E/CameraCaptureSession( 9361): at android.os.Handler.handleCallback(Handler.java:900) E/CameraCaptureSession( 9361): at android.os.Handler.dispatchMessage(Handler.java:103) E/CameraCaptureSession( 9361): at android.os.Looper.loop(Looper.java:219) E/CameraCaptureSession( 9361): at android.os.HandlerThread.run(HandlerThread.java:67) I/CameraDevice-JV-0( 9361): close camera: 0, package name: s0802.test I/CameraDevice-JV-0( 9361): Camera now idle

PillarChen commented 6 months ago

camera: 0.9.4+5 zxing_lib: 0.5.0 image: 3.1.3 camera_platform_interface: 2.6.0

///fix 在扫码页面时退到后台打开相机时再返回相机页面卡死问题 ///从相机插件0.5.0版本开始,插件不再处理生命周期更改。 ///这意味着开发人员现在负责在生命周期状态更新时控制相机资源。 ///如果不这样做可能会导致意外行为 ///https://pub.dev/packages/camera

@override void didChangeAppLifecycleState(AppLifecycleState state) { final CameraController cameraController = controller; // App state changed before we got the chance to initialize. if (!cameraController.value.isInitialized) { return; } if (state == AppLifecycleState.inactive) { cameraController.dispose(); } else if (state == AppLifecycleState.resumed) { _initController(); } }

RafaelBarbosatec commented 5 months ago

Fixed in 0.7.6