Camera X accessing wide angle camera

100 views
Skip to first unread message
Assigned to tonyt...@google.com by tah...@google.com

Pratham Kumar Jha

unread,
Nov 28, 2025, 7:01:15 AMNov 28
to Android CameraX Discussion Group
Hi guys I currently access the wide angle camera on devices using the following method: 

private fun findWideAngleCamera(manager: CameraManager): String? {
        var wideAngleCameraId: String? = null
        var widestFieldOfView = 0f

        try {
            val cameraIds = manager.cameraIdList
            for (cameraId in cameraIds) {
                val characteristics = manager.getCameraCharacteristics(cameraId)

                val lensFacing = characteristics.get(CameraCharacteristics.LENS_FACING)
                val sensorInfo =
                    characteristics.get(CameraCharacteristics.SENSOR_INFO_PHYSICAL_SIZE)
                val focalLengths =
                    characteristics.get(CameraCharacteristics.LENS_INFO_AVAILABLE_FOCAL_LENGTHS)
                val minimumFocusDistance =
                    characteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE)

                if (lensFacing == CameraCharacteristics.LENS_FACING_BACK &&
                    sensorInfo != null &&
                    focalLengths != null &&
                    minimumFocusDistance != null
                ) {
                    val fieldOfView = calculateFieldOfView(sensorInfo, focalLengths)
                    if (fieldOfView > widestFieldOfView) {
                        widestFieldOfView = fieldOfView
                        wideAngleCameraId = cameraId
                    }
                }
            }
        } catch (e: CameraAccessException) {
            e.printStackTrace()
        }

Now this works on some devices but on others I only get 1 camera in the list even when wide angle camera is present on the device.

1. Any better method to access the wide angle camera on these devices?
2. Could I use the getMinZoomRatio to set zoom below 1 on these devices to use wide angle camera?

tonyt...@google.com

unread,
Dec 2, 2025, 2:09:52 AMDec 2
to Android CameraX Discussion Group, prath...@paralleldots.com
There are two ways for a device to expose a wide-angle lens - as a standalone camera or as part of a logical camera. Your implementation only works for standalone cameras and yes, you will probably get 1 logical camera on other devices. The suggested way to access the wide-angle lens in a logical camera is by setting zoom ratio. Usually, setting a zoom ratio less than 1 switches to the wide-angle lens. Note that, the exact value that switches the lens depends on the device implementation, so setting the value of getMinZoomRatio should be the most reliable way.

Pratham Kumar Jha

unread,
Dec 2, 2025, 2:22:11 AMDec 2
to Android CameraX Discussion Group, tonyt...@google.com, Pratham Kumar Jha
I have checked on Motorola Edge 40 and I neither get the wide angle camera as a standalone camera and the minZoomRatio is 1.0 as well, does that mean that the device is not exposing it's wide angle to my app?

tonyt...@google.com

unread,
Dec 2, 2025, 2:49:34 AMDec 2
to Android CameraX Discussion Group, prath...@paralleldots.com, tonyt...@google.com
What does CameraCharacteristics.getPhysicalCameraIds return for that camera? If it contains multiple IDs, you may use CameraManager.getCameraCharacteristics with the physical IDs to check individual focal length of the lenses.

Pratham Kumar Jha

unread,
Dec 2, 2025, 3:12:35 AMDec 2
to Android CameraX Discussion Group, tonyt...@google.com, Pratham Kumar Jha
But according to the documention, I won't be able to switch to any cameras that are not part of  CameraManager.getCameraIdList() right?

Reference

tonyt...@google.com

unread,
Dec 2, 2025, 3:24:21 AMDec 2
to Android CameraX Discussion Group, prath...@paralleldots.com, tonyt...@google.com
Correct, but you can still get its characteristics by CameraManager.getCameraCharacteristics even it's not on `getCameraIdList`. This is just to check how the device exposes the lens. I don't have a Edge 40 to test now, but from what you described, it's possible that the device doesn't expose the wide-angle lens.

Qasim Abdani

unread,
Dec 2, 2025, 5:02:20 AMDec 2
to tonyt...@google.com, Android CameraX Discussion Group, prath...@paralleldots.com
  Hi, if a device does not expose the wide-angle camera, how can we access it? The default Camera app does show the wide-angle lens, but explaining this behavior to the client is difficult.
Also, on devices like Redmi and Oppo, if the vendor blocks access, how can we obtain the camera physical IDs?  

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/ce0bda2c-e442-422a-8fad-1cb2339a927bn%40android.com.

tonyt...@google.com

unread,
Dec 2, 2025, 7:49:36 AMDec 2
to Android CameraX Discussion Group, qasimab...@gmail.com, Android CameraX Discussion Group, prath...@paralleldots.com, tonyt...@google.com
Even if a camera is not on CameraManager.getCameraIdList, it can still have a camera ID and be contained in another logical camera. Unfortunately, if a camera is not on getCameraIdList nor belongs to a logical camera, currently there's no way for CameraX to access it. However, IIRC this should be a rare case. So if we identify one of these devices, we are happy to investigate further and see if there's a solution.

Qasim Abdani

unread,
Dec 2, 2025, 7:57:50 AMDec 2
to tonyt...@google.com, Android CameraX Discussion Group, prath...@paralleldots.com
hi tony,
Devices like Redmi Note 10 or any device support wide angle whose manufacture must be Redmi or Oppo
Reply all
Reply to author
Forward
0 new messages