Using Camera2 with physical lenses does not show all lenses on all phones

37 Views Asked by At

I have tried using camera2 with physical lenses to allow the users to access all lenses of the phone, it works perfectly fine on phones like Pixel and S23Ultra, it does not work on other devices which is expected. I use an application called Protake(free app on google play) to assess my work. This app obviously uses Camera2 with physical lenses. On the phone OnePlus8 it shows an extra lens that I can't find when using my implementation on with camera2 which works well on other devices as I mentioned.

I am using the same code for camera2 from the google repo except for the physical lenses ids part I get the ids form the

cameraCharacteristics.physicalCameraIds

I am not sure if I am missing something. Or is it that Protake is using a private api that is granted to them from OnePlus?

2

There are 2 best solutions below

0
Eddy Talvala On

If you haven't, check what the full list of camera IDs is at the top level.

While Android is trying to push manufacturers to use the logical / physical camera IDs to model multi-sensor cameras, not all OEMs are yet onboard, and have a variety of custom solutions for their devices.

That could involve extra camera IDs where IDs > 1 map to specific image sensors; these could also be hidden from the ID listing you get (but possibly visible in the camera service debugging information available via adb shell dumpsys media.camera). Or some devices do implement automatic switching between sensors when zooming, but do not implement physical camera APIs for direct access to specific cameras. This presumably isn't the case for OnePlus8, since other apps have found a path to access.

It could also involve vendor-specific capture request settings, though that seems a bit less likely for this kind of feature.

2
Antonio Lopes On

I don't think OnePlus gives you access to all lenses.

I've worked with some OnePlus phones (OnePlus 9/Pro) and we were trying to setup our application with the ultrawide lens. OnePlus devices were not listing the ultrawide even though they have ultrawide access on their native camera app. I can also confirm that the automatic switching between lenses when setting zoom did not allow ultra wide lens access (for example if you started in wide lens and changed zoom to get to ultra wide zoom ranges).

I came across this article that was helpful. Quoting:

OnePlus devices: Physical setup that doesn’t expose ultrawide to our app, does expose ultrawide to OpenCamera. Ultrawide works in native camera app.

Meaning theres some kind of whitelisting that needs to happen.