fluttercandies / flutter_wechat_camera_picker

A camera picker (take photos and videos) for Flutter projects based on WeChat's UI. It's a standalone module of wechat_assets_picker yet it can be run separately.
https://pub.dev/packages/wechat_camera_picker
Apache License 2.0
376 stars 149 forks source link

[BUG] Get a black screen when resumed app #199

Closed zhang873819 closed 1 year ago

zhang873819 commented 1 year ago

Describe the bug

I get a black screen when resumed app some times

How to reproduce

import 'package:flutter/material.dart';
import 'package:wechat_camera_picker/wechat_camera_picker.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: IconButton(
          onPressed: () {
            CameraPicker.pickFromCamera(context);
          },
          icon: const Icon(Icons.camera),
        ),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Steps to reproduce the behavior:

  1. click the camera icon;
  2. when the camera is on, lock screen;
  3. unlock screen;
  4. repeat step 2~3, util get a black screen;

Expected behavior

the camera is on after unlock screen;

Screenshots (If contains)

ccb5ab35bb391b14e5a24056fb73d8a

Version information

Additional context

I get the log when the black screen coming, there's no log (realDebugPrint("${stopwatch.elapsed} for config's update.");), i have try to fix, but fail.

D/BufferQueueCore(27945): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
D/BufferQueueCore(27945): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
W/Camera  (27945): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
D/BufferQueueCore(27945): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/CameraManager(27945): open camera: 0, package name: com.example.test_app
I/HwCameraUtil(27945): hide aux camera for app: com.example.test_app
E/CameraManagerGlobal(27945): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(27945): hide aux camera for app: com.example.test_app
I/HwCameraUtil(27945): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(27945): illegalAccessAuxCamera.
I/Camera  (27945): startPreview
D/InsetsSourceConsumer(27945): ViewUI_insets setControl -> ITYPE_STATUS_BAR on com.example.test_app/com.example.test_app.MainActivity
D/InsetsSourceConsumer(27945): ViewUI_insets setControl mType:0, requestedVisible:true, getLeash:Surface(name=Surface(name=5af24cb StatusBar)/@0xba9113f - animation-leash of insets_animation)/@0x6b73459, needAnimation:false, mIsAnimationPending:false, getRootViewTitle:com.example.test_app/com.example.test_app.MainActivity
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] current resolutionScale: 1.0
I/InputMethodManager(27945): set currentRootView to : android.view.ViewRootImpl@d5cf25a
I/InputMethodManager(27945): Starting input: reason=WINDOW_FOCUS_GAIN
I/InputMethodManager(27945): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
I/xample.test_ap(27945): Compiler allocated 5042KB to compile void android.view.ViewRootImpl.performTraversals()
[CameraPicker - LOG] 0:00:00.296456 for controller's initialization.
I/RmeSchedManager(27945): init Rme, version is: v1.0
I/Camera  (27945): refreshPreviewCaptureSession
I/Camera  (27945): refreshPreviewCaptureSession: captureSession not yet initialized, skipping preview capture session refresh.
I/Camera  (27945): CameraCaptureSession onConfigured
I/Camera  (27945): Updating builder settings
D/Camera  (27945): Updating builder with feature: ExposureLockFeature
D/Camera  (27945): Updating builder with feature: ExposurePointFeature
D/Camera  (27945): Updating builder with feature: ZoomLevelFeature
D/Camera  (27945): Updating builder with feature: AutoFocusFeature
D/Camera  (27945): Updating builder with feature: NoiseReductionFeature
I/Camera  (27945): updateNoiseReduction | currentSetting: fast
D/Camera  (27945): Updating builder with feature: FocusPointFeature
D/Camera  (27945): Updating builder with feature: ResolutionFeature
D/Camera  (27945): Updating builder with feature: SensorOrientationFeature
D/Camera  (27945): Updating builder with feature: FlashFeature
D/Camera  (27945): Updating builder with feature: ExposureOffsetFeature
D/Camera  (27945): Updating builder with feature: FpsRangeFeature
I/Camera  (27945): refreshPreviewCaptureSession
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] start to get views' rect, type = SCENE_WINDOW_FOCUS_CHANGE
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] displayPoint: Point(1084, 2412)
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] lazyMode:
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] current mode is full screen
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] start to getViewHierarchy
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] deviceOrientation: 0
D/HwViewRootImpl(27945): [DetectViewsLocationRunner-ScreenDirection] ROTATION_0
D/HwViewRootImpl(27945): [DetectViewsLocationRunner] get views' rect = 0, SCENE_WINDOW_FOCUS_CHANGE
I/Camera  (27945): CameraCaptureSession onClosed
W/System  (27945): A resource failed to call release. 
I/Camera  (27945): CameraCaptureSession onClosed
W/System  (27945): A resource failed to call release. 
zhang873819 commented 1 year ago

And i had try the camera package's example, but unable to reproduce.

zhang873819 commented 1 year ago

It is ok when remove following code in camera_picker_state.dart:

await Future.wait(
          <Future<void>>[
            newController
                .getExposureOffsetStepSize()
                .then((double value) => exposureStep = value)
                .catchError((_) => exposureStep),
            newController
                .getMaxExposureOffset()
                .then((double value) => maxAvailableExposureOffset = value)
                .catchError((_) => maxAvailableExposureOffset),
            newController
                .getMinExposureOffset()
                .then((double value) => minAvailableExposureOffset = value)
                .catchError((_) => minAvailableExposureOffset),
            newController
                .getMaxZoomLevel()
                .then((double value) => maxAvailableZoom = value)
                .catchError((_) => maxAvailableZoom),
            newController
                .getMinZoomLevel()
                .then((double value) => minAvailableZoom = value)
                .catchError((_) => minAvailableZoom),
            if (pickerConfig.lockCaptureOrientation != null)
              newController
                  .lockCaptureOrientation(pickerConfig.lockCaptureOrientation)
                  .catchError((_) {}),
            if (pickerConfig.preferredFlashMode != FlashMode.auto)
              newController
                  .setFlashMode(pickerConfig.preferredFlashMode)
                  .catchError((_) {
                validFlashModes[currentCamera]
                    ?.remove(pickerConfig.preferredFlashMode);
              }),
          ],
        );
AlexV525 commented 1 year ago

Thanks for the feedback. I've found that controller methods will affect capture sessions occasionally in recent versions. I'll look into it next week.

AlexV525 commented 1 year ago

@zhang873819 Could you verify if the PR fixes the issue?

zhang873819 commented 1 year ago

@AlexV525 Sorry for delay. But it not works for me. pubspec.yaml:

wechat_camera_picker:
    git:
      url: https://github.com/fluttercandies/flutter_wechat_camera_picker.git
      ref: a4eb461

log print:

Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
Launching lib\main.dart on FOA AL00 in debug mode...
Running Gradle task 'assembleDebug'...
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app-debug.apk...
Debug service listening on ws://127.0.0.1:63763/v0QMv09zZYs=/ws
Syncing files to device FOA AL00...
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to get views' rect, type = SCENE_WINDOW_FOCUS_CHANGE
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] displayPoint: Point(1084, 2412)
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] lazyMode:
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current mode is full screen
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to getViewHierarchy
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current view is dirty
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] deviceOrientation: 0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner-ScreenDirection] ROTATION_0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] get views' rect = 0, SCENE_WINDOW_FOCUS_CHANGE
I/AwareBitmapCacher(19365): init lrucache size: 4194304 pid=19365
I/Hwaps   (19365): APS: EventAnalyzed: initAPS: version is 11.0.0.4
D/Hwaps   (19365): Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps   (19365): Fpsrequest create,type:EXACTLY_IDENTIFY
D/Hwaps   (19365): Fpsrequest create,type:OPENGL_SETTING
D/Hwaps   (19365): FpsController create
D/Hwaps   (19365): APS: EventAnalyzed: reInitFpsPara :mBaseFps = 120; mMaxFps = 120
I/HwViewRootImpl(19365): Add sceneId 11 topId: 10
W/Settings(19365): Setting device_provisioned has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
V/HiTouch_HiTouchSensor(19365): User setup is finished.
D/HwDragEnhancementImpl(19365): handleTimerDrag: false
D/HwDragEnhancementImpl(19365): handleTimerDrag: false
D/HwDragEnhancementImpl(19365): Start long press for hw drag enhancement.
W/HwApsManager(19365): HwApsManagerService, registerCallback, start !
D/Hwaps   (19365): APS: EventAnalyzed: registerCallbackInApsManagerService, mPkgName:com.example.test_app; result = true
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current resolutionScale: 1.0
I/HwViewRootImpl(19365): remove sceneId 11 topId: 10
D/WebViewDragEnhancement(19365): dragReset.
D/WebViewDragEnhancement(19365): dragReset cacheSize = 0
V/AudioManager(19365): querySoundEffectsEnabled...
I/AudioManager(19365): querySoundEffectsEnabled fail id: 0
I/CameraManagerGlobal(19365): Connecting to camera service
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
D/DefaultHwCameraUtil(19365): filterVirtualCamera
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/TopResumedActivityChangeItem(19365): execute start, ActivityClientRecord = ActivityRecord{81aa4a8 token=android.os.BinderProxy@d88ef2e {com.example.test_app/com.example.test_app.MainActivity}}
I/HwViewRootImpl(19365): remove sceneId 10 topId: 0
I/InsetsSourceConsumer(19365): ViewUI_insets mSourceControl is null notifyControlRevoked type: 0
I/RmeSchedManager(19365): init Rme, version is: v1.0
I/TopResumedActivityChangeItem(19365): execute start, ActivityClientRecord = ActivityRecord{81aa4a8 token=android.os.BinderProxy@d88ef2e {com.example.test_app/com.example.test_app.MainActivity}}
D/ActivityThread(19365): Won't deliver top position change in state=4
I/RmeSchedManager(19365): init Rme, version is: v1.0
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/HwViewRootImpl(19365): Add sceneId 3 topId: 0
D/InsetsSourceConsumer(19365): ViewUI_insets setControl -> ITYPE_STATUS_BAR on com.example.test_app/com.example.test_app.MainActivity
D/InsetsSourceConsumer(19365): ViewUI_insets setControl mType:0, requestedVisible:true, getLeash:Surface(name=Surface(name=c78a84c StatusBar)/@0xc672c9f - animation-leash of insets_animation)/@0xb4d3226, needAnimation:false, mIsAnimationPending:false, getRootViewTitle:com.example.test_app/com.example.test_app.MainActivity
I/HwViewRootImpl(19365): remove sceneId 3 topId: 0
I/HwViewRootImpl(19365): Add sceneId 10 topId: 0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current resolutionScale: 1.0
I/InputMethodManager(19365): set currentRootView to : android.view.ViewRootImpl@3b1d8c6
I/InputMethodManager(19365): Starting input: reason=WINDOW_FOCUS_GAIN
W/HwRemoteInputMethodManager(19365): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager(19365): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
W/Camera  (19365): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/CameraManager(19365): open camera: 0, package name: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
E/CameraManagerGlobal(19365): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/Camera  (19365): close
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
W/Camera  (19365): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/CameraManager(19365): open camera: 0, package name: com.example.test_app
W/MessageQueue(19365): Handler (android.os.Handler) {34a4ab2} sending message to a Handler on a dead thread
W/MessageQueue(19365): java.lang.IllegalStateException: Handler (android.os.Handler) {34a4ab2} sending message to a Handler on a dead thread
W/MessageQueue(19365):  at android.os.MessageQueue.enqueueMessage(MessageQueue.java:632)
W/MessageQueue(19365):  at android.os.Handler.enqueueMessage(Handler.java:806)
W/MessageQueue(19365):  at android.os.Handler.sendMessageAtTime(Handler.java:749)
W/MessageQueue(19365):  at android.os.Handler.sendMessageDelayed(Handler.java:719)
W/MessageQueue(19365):  at android.os.Handler.post(Handler.java:448)
W/MessageQueue(19365):  at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2334)
W/MessageQueue(19365):  at android.hardware.camera2.impl.CameraDeviceImpl.onDeviceError(CameraDeviceImpl.java:1774)
W/MessageQueue(19365):  at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onDeviceError(CameraDeviceImpl.java:1969)
W/MessageQueue(19365):  at android.hardware.camera2.ICameraDeviceCallbacks$Stub.onTransact(ICameraDeviceCallbacks.java:139)
W/MessageQueue(19365):  at android.os.Binder.execTransactInternal(Binder.java:1197)
W/MessageQueue(19365):  at android.os.Binder.execTransact(Binder.java:1156)
[CameraPicker - LOG] 0:00:01.349597 for controller's initialization.
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
E/CameraManagerGlobal(19365): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
E/CameraManagerGlobal(19365): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/Camera  (19365): startPreview
I/Camera  (19365): refreshPreviewCaptureSession
I/Camera  (19365): refreshPreviewCaptureSession: captureSession not yet initialized, skipping preview capture session refresh.
I/Camera  (19365): CameraCaptureSession onConfigured
I/Camera  (19365): Updating builder settings
D/Camera  (19365): Updating builder with feature: ExposureLockFeature
D/Camera  (19365): Updating builder with feature: ExposurePointFeature
D/Camera  (19365): Updating builder with feature: ZoomLevelFeature
D/Camera  (19365): Updating builder with feature: AutoFocusFeature
D/Camera  (19365): Updating builder with feature: NoiseReductionFeature
I/Camera  (19365): updateNoiseReduction | currentSetting: fast
D/Camera  (19365): Updating builder with feature: FocusPointFeature
D/Camera  (19365): Updating builder with feature: ResolutionFeature
D/Camera  (19365): Updating builder with feature: SensorOrientationFeature
D/Camera  (19365): Updating builder with feature: FlashFeature
D/Camera  (19365): Updating builder with feature: ExposureOffsetFeature
D/Camera  (19365): Updating builder with feature: FpsRangeFeature
I/Camera  (19365): refreshPreviewCaptureSession
[CameraPicker - LOG] 0:00:00.255281 for controller's initialization.
I/Camera  (19365): refreshPreviewCaptureSession
[CameraPicker - LOG] 0:00:00.008967 for config's update.
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to get views' rect, type = SCENE_WINDOW_FOCUS_CHANGE
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] displayPoint: Point(1084, 2412)
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] lazyMode:
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current mode is full screen
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to getViewHierarchy
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] deviceOrientation: 0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner-ScreenDirection] ROTATION_0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] get views' rect = 0, SCENE_WINDOW_FOCUS_CHANGE
I/WindowManager(19365): trimMemory level: 5
I/InputMethodManager(19365): Starting input: reason=DEACTIVATED_BY_IMMS
W/HwRemoteInputMethodManager(19365): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager(19365): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
I/TopResumedActivityChangeItem(19365): execute start, ActivityClientRecord = ActivityRecord{81aa4a8 token=android.os.BinderProxy@d88ef2e {com.example.test_app/com.example.test_app.MainActivity}}
I/HwViewRootImpl(19365): remove sceneId 10 topId: 0
I/Camera  (19365): dispose
I/Camera  (19365): close
I/CameraDevice-JV-0(19365): close camera: 0, package name: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
E/CameraManagerGlobal(19365): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/Camera  (19365): open | onClosed
I/CameraDevice-JV-0(19365): Camera now idle
W/HwApsImpl(19365): not support full screen video recognize feature  ## com.example.test_app
E/BLASTBufferQueue(19365): [com.example.test_app/com.example.test_app.MainActivity#0](f:0,a:1) Applying pending transactions on dtor 2
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
I/WindowManager(19365): trimMemory level: 20
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
I/InsetsSourceConsumer(19365): ViewUI_insets mSourceControl is null notifyControlRevoked type: 0
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
I/RmeSchedManager(19365): init Rme, version is: v1.0
I/WindowManager(19365): trimMemory level: 5
I/AwareBitmapCacher(19365): handleReleaseCache: pid=19365
I/AwareBitmapCacher(19365): init lrucache size: 4194304 pid=19365
I/flutter (30674): ImageCache.clear!!!!!!!!!!
I/AwareBitmapCacher(19365): handleReleaseCache: pid=19365
I/AwareBitmapCacher(19365): init lrucache size: 4194304 pid=19365
I/TopResumedActivityChangeItem(19365): execute start, ActivityClientRecord = ActivityRecord{81aa4a8 token=android.os.BinderProxy@d88ef2e {com.example.test_app/com.example.test_app.MainActivity}}
D/ActivityThread(19365): Won't deliver top position change in state=5
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
I/HwViewRootImpl(19365): Add sceneId 3 topId: 0
I/RmeSchedManager(19365): init Rme, version is: v1.0
W/SurfaceView(19365): ViewUI notifySurfaceDestroyed
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/InsetsController(19365): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_STATUS_BAR, mFrame=[0,0][1084,110], mVisible=true}
I/InsetsController(19365): ViewUI_insets updateState new source: InsetsSource: {mType=ITYPE_NAVIGATION_BAR, mFrame=[0,0][0,0], mVisible=false}
E/OpenGLRenderer(19365): Unable to match the desired swap behavior.
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/SurfaceView(19365): ViewUI setLowResolutionInfo compatInfo.supportsScreen() is not satisfied
W/HwApsImpl(19365): not support full screen video recognize feature ## com.example.test_app
I/HwViewRootImpl(19365): removeInvalidNode jank list is null
I/HwViewRootImpl(19365): remove sceneId 3 topId: 0
I/HwViewRootImpl(19365): Add sceneId 10 topId: 0
I/Camera  (19365): close
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
W/Camera  (19365): The selected imageFormatGroup is not supported by Android. Defaulting to yuv420
D/BufferQueueCore(19365): BufferQueueCore: mDebugHwFlow=0, mIsBufferQueueLogVSupport=0.
I/CameraManager(19365): open camera: 0, package name: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
E/CameraManagerGlobal(19365): Camera 4 is not available. Ignore physical camera status change
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/HwCameraUtil(19365): hide aux camera for app: com.example.test_app
I/CameraManagerGlobal(19365): illegalAccessAuxCamera.
I/Camera  (19365): startPreview
[CameraPicker - LOG] 0:00:00.209564 for controller's initialization.
I/RmeSchedManager(19365): init Rme, version is: v1.0
I/Camera  (19365): refreshPreviewCaptureSession
I/Camera  (19365): refreshPreviewCaptureSession: captureSession not yet initialized, skipping preview capture session refresh.
I/Camera  (19365): CameraCaptureSession onConfigured
I/Camera  (19365): Updating builder settings
D/Camera  (19365): Updating builder with feature: ExposureLockFeature
D/Camera  (19365): Updating builder with feature: ExposurePointFeature
D/Camera  (19365): Updating builder with feature: ZoomLevelFeature
D/Camera  (19365): Updating builder with feature: AutoFocusFeature
D/Camera  (19365): Updating builder with feature: NoiseReductionFeature
I/Camera  (19365): updateNoiseReduction | currentSetting: fast
D/Camera  (19365): Updating builder with feature: FocusPointFeature
D/Camera  (19365): Updating builder with feature: ResolutionFeature
D/Camera  (19365): Updating builder with feature: SensorOrientationFeature
D/Camera  (19365): Updating builder with feature: FlashFeature
D/Camera  (19365): Updating builder with feature: ExposureOffsetFeature
D/Camera  (19365): Updating builder with feature: FpsRangeFeature
I/Camera  (19365): refreshPreviewCaptureSession
D/InsetsSourceConsumer(19365): ViewUI_insets setControl -> ITYPE_STATUS_BAR on com.example.test_app/com.example.test_app.MainActivity
D/InsetsSourceConsumer(19365): ViewUI_insets setControl mType:0, requestedVisible:true, getLeash:Surface(name=Surface(name=c78a84c StatusBar)/@0xc672c9f - animation-leash of insets_animation)/@0xccba461, needAnimation:false, mIsAnimationPending:false, getRootViewTitle:com.example.test_app/com.example.test_app.MainActivity
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current resolutionScale: 1.0
I/InputMethodManager(19365): set currentRootView to : android.view.ViewRootImpl@3b1d8c6
I/InputMethodManager(19365): Starting input: reason=WINDOW_FOCUS_GAIN
W/HwRemoteInputMethodManager(19365): isCasting false because IHwDistributedWindowManager is invalid.
I/InputMethodManager(19365): Starting input: Bind resultString=SUCCESS_WITH_IME_SESSION
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to get views' rect, type = SCENE_WINDOW_FOCUS_CHANGE
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] displayPoint: Point(1084, 2412)
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] lazyMode:
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current mode is full screen
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to getViewHierarchy
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] deviceOrientation: 0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner-ScreenDirection] ROTATION_0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] get views' rect = 0, SCENE_WINDOW_FOCUS_CHANGE
I/HwViewRootImpl(19365): Add sceneId 11 topId: 10
D/HwDragEnhancementImpl(19365): handleTimerDrag: false
D/HwDragEnhancementImpl(19365): handleTimerDrag: false
D/HwDragEnhancementImpl(19365): Start long press for hw drag enhancement.
I/HwViewRootImpl(19365): Add sceneId 13 topId: 11
D/HwDragEnhancementImpl(19365): Touch move more than touch range.
W/HiTouch_PressGestureDetector(19365): Touch pointer move a lot. The moving distance of X is:60.375, limit is:60The moving distance of Y is:4.25, limit is:60
I/HwViewRootImpl(19365): Add sceneId 14 topId: 13
E/HwViewRootImpl(19365): [DetectViewsLocationRunner] getSplineFlingDurationByReflection exception
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] splineFlingDuration: 2600
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current resolutionScale: 1.0
I/HwViewRootImpl(19365): remove sceneId 13 topId: 14
I/HwViewRootImpl(19365): remove sceneId 11 topId: 14
D/WebViewDragEnhancement(19365): dragReset.
D/WebViewDragEnhancement(19365): dragReset cacheSize = 0
I/HwViewRootImpl(19365): remove sceneId 14 topId: 10
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to get views' rect, type = SCENE_GESTURE_FLING
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] displayPoint: Point(1084, 2412)
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] windowModeType: 1
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] lazyMode:
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] current mode is full screen
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] start to getViewHierarchy
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] deviceOrientation: 0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner-ScreenDirection] ROTATION_0
D/HwViewRootImpl(19365): [DetectViewsLocationRunner] get views' rect = 0, SCENE_GESTURE_FLING
I/Camera  (19365): CameraCaptureSession onClosed
W/System  (19365): A resource failed to call release. 
AlexV525 commented 1 year ago

Could you run git bisect to find out which commit produce the regression?

zhang873819 commented 1 year ago

Hi! There is some new tests: It's good when use version(3.8.0) It's good when use version(4.0.2) and use for set the config 'preferredFlashMode' to FlashMode.auto, use like

CameraPicker.pickFromCamera(
    context,
    pickerConfig:
       const CameraPickerConfig(preferredFlashMode: FlashMode.auto),
);
zhang873819 commented 1 year ago

And in version 3.8.0 the config property 'preferredFlashMode' default with FlashMode.auto. It's also bad when use version 3.8.0 and set the config property 'preferredFlashMode' to FlashMode.off, use like

CameraPicker.pickFromCamera(
    context,
    pickerConfig:
       const CameraPickerConfig(preferredFlashMode: FlashMode.off),
);
zhang873819 commented 1 year ago

@AlexV525 So there is something wrong with the code that set flash mode:

if (pickerConfig.preferredFlashMode != FlashMode.auto)
              newController
                  .setFlashMode(pickerConfig.preferredFlashMode)
                  .catchError((_) {
                validFlashModes[currentCamera]
                    ?.remove(pickerConfig.preferredFlashMode);
              }),
AlexV525 commented 1 year ago

Could you try another device model for results?

zhang873819 commented 1 year ago

@AlexV525 There is the same with device redmi note 10. But it's lower frequency when use this device.

RuoLiDevelop commented 7 months ago

同样的问题在最新版本依旧出现,文件 camera_picker_state.dart await Future.wait,去除await 一切正常 可能:并发配置相机有几率没有回调成功 期望:是否配置超时时间

AlexV525 commented 7 months ago

同样的问题在最新版本依旧出现,文件 camera_picker_state.dart await Future.wait,去除await 一切正常 可能:并发配置相机有几率没有回调成功 期望:是否配置超时时间

确认 #241 是否有修复相关问题

doanbh commented 5 months ago

同样的问题在最新版本依旧出现,文件 camera_picker_state.dart await Future.wait,去除await 一切正常 可能:并发配置相机有几率没有回调成功 期望:是否配置超时时间

确认 #241 是否有修复相关问题

Still having problems with the new version with the following phone models: Vivo and Redmi Note 12.

AlexV525 commented 5 months ago

Still having problems with the new version with the following phone models: Vivo and Redmi Note 12.

Please submit new issues with detailed information following the issue template.

Tindtily commented 1 month ago

HUAWEI Mate 30E Pro 5G HarmonyOS 2.0.0也会偶尔出现类似问题。 80%成功率的复现流程: 关闭拍照页后快速打开

看上去好像是camer_android的一个bug。不太懂到底是为什么

Aimee135 commented 1 month ago

我也遇到了同样的问题~ HUAWEI MATE 40 Pro HarmonyOS 4.2.0