mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.29k stars 1.07k forks source link

🐛 Black screen on Redmi K30 Pro #2405

Closed ooxoxx closed 7 months ago

ooxoxx commented 8 months ago

What's happening?

I'm working on some QR code scanning functionality. It works well on android emulator and most devices. But on Redmi K30 pro, the camera component failed to destroy itself leaving a "black mask" (maybe a surface view?) out there, when I switch back with navigation of react-native-navigation/stack.

https://github.com/mrousavy/react-native-vision-camera/assets/11285169/e91e4512-e649-4dca-9df0-329fe992cc5b

Reproduceable Code

import {useIsFocused} from '@react-navigation/core';

export const useIsForeground = (): boolean => {
  const [isForeground, setIsForeground] = useState(true);

  useEffect(() => {
    const onChange = (state: AppStateStatus): void => {
      setIsForeground(state === 'active');
    };
    const listener = AppState.addEventListener('change', onChange);
    return () => listener.remove();
  }, [setIsForeground]);

  return isForeground;
};

export default function ({navigation}: RootStackScreenProps<'QrScanner'>) {
  const camera = useCameraDevice('back');
  const isFocused = useIsFocused();
  const isForeground = useIsForeground();
  const isActive = isFocused && isForeground;

  // ...

  const codeScanner = useCodeScanner({
    codeTypes: ['qr'],
    onCodeScanned,
  });

  console.log(`isFocused: ${isFocused}`);

  if (Platform.OS === 'android' && !isFocused) {
    return <View />;
  }

  return (
    <View style={styles.container}>
      {camera != null && (
        <Camera
          style={StyleSheet.absoluteFill}
          device={camera}
          isActive={isActive}
          codeScanner={codeScanner}
          enableZoomGesture={true}
          torch={torch ? 'on' : 'off'}
        />
      )}
    </View>
  );
}

const styles = StyleSheet.create({
  container: {flex: 1, backgroundColor: 'black'},
});

Relevant log output

2024-01-15 17:23:22.318   903-1010  AppScoutStateMachine    com.lisgard                          D  903-ScoutStateMachinecreated
2024-01-15 17:23:22.321  5442-7904  SuggestManager          com.miui.securitycenter.remote       E  openApp name = com.lisgard
2024-01-15 17:23:22.413  3144-3505  ActivityManagerWrapper  com.miui.home                        E  getRecentTasks: taskId=12772   userId=0   baseIntent=Intent
                                                                                                    { act=android.intent.action.MAIN flag=268435456
                                                                                                    cmp=ComponentInfo{com.lisgard/com.lisgard.MainActivity} }
2024-01-15 17:23:22.414   903-903   DecorView[]             com.lisgard                          D  onWindowFocusChanged hasWindowFocus true
2024-01-15 17:23:22.514   903-1254  MqttModule              com.lisgard                          W  subscribed to
                                                                                                    lisgard/gas/b973ef883c406d3e, lisgard/ventilate/b973ef883c406d3e, lisgard/state/b973ef883c406d3e

2024-01-15 17:23:25.327  5442-8010  AppPredict              com.miui.securitycenter.remote       E  click app not fount, pkgName is com.lisgard

2024-01-15 17:23:25.654   903-1294  ReactNativeJS           com.lisgard                          I  isFocused: true
2024-01-15 17:23:25.672   903-903   PreviewView             com.lisgard                          I  Creating PreviewView...
2024-01-15 17:23:25.672   903-1294  ReactNativeJS           com.lisgard                          I  isFocused: true
2024-01-15 17:23:25.672   903-903   PreviewView             com.lisgard                          I  PreviewView is 0x0, rendering 1080x1920 content. Resizing to: 0x0
                                                                                                    (COVER)
2024-01-15 17:23:25.673   903-903   CameraView              com.lisgard                          I  Updating CameraSession...
2024-01-15 17:23:25.674   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Waiting for lock...
2024-01-15 17:23:25.675   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Updating CameraSession
                                                                                                    Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-15 17:23:25.675   903-1336  CameraSession           com.lisgard                          I  isActive is false, skipping CameraDevice configuration.
2024-01-15 17:23:25.675   903-1336  CameraSession           com.lisgard                          I  isActive is false, skipping CameraCaptureSession configuration.
2024-01-15 17:23:25.675   903-1336  CameraSession           com.lisgard                          I  Successfully updated CameraSession Configuration! isActive: false
2024-01-15 17:23:25.675   903-1336  CameraView              com.lisgard                          I  invokeOnInitialized()
2024-01-15 17:23:25.684   903-903   CameraView              com.lisgard                          I  Updating CameraSession...
2024-01-15 17:23:25.685   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Waiting for lock...
2024-01-15 17:23:25.685   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Updating CameraSession
                                                                                                    Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
2024-01-15 17:23:25.685   903-1336  CameraSession           com.lisgard                          I  Need to rebuild CameraDevice and CameraCaptureSession...
2024-01-15 17:23:25.686   903-1336  CameraSession           com.lisgard                          I  Configuring Camera #0...
2024-01-15 17:23:25.686   903-1336  CameraManager           com.lisgard                          I  Camera #0: Opening...
2024-01-15 17:23:25.688   903-903   PreviewView             com.lisgard                          I  PreviewView is 1080x2304, rendering 1080x1920 content. Resizing
                                                                                                    to: 1296x2304 (COVER)
2024-01-15 17:23:25.692   903-903   SurfaceView             com.lisgard                          D  UPDATE null, mIsCastMode = false
2024-01-15 17:23:25.693   903-1336  libc                    com.lisgard                          W  Access denied finding property "persist.vendor.camera.privapp.list"
2024-01-15 17:23:25.693   903-1336  CameraExtImplXiaoMi     com.lisgard                          D  initCameraDevice: 0
2024-01-15 17:23:25.696   903-903   CameraSession           com.lisgard                          I  PreviewView Surface created! Surface(name=null)/@0x6fa344a
2024-01-15 17:23:25.696   903-903   CameraSession           com.lisgard                          I  Setting Preview Output...
2024-01-15 17:23:25.697   903-903   CameraSession           com.lisgard                          I  PreviewView Surface updated! Surface(name=null)/@0x6fa344a 1296 x 2304
2024-01-15 17:23:25.701   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 10 is not available. Ignore physical camera status change
2024-01-15 17:23:25.702   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 5 is not available. Ignore physical camera status change
2024-01-15 17:23:25.702   903-903   SurfaceView             com.lisgard                          D  UPDATE
                                                                                                    Surface(name=SurfaceView[com.lisgard/com.lisgard.MainActivity])/@0xec40cd8, mIsProjectionMode
                                                                                                    = false
2024-01-15 17:23:25.702   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:25.702   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 6 is not available. Ignore physical camera status change
2024-01-15 17:23:25.703   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 7 is not available. Ignore physical camera status change
2024-01-15 17:23:25.704   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:25.704   903-1296  CameraDevices           com.lisgard                          I  Camera #0 is now unavailable.
2024-01-15 17:23:25.705   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:25.710   903-1010  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.710   903-1010  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 2
2024-01-15 17:23:25.710   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.710   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 3
2024-01-15 17:23:25.710   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.710   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 5
2024-01-15 17:23:25.711   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.711   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 6
2024-01-15 17:23:25.711   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.711   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 7
2024-01-15 17:23:25.711   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.711   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 8
2024-01-15 17:23:25.711   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.711   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 10
2024-01-15 17:23:25.711   903-2136  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:25.711   903-2136  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 11
2024-01-15 17:23:25.715   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Waiting for lock...
2024-01-15 17:23:25.715   903-1336  CameraManager           com.lisgard                          I  Camera #0: Opened!
2024-01-15 17:23:25.718   903-1336  CameraSession           com.lisgard                          I  Successfully configured Camera #0!
2024-01-15 17:23:25.718   903-1336  CameraSession           com.lisgard                          I  Destroying previous outputs...
2024-01-15 17:23:25.719   903-1336  CameraSession           com.lisgard                          I  Creating outputs for Camera #0...
2024-01-15 17:23:25.719   903-1336  CameraSession           com.lisgard                          I  Adding 1280x720 CodeScanner Output in YUV_420_888...
2024-01-15 17:23:25.722   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: Creating Capture Session #19... (Hardware Level: 3
                                                                                                    | Outputs: [VIDEO (1280 x 720 CodeScanner for [QR] (35))])
2024-01-15 17:23:25.723   903-1336  CreateCaptureSession    com.lisgard                          I  Using new API (>=28)
2024-01-15 17:23:25.723   903-4621  DynamiteModule          com.lisgard                          I  Considering local module com.google.mlkit.dynamite.barcode:10000 and
                                                                                                    remote module com.google.mlkit.dynamite.barcode:0
2024-01-15 17:23:25.723   903-1336  CameraDevice-JV-0       com.lisgard                          D  waitUntilIdle: E. id = 0
2024-01-15 17:23:25.723   903-4621  DynamiteModule          com.lisgard                          I  Selected local version of com.google.mlkit.dynamite.barcode
2024-01-15 17:23:25.723   903-1336  CameraDevice-JV-0       com.lisgard                          D  waitUntilIdle: X
2024-01-15 17:23:25.726   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:25.730   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:25.734   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:25.738   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:25.887   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: Successfully created CameraCaptureSession #19!
2024-01-15 17:23:25.888   903-1336  CameraSession           com.lisgard                          I  Successfully configured Session with 1 outputs for Camera #0!
2024-01-15 17:23:25.897   903-1336  CameraView              com.lisgard                          I  invokeOnStarted()
2024-01-15 17:23:25.898   903-1336  CameraSession           com.lisgard                          I  Successfully updated CameraSession Configuration! isActive: true
2024-01-15 17:23:25.898   903-1336  CameraView              com.lisgard                          I  invokeOnInitialized()
2024-01-15 17:23:25.898   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Updating CameraSession
                                                                                                    Configuration... Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=false)
2024-01-15 17:23:25.898   903-1336  CameraSession           com.lisgard                          I  Destroying previous outputs...
2024-01-15 17:23:25.898   903-1336  SurfaceOutput           com.lisgard                          I  Closing BarcodeScanner..
2024-01-15 17:23:25.899   903-1336  CameraView              com.lisgard                          I  invokeOnStopped()
2024-01-15 17:23:25.900   903-1336  CameraSession           com.lisgard                          I  Creating outputs for Camera #0...
2024-01-15 17:23:25.901   903-1336  CameraSession           com.lisgard                          I  Adding 1920x1080 Preview Output...
2024-01-15 17:23:25.901   903-1336  CameraSession           com.lisgard                          I  Adding 1280x720 CodeScanner Output in YUV_420_888...
2024-01-15 17:23:25.903   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: Creating Capture Session #20... (Hardware Level: 3
                                                                                                    | Outputs: [PREVIEW (1920 x 1080), VIDEO (1280 x 720 CodeScanner for
                                                                                                    [QR] (35))])
2024-01-15 17:23:25.903   903-1336  CreateCaptureSession    com.lisgard                          I  Using new API (>=28)
2024-01-15 17:23:25.903   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:25.903   903-4645  DynamiteModule          com.lisgard                          I  Considering local module com.google.mlkit.dynamite.barcode:10000 and
                                                                                                    remote module com.google.mlkit.dynamite.barcode:0
2024-01-15 17:23:25.903   903-4645  DynamiteModule          com.lisgard                          I  Selected local version of com.google.mlkit.dynamite.barcode
2024-01-15 17:23:25.907   903-903   PreviewView             com.lisgard                          I  Setting PreviewView Surface Size to 1296 x 2304...
2024-01-15 17:23:25.910   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:25.913   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:25.916   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:25.923   903-903   CameraSession           com.lisgard                          I  PreviewView Surface updated! Surface(name=null)/@0x6fa344a 1920 x 1080
2024-01-15 17:23:26.015   903-1655  BufferQueueProducer     com.lisgard                          E  [ImageReader-1280x720f23m2-903-18](id:3870000002c,api:4,p:1661,c:903) dequeueBuffer: BufferQueue
                                                                                                    has been abandoned
2024-01-15 17:23:26.015   903-1336  CameraDevice-JV-0       com.lisgard                          D  waitUntilIdle: E. id = 0
2024-01-15 17:23:26.016   903-1655  CameraDevice-JV-0       com.lisgard                          W  Device error received, code 3, frame number 0, request ID 0, subseq ID
                                                                                                    0
2024-01-15 17:23:26.066   903-1336  CameraDevice-JV-0       com.lisgard                          D  waitUntilIdle: X
2024-01-15 17:23:26.204   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: Successfully created CameraCaptureSession #20!
2024-01-15 17:23:26.204   903-1336  CameraSession           com.lisgard                          I  Successfully configured Session with 2 outputs for Camera #0!
2024-01-15 17:23:26.206   903-1655  CameraDevice-JV-0       com.lisgard                          W  got error frame 0
2024-01-15 17:23:26.208   903-1667  BpBinder                com.lisgard                          I  onLastStrongRef automatically unlinking death recipients: <uncached
                                                                                                    descriptor>
2024-01-15 17:23:26.210   903-1336  CameraView              com.lisgard                          I  invokeOnStarted()
2024-01-15 17:23:26.211   903-1336  CameraSession           com.lisgard                          I  Successfully updated CameraSession Configuration! isActive: true
2024-01-15 17:23:26.213   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: CameraCaptureSession #19 has been closed.
2024-01-15 17:23:26.362   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:26.365   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:26.369   903-4732  tflite                  com.lisgard                          I  Replacing 43 out of 43 node(s) with delegate
                                                                                                    (TfLiteXNNPackDelegate) node, yielding 1 partitions for the whole
                                                                                                    graph.
2024-01-15 17:23:26.370   903-4732  tflite                  com.lisgard                          I  Replacing 42 out of 47 node(s) with delegate
                                                                                                    (TfLiteXNNPackDelegate) node, yielding 11 partitions for the whole
                                                                                                    graph.
2024-01-15 17:23:26.371   903-4732  native                  com.lisgard                          I  I0000 00:00:1705310606.371340    4732
                                                                                                    oned_decoder_client.cc:695] barhopper::deep_learning::OnedDecoderClient
                                                                                                    is created successfully.
2024-01-15 17:23:26.380   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:26.383   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:26.386   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:26.389   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:26.392   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:26.394   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:27.375   903-1336  CreateCaptureSession    com.lisgard                          I  Camera #0: CameraCaptureSession #18 has been closed.
2024-01-15 17:23:27.375   903-1336  CameraSession           com.lisgard                          I  Camera Session
                                                                                                    android.hardware.camera2.impl.CameraCaptureSessionImpl@2f6a79e has
                                                                                                    been closed.
2024-01-15 17:23:48.610   903-903   MIUIInput               com.lisgard                          D  [KeyEvent] ViewRootImpl KeyEvent
                                                                                                    { action=ACTION_DOWN, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x8, repeatCount=0, eventTime=53337716, downTime=53337716, deviceId=-1, source=0x101, displayId=0
                                                                                                    }
2024-01-15 17:23:48.613   903-903   MIUIInput               com.lisgard                          D  [KeyEvent] ViewRootImpl KeyEvent
                                                                                                    { action=ACTION_UP, keyCode=KEYCODE_BACK, scanCode=0, metaState=0, flags=0x8, repeatCount=0, eventTime=53337716, downTime=53337716, deviceId=-1, source=0x101, displayId=0
                                                                                                    }
2024-01-15 17:23:48.634   903-903   CameraSession           com.lisgard                          I  Closing CameraSession...
2024-01-15 17:23:48.635   903-903   CameraSession           com.lisgard                          I  Destroying session..
2024-01-15 17:23:48.635   903-903   CameraExtImplXiaoMi     com.lisgard                          D  releaseCameraDevice: 0
2024-01-15 17:23:48.635   903-903   CameraDevice-JV-0       com.lisgard                          D  close: E. id = 0
2024-01-15 17:23:48.648   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 4, frame number 673, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.747   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 2
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 3
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 5
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 6
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 7
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 8
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 10
2024-01-15 17:23:48.748   903-4775  libc                    com.lisgard                          W  Access denied finding property "vendor.camera.aux.packagelist"
2024-01-15 17:23:48.748   903-4775  CameraManagerGlobal     com.lisgard                          W  ignore the torch status update of camera: 11
2024-01-15 17:23:48.758   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 10 is not available. Ignore physical camera status change
2024-01-15 17:23:48.758   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 5 is not available. Ignore physical camera status change
2024-01-15 17:23:48.758   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 6 is not available. Ignore physical camera status change
2024-01-15 17:23:48.758   903-903   CameraDevice-JV-0       com.lisgard                          D  close: X
2024-01-15 17:23:48.758   903-903   SurfaceOutput           com.lisgard                          I  Closing BarcodeScanner..
2024-01-15 17:23:48.758   903-1010  CameraManagerGlobal     com.lisgard                          E  Camera 7 is not available. Ignore physical camera status change
2024-01-15 17:23:48.759   903-1296  CameraDevices           com.lisgard                          I  Camera #0 is now available.
2024-01-15 17:23:48.759   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 4, frame number 672, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.759   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 4, frame number 671, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.759   903-903   CameraView              com.lisgard                          I  invokeOnStopped()
2024-01-15 17:23:48.759   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 4, frame number 674, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.759   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 4, frame number 670, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.759   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 670, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.760   903-903   CameraSession           com.lisgard                          I  CameraSession closed!
2024-01-15 17:23:48.760   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 671, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.760   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 671, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.760   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 672, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.760   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 672, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.760   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 673, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.761   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 673, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.761   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 674, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.761   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 5, frame number 674, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.761   903-919   CameraDevice-JV-0       com.lisgard                          W  Device error received, code 3, frame number 675, request ID 1, subseq
                                                                                                    ID 0
2024-01-15 17:23:48.762   903-1363  TransportR...EventStore com.lisgard                          D  Storing event with priority=VERY_LOW, name=FIREBASE_ML_SDK for
                                                                                                    destination cct
2024-01-15 17:23:48.765   903-1363  TransportR...oScheduler com.lisgard                          D  Upload for context
                                                                                                    TransportContext(cct, VERY_LOW, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) is
                                                                                                    already scheduled. Returning...
2024-01-15 17:23:48.853   903-903   CameraSession           com.lisgard                          I  PreviewView Surface destroyed! Surface(name=null)/@0x6fa344a
2024-01-15 17:23:48.853   903-903   CameraSession           com.lisgard                          I  Destroying Preview Output...
2024-01-15 17:23:48.854   903-903   CameraSession           com.lisgard                          I  configure { ... }: Waiting for lock...
2024-01-15 17:23:48.854   903-903   CameraSession           com.lisgard                          I  CameraSession is already destroyed. Skipping configure { ... }
2024-01-15 17:23:48.854   903-903   CameraSession           com.lisgard                          I  Preview Output destroyed!
2024-01-15 17:23:48.855   903-903   SurfaceView             com.lisgard                          D  UPDATE
                                                                                                    Surface(name=SurfaceView[com.lisgard/com.lisgard.MainActivity])/@0xec40cd8, mIsCastMode
                                                                                                    = false
2024-01-15 17:23:48.855   903-903   SurfaceView             com.lisgard                          D  UPDATE
                                                                                                    Surface(name=SurfaceView[com.lisgard/com.lisgard.MainActivity])/@0xec40cd8, mIsProjectionMode
                                                                                                    = false
2024-01-15 17:23:48.855   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:48.855   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:48.856   903-903   SurfaceControl          com.lisgard                          D  nativeSetScreenProjection ===> setScreenProjection
2024-01-15 17:23:48.856   903-903   CameraView              com.lisgard                          I  Updating CameraSession...
2024-01-15 17:23:48.856   903-1336  CameraSession           com.lisgard                          I  configure { ... }: Waiting for lock...
2024-01-15 17:23:48.856   903-1336  CameraSession           com.lisgard                          I  CameraSession is already destroyed. Skipping configure { ... }

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-right",
  "hardwareLevel": "full",
  "maxZoom": 10,
  "minZoom": 1,
  "maxExposure": 12,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": true,
  "isMultiCam": false,
  "minExposure": -12,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Redmi K30 pro

VisionCamera Version

3.7.1

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

hengkx commented 8 months ago

I only have a small portion of the bottom screen black, I'm not sure what the reason is

mrousavy commented 8 months ago

Hm, this is weird. Maybe this is an actual bug in the Redmi phones?

I am not sure - from the logs it looks like it destroys everything properly 🤔

ooxoxx commented 8 months ago

Hm, this is weird. Maybe this is an actual bug in the Redmi phones?

I am not sure - from the logs it looks like it destroys everything properly 🤔

Thanks for your attention. Other camera and qr scanning related apps work properly on this phone. This bug is also reproducible on HONOR Magic4 Pro. What do you suggest to do next?

ooxoxx commented 8 months ago

Is Device error received, code 4 there related to this? surface view is created twice due to the error? That is the only difference in logs between the problem phone and other devices that work.

mrousavy commented 8 months ago

I don't know. I'd need to thoroughly investigate this, preferrably with the device in my hands.

francesco-clementi-92 commented 7 months ago

The bug is reproducible also on a honor x6a

chj-damon commented 7 months ago

I only have a small portion of the bottom screen black, I'm not sure what the reason is

here facing the same problem when taking photos using Redmi K30 or Huawei Honor

also, it will leave a black screen after navigating to other screen when qr code is scanned.

mrousavy commented 7 months ago

Working on a fix for this issue here: https://github.com/mrousavy/react-native-vision-camera/pull/2494 👀

Still in development, so don't test yet. Long way to go, this is a really complicated issue (as you can see in the changes/Files of that PR)...

mrousavy commented 7 months ago

Just released VisionCamera 3.9.0-beta.1, which includes the big PersistentCaptureSession PR that aims to fix all the blackscreen issues.... :eyes::tada:

You can try that new beta out yourself and let me know if you still encounter blackscreen issues. I'll continue to test on more devices in the meantime, organize the code a bit better, and then I'll tackle the preview stretching, focus, and flash issues!

If that fixes the blackscreen issues for you, please consider sponsoring me on GitHub to say thanks! ❤️