androidandroid-camera2

How to know if a physical lens is supporting REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR, is it even possible?


I am developing an application that requires getting some physical lenses, the app is made for a pixel phone, which only gives the user one lens on the rear side, so I needed to fetch the physical lenses and that worked fine. I now need to control its manual focus, I was able to get 2 lenses on the rear side, one of them clearly supports manual focus change and the other does not. My question is how to know that the second physical lens does not support REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR.

I can't use

val isManualFocusSupported = characteristics.get(
        CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES
    )?.contains(
        CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)

Because this works for the whole real logical camera and will always return true.


Solution

  • According to documentation you can query the capabilities of physical cameras that can only be used as part of logical multi-camera from API 29.

    https://developer.android.com/reference/android/hardware/camera2/CameraManager#getCameraCharacteristics(java.lang.String)