Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 11 camera stretched 🐛 #2631

Closed
3 of 5 tasks
GioMaugeri opened this issue Mar 5, 2024 · 9 comments
Closed
3 of 5 tasks

Android 11 camera stretched 🐛 #2631

GioMaugeri opened this issue Mar 5, 2024 · 9 comments
Labels
🐛 bug Something isn't working

Comments

@GioMaugeri
Copy link

GioMaugeri commented Mar 5, 2024

What's happening?

Hi,

I'm using react-native-vision-camera on my app and I noticed that the camera in android 11 is stretched, but not in android 13. I'm using version 3.9.0 of the package.

I noticed that if use the component in this way for example:

<Camera device={device} isActive={true} style={{width: 500, height: 500}} />

And I change the height and I save, the camera is ok, but when I close it and I reopen it is again stretched.

I also installed the shadow lens app suggested in readme and I found the same error if can help.

(I'm trying to make the error happens in the example app, but I'm having starting the project, I'm trying to resolve it. If you need to check the error you can check in the shadow lens app)

Can you help me with that?

Thanks.

Reproduceable Code

<Camera
    codeScanner={codeScanner}
    style={StyleSheet.absoluteFill}
    device={device}
    isActive={true}
    audio={false}
    photo={false}
    video={false}
    onTouchEnd={() => setEnableOnCodeScanned(true)}
 />

Relevant log output

03-05 10:44:34.043 13319 13319 I PreviewView: Creating PreviewView...
03-05 10:44:34.044 13319 13319 I PreviewView: PreviewView is 0x0, rendering 1411x720 content (LANDSCAPE_LEFT). Resizing to: 0x0 (COVER)
03-05 10:44:34.044   728 23194 E qdmetadata: paramType 2048 not supported
03-05 10:44:34.045 13319 13319 I CameraView: Updating CameraSession...
03-05 10:44:34.047 13319 16938 I CameraSession: configure { ... }: Waiting for lock...
03-05 10:44:34.047 13319 16938 I CameraSession: configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
03-05 10:44:34.047 13319 16938 I CameraSession: Configuring inputs for CameraSession...
03-05 10:44:34.047 13319 16938 D PersistentCameraCaptureSession: --> setInput(0)
03-05 10:44:34.048 13319 16938 I CameraSession: Destroying previous outputs...
03-05 10:44:34.048 13319 16938 I CameraSession: Creating outputs for Camera #0...
03-05 10:44:34.052 13319 16938 I CameraSession: Adding 1280x720 CodeScanner Output in YUV_420_888...
03-05 10:44:34.052 13319 17271 W DynamiteModule: Local module descriptor class for com.google.mlkit.dynamite.barcode not found.
03-05 10:44:34.053 13319 16938 D PersistentCameraCaptureSession: --> setOutputs([VIDEO (1280 x 720 CodeScanner for [QR, EAN_13] (35))])
03-05 10:44:34.053 13319 16938 I CameraSession: Successfully configured Session with 1 outputs for Camera #0!
03-05 10:44:34.053 13319 16938 D PersistentCameraCaptureSession: --> setRepeatingRequest(...)
03-05 10:44:34.053 13319 16938 D PersistentCameraCaptureSession: --> setIsActive(false)
03-05 10:44:34.053 13319 16938 D PersistentCameraCaptureSession: Configure() with isActive: false, ID: 0, device: null, session: null
03-05 10:44:34.053 13319 16938 I PersistentCameraCaptureSession: Creating new device...
03-05 10:44:34.053 13319 16938 I CameraManager: Camera #0: Opening...
03-05 10:44:34.053 13319 13319 W sionCamera.main: type=1400 audit(0.0:20234265): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=19384 scontext=u:r:untrusted_app:s0:c99,c258,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0
03-05 10:44:34.059   728 23194 E qdmetadata: paramType 2048 not supported
03-05 10:44:34.060 13319 16938 E libc    : Access denied finding property "persist.vendor.camera.privapp.list"
03-05 10:44:34.061   980 28813 I CameraService: CameraService::connect call (PID -1 "com.halog", camera ID 0) for HAL version default and Camera API version 2
03-05 10:44:34.061   980 28813 I Camera2ClientBase: Camera 0: Opened. Client: com.halog (PID 13319, UID 10611)
03-05 10:44:34.062   980 28813 I CameraDeviceClient: CameraDeviceClient 0: Opened
03-05 10:44:34.062 13319 17128 D TransportRuntime.SQLiteEventStore: Storing event with priority=DEFAULT, name=FIREBASE_ML_SDK for destination cct 
03-05 10:44:34.064   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: unbindService is called for service : com.google.android.gms/.chimera.PersistentApiService and for client com.halog
03-05 10:44:34.064   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: size of client connections for client: com.halogafter removal is 2
03-05 10:44:34.066  1337  2123 I ActivityTaskManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.google.android.permissioncontroller cmp=com.google.android.permissioncontroller/com.android.permissioncontroller.permission.ui.GrantPermissionsActivity (has extras)} from uid 10611
03-05 10:44:34.066  1337  1359 D EventSequenceValidator: Transition from ACTIVITY_CANCELLED to INTENT_STARTED
03-05 10:44:34.066  1337  2123 V ActivityTaskManager: Calling mServicetracker.OnActivityStateChange with flag falsestateINITIALIZING
03-05 10:44:34.066   980 28813 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=0
03-05 10:44:34.066  1337  2123 V ActivityTaskManager: Calling mServicetracker.OnActivityStateChange with flag truestateINITIALIZING
03-05 10:44:34.066   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: Activity state is changed to : 0
03-05 10:44:34.067   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: Activity state is changed to : 0
03-05 10:44:34.067  2207  7214 E CameraManagerGlobal: Camera 61 is not available. Ignore physical camera status change
03-05 10:44:34.053 13319 13319 W Binder:13319_6: type=1400 audit(0.0:20234266): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=19384 scontext=u:r:untrusted_app:s0:c99,c258,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0
03-05 10:44:34.067   718  4484 I QCamera : <HAL><INFO> cameraDeviceOpen: 477: Open camera id 0 API version 768
03-05 10:44:34.068 13319 17423 E libc    : Access denied finding property "vendor.camera.aux.packagelist"
03-05 10:44:34.068   714 10099 D audio_hw_primary: adev_set_parameters: enter: cameraFacing=back
03-05 10:44:34.068   714 10099 D audio_hw_hfp: hfp_set_parameters: enter
03-05 10:44:34.068   714 10099 D audio_hw_hfp: hfp_set_parameters: enter
03-05 10:44:34.068   714 10099 D audio_hw_extn: audio_extn_fm_set_parameters: Enter
03-05 10:44:34.068   714 10099 D audio_hw_hfp: hfp_set_parameters: enter
03-05 10:44:34.068   714 10099 D wt_audio_cust: wt_audio_mmi_setparameter: enter: cameraFacing=back
03-05 10:44:34.068 13319 17423 E CameraManagerGlobal: Camera 61 is not available. Ignore physical camera status change
03-05 10:44:34.068   714 10099 E wt_audio_cust: wt_audio_mmi_setparameter mmi test -2
03-05 10:44:34.068   714 10099 D audio_hw_primary: mmi status = -2
03-05 10:44:34.069 13319 17423 E libc    : Access denied finding property "vendor.camera.aux.packagelist"
03-05 10:44:34.053 13319 13319 W Binder:13319_6: type=1400 audit(0.0:20234267): avc: denied { read } for name="u:object_r:vendor_persist_camera_prop:s0" dev="tmpfs" ino=19384 scontext=u:r:untrusted_app:s0:c99,c258,c512,c768 tcontext=u:object_r:vendor_persist_camera_prop:s0 tclass=file permissive=0
03-05 10:44:34.070   718  4484 E QCamera3HWI: [zwq] is_face_unlock 0
03-05 10:44:34.071 13319 17271 I DynamiteModule: Considering local module com.google.android.gms.vision.barcode:0 and remote module com.google.android.gms.vision.barcode:240713000
03-05 10:44:34.071 13319 17271 I DynamiteModule: Selected remote version of com.google.android.gms.vision.barcode, version >= 240713000
03-05 10:44:34.071   718  4484 E libc    : Access denied finding property "persist.camera.third_algo.info"
03-05 10:44:34.071 13319 17271 V DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
03-05 10:44:34.071   718  4484 I MiAILab : scene_classify::init called
03-05 10:44:34.071   718  4484 I MiAILab : scene_classify::set = 3
03-05 10:44:34.072   718  4484 E libc    : Access denied finding property "persist.camera.third_algo.info"
03-05 10:44:34.072  1337  2123 D CompatibilityInfo: mCompatibilityFlags - 0
03-05 10:44:34.072  1337  2123 D CompatibilityInfo: applicationDensity - 320
03-05 10:44:34.072  1337  2123 D CompatibilityInfo: applicationScale - 1.0
03-05 10:44:34.072  1337  2123 V ActivityTaskManager: Calling mServicetracker.OnActivityStateChange with flag truestateRESUMED
03-05 10:44:34.063   718   718 W HwBinder:718_5: type=1400 audit(0.0:20234268): avc: denied { read } for name="u:object_r:default_prop:s0" dev="tmpfs" ino=19211 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=0
03-05 10:44:34.073   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: Activity state is changed to : 2
03-05 10:44:34.073   718  4484 E libc    : Access denied finding property "persist.camera.third_algo.info"
03-05 10:44:34.073   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 828: AV timer enabled: 0
03-05 10:44:34.073  1337  2123 V ActivityTaskManager: Calling mServicetracker.OnActivityStateChange with flag truestatePAUSING
03-05 10:44:34.073  1337  2123 D ActivityTrigger: ActivityTrigger activityPauseTrigger
03-05 10:44:34.073   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: Activity state is changed to : 3
03-05 10:44:34.074  1337  2123 V ActivityTaskManager: Calling mServicetracker.OnActivityStateChange with flag falsestatePAUSING
03-05 10:44:34.075   779 11579 I vendor.qti.hardware.servicetracker@1.2-service: Activity state is changed to : 3
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 864: Sensor support Quadra CFA mode in sensor cqfa 0
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 869: Sensor support HW Quadra CFA mode
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 936: XIAOMI_MIFRAGMENT init
03-05 10:44:34.077   718  4484 I VIDHANCE_PLATFORM: Vidhance version: [3.3.3 (default)]
03-05 10:44:34.077   718  4484 D android.hardware.camera.provider@2.4-service: sensorName:0 gyro name:0
03-05 10:44:34.077   718  4484 I android.hardware.camera.provider@2.4-service:  set device_name for vidhance: 0_0
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 976: VidHance QCamera3HardwareInterface init VidhancePlatform   
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 977: VidHance ActiveSize width:4000, height:3000
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 978: VidHance FullSize width:4000, height:3000
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 979: VidHance PhysicalSize width:4000, height:536870912
03-05 10:44:34.077   718  4484 I QCamera : <HAL><INFO> QCamera3HardwareInterface: 980: VidHance meta.PhysicalSize width:4000, height:536870912    
03-05 10:44:34.077 13319 13319 I CameraView: Updating CameraSession...
03-05 10:44:34.081 13319 16941 I CameraDevices: Camera #0 is now unavailable.
03-05 10:44:34.082   718  4484 I QCamera : <HAL><INFO> openCamera: 1534: [KPI Perf]: E PROFILE_OPEN_CAMERA camera id 0
03-05 10:44:34.082   980 28813 I CameraProviderManager: Camera device device@3.4/legacy/0 torch status is now NOT_AVAILABLE
03-05 10:44:34.083   980 28813 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=0
03-05 10:44:34.083   718  4484 D QCamera : Debug log file is not enabled
03-05 10:44:34.083   718  4484 E mm-camera: client_name com.halog all_log_disable 0
03-05 10:44:34.083   718  4484 I mm-camera: <MCT   >< INFO> 118: mct_controller_new: Creating new mct_controller with session-id 3
03-05 10:44:34.083 13319 17128 D TransportRuntime.JobInfoScheduler: Scheduling upload for context TransportContext(cct, DEFAULT, MSRodHRwczovL2ZpcmViYXNlbG9nZ2luZy5nb29nbGVhcGlzLmNvbS92MGNjL2xvZy9iYXRjaD9mb3JtYXQ9anNvbl9wcm90bzNc) with jobId=-1388044066 in 898979ms(Backend next call timestamp 1709632773061). Attempt 1
03-05 10:44:34.085  1337  1359 D EventSequenceValidator: Transition from INTENT_STARTED to ACTIVITY_LAUNCHED
03-05 10:44:34.085   718 17455 I mm-camera: <MCT   >< INFO> 5264: mct_pipeline_start_session_thread: E sensor
03-05 10:44:34.085   718 17455 I mm-camera: <MCT   >< INFO> 5271: mct_pipeline_start_session_thread: Calling start_session on Module sensor       
03-05 10:44:34.086   718 17460 I mm-camera: <MCT   >< INFO> 5264: mct_pipeline_start_session_thread: E iface
03-05 10:44:34.086   718 17460 I mm-camera: <MCT   >< INFO> 5271: mct_pipeline_start_session_thread: Calling start_session on Module iface        
03-05 10:44:34.086 13319 13319 I PreviewView: PreviewView is 720x1211, rendering 1411x720 content (LANDSCAPE_LEFT). Resizing to: 2373x1211 (COVER)
03-05 10:44:34.086   718 17460 I mm-camera: <MCT   >< INFO> 5274: mct_pipeline_start_session_thread: Module iface start_session rc = 1
03-05 10:44:34.086   718 17460 I mm-camera: <MCT   >< INFO> 5282: mct_pipeline_start_session_thread: started_num = 1, success = 1
03-05 10:44:34.086   718 17460 I mm-camera: <MCT   >< INFO> 5289: mct_pipeline_start_session_thread: X iface

Camera Device

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

Device

Xiaomi Mi A3

VisionCamera Version

3.9.0

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

@GioMaugeri GioMaugeri added the 🐛 bug Something isn't working label Mar 5, 2024
@frenbergFNX
Copy link

Did you try 3.9.1? There might be a fix for this issue in there but I have not verified my self. Had same issue on android 10 device

@GioMaugeri
Copy link
Author

Did you try 3.9.1? There might be a fix for this issue in there but I have not verified my self. Had same issue on android 10 device

Yes I tried but I got same error

@oscar-b
Copy link

oscar-b commented Mar 5, 2024

#2583

@vincenzoiacovone
Copy link

I'm using class component
Tired of trying and trying workarounds, version changes, debugging..
Sure that after the first rendering all works well..
Switch on caveman mode:

added this style in the Camera component:

    style={{
        ...StyleSheet.absoluteFill,
        width: Dimensions.get('screen').width,
        height: Dimensions.get('screen').height + this.state.update,
      }}

and this in componentDidMount:

    let context = this;
    setTimeout(function () {
      context.setState({update: 1});
    }, 500);

@frenbergFNX
Copy link

frenbergFNX commented Mar 5, 2024

    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

@GioMaugeri
Copy link
Author

    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

This worked also for me both for android 11 and android 13 thanks.

@GioMaugeri
Copy link
Author

GioMaugeri commented Mar 6, 2024

    const [hack, doHack] = useState(0);

    return (
	    <Camera
		    ref={cameraRef}
		    onInitialized={() => doHack(1)}
		    style={[StyleSheet.absoluteFill, { width: width + hack }]}

This is working on a functional component 👍 (I've tested on samsung galaxy s10 with Android 10 and Oneplus 7 running Android 12) 🎉

I covered the component that contains the camera with a condition of a boolean value, but with this trick now the app sometimes crash.

This is the code that call the component:

{cameraVisibile && <ScannerScreen onChangeCameraVisible={onChangeCameraVisible} onQrCheck={onQrCheck} />}

And this is the component of before:

<Camera
       codeScanner={codeScanner}
       device={device}
       isActive={true}
       audio={false}
       photo={false}
       video={false}
       onInitialized={() => setHack(1)}
       style={[StyleSheet.absoluteFill, {width: Dimensions.get('screen').width + hack}]}
       onTouchEnd={() => setEnableOnCodeScanned(true)}
     />

There isn't also a way to disable the camera component without create each time a new component? Or a way to resolve in my way, with an external value?

@mrousavy
Copy link
Owner

mrousavy commented Mar 6, 2024

Duplicate of #2583

@mrousavy mrousavy marked this as a duplicate of #2583 Mar 6, 2024
@mrousavy mrousavy closed this as completed Mar 6, 2024
@ShreyasSathyanarayana
Copy link

the hack is working, I was also facing the same issue. Tq for the help..........

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants