Skip to content

[camera][Android] Crash with exception 'CAMERA_ERROR (3): cancelRequest:652: Camera 0: Error clearing streaming request: Function not implemented (-38)' #102644

@Vov4yk

Description

@Vov4yk

There is a crash. It's affecting android only.

STR:

  1. open image picker await ImagePicker().pickImage(source: ImageSource.camera)
  2. take a photo
  3. After result screen appears with 'use / retake photo' swipe back few times
  4. tap retake photo
  5. close image picker

There is old issue that was closed. But it seems to me it wasn't fixed. #32896. Probably, There should be more than one screen in a navigation stack. In that case of swipe back gesture could pop us to parent screen under image picker. Maybe fix for that issue would help with described crash.

Logs
I/ViewRootImpl@39ac7cb[MainActivity]( 3168): MSG_WINDOW_FOCUS_CHANGED 0 1
I/Camera  ( 3168): dispose
I/Camera  ( 3168): close
I/Camera  ( 3168): closeCaptureSession
I/CameraManagerGlobal( 3168): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_IDLE for client net.byga.bygaapp API Level 2
I/CameraManagerGlobal( 3168): Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client net.byga.bygaapp API Level 2
E/CameraCaptureSession( 3168): Session 0: Exception while stopping repeating:
E/CameraCaptureSession( 3168): android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): cancelRequest:652: Camera 0: Error clearing streaming request: Function not implemented (-38)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1599)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:99)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1315)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:579)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:790)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:259)
E/CameraCaptureSession( 3168): 	at android.os.Handler.handleCallback(Handler.java:938)
E/CameraCaptureSession( 3168): 	at android.os.Handler.dispatchMessage(Handler.java:99)
E/CameraCaptureSession( 3168): 	at android.os.Looper.loopOnce(Looper.java:226)
E/CameraCaptureSession( 3168): 	at android.os.Looper.loop(Looper.java:313)
E/CameraCaptureSession( 3168): 	at android.os.HandlerThread.run(HandlerThread.java:67)
E/CameraCaptureSession( 3168): Caused by: android.os.ServiceSpecificException: cancelRequest:652: Camera 0: Error clearing streaming request: Function not implemented (-38) (code 10)
E/CameraCaptureSession( 3168): 	at android.os.Parcel.createExceptionOrNull(Parcel.java:2451)
E/CameraCaptureSession( 3168): 	at android.os.Parcel.createException(Parcel.java:2421)
E/CameraCaptureSession( 3168): 	at android.os.Parcel.readException(Parcel.java:2404)
E/CameraCaptureSession( 3168): 	at android.os.Parcel.readException(Parcel.java:2346)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:767)
E/CameraCaptureSession( 3168): 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
E/CameraCaptureSession( 3168): 	... 9 more
I/Camera  ( 3168): open | onDisconnected
I/Camera  ( 3168): close
E/CameraManagerGlobal( 3168): Camera 20 is not available. Ignore physical camera status change
E/CameraManagerGlobal( 3168): Camera 21 is not available. Ignore physical camera status change
I/CameraManagerGlobal( 3168): Camera 20 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 3168): Camera 20 facing CAMERA_FACING_BACK state now CAMERA_STATE_ACTIVE for client com.sec.android.app.camera API Level 2
I/CameraManagerGlobal( 3168): Camera 20 facing CAMERA_FACING_BACK state now CAMERA_STATE_IDLE for client com.sec.android.app.camera API Level 2
E/CameraManagerGlobal( 3168): Camera 20 is not available. Ignore physical camera status change
E/CameraManagerGlobal( 3168): Camera 21 is not available. Ignore physical camera status change
E/CameraManagerGlobal( 3168): Camera 23 is not available. Ignore physical camera status change
E/CameraManagerGlobal( 3168): Camera 20 is not available. Ignore physical camera status change
E/CameraManagerGlobal( 3168): Camera 23 is not available. Ignore physical camera status change
I/CameraManagerGlobal( 3168): Camera 20 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.sec.android.app.camera API Level 2
I/ViewRootImpl@39ac7cb[MainActivity]( 3168): Resizing android.view.ViewRootImpl@4e6439e: frame=[0,0][1080,2400] reportDraw=true forceLayout=false backDropFrame=Rect(0, 0 - 1080, 2400)
I/et.byga.bygaap( 3168): Thread[5,tid=3173,WaitingInMainSignalCatcherLoop,Thread*=0x78ff69bc00,peer=0x14880228,"Signal Catcher"]: reacting to signal 3
I/et.byga.bygaap( 3168):
I/et.byga.bygaap( 3168): Wrote stack traces to tombstoned
F/crash_dump64(11238): crash_dump.cpp:536] failed to attach to thread 511: Permission denied
F/crash_dump64(11276): crash_dump.cpp:536] failed to attach to thread 778, already traced by 0 ()
Lost connection to device.

flutter doctor -v

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.1 21C52 darwin-arm, locale en-UA)
    • Flutter version 2.10.3 at /Users/vov4yk/DevTools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (8 weeks ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/vov4yk/Library/Android/sdk
    • Platform android-32, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.66.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.38.1

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

There are ANRs collected by firebase that is related to the issue

Uploading Screenshot 2022-04-27 at 15.13.42.png…

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processfound in release: 2.10Found to occur in 2.10found in release: 2.13Found to occur in 2.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cameraThe camera pluginpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    Status

    [PENDING] camera_android issues solved by camera_android_camerax

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions