Camera & Camera2 API - missing features & bugs

I totally agree with your issues mentioned here! Especially accessing the ToF sensor would be nice to have, so we could have rudimentry night vision.

7 Likes

Thank you @Razem: Great description of the problem. I hope that the Fairphone Team does also a good job by fixing this issues.

1 Like

Are there any new updates from support?

1 Like

Unfortunately not yet. I’ll definitely update the post as soon as I get any update.

4 Likes

Any information on this topic, at least to keep this item alive?

2 Likes

Nothing so far, unfortunately. I’ll try to urge the support again.

2 Likes

Also adding that Info here: Apps need SYSTEM_CAMERA permissions to access the full feature set. This is only possible for apps on the system partition with correct permissions. Therefore app like Camera2 API Probe cannot see all features.
https://source.android.com/devices/camera/system-cameras

Not sure why it was done that way. Most user friendly way would probably be to drop the SYSTEM_CAMERA requirement.

For custom Roms it should still be possible to grant that permission and access all features.

1 Like

It sounds to me like Google is intentionally making the use of alternative camera apps unattractive. This way, the Google smartphones (with stock ROM!) are even better off with their photo quality than they already are. So you have no chance to get the Google quality/functions with a custom ROM and e.g. gcam port on their smartphones. Using gcam port with other manufacturers (with or without custom ROM) of course leads to the same problem. Sometimes people want to use a gcam port although they have a stock ROM, because manufacturers other than Google often cannot match their quality. This might indirectly push one or the other customer to buy a Google smartphone.

Yes, that’s precisely how it’s currently implemented. The point is that it doesn’t have to be this way. And the key is indeed to drop the SYSTEM_CAMERA permission requirement, i.e., make the wide lens camera a regular camera instead of a system camera. Which Fairphone can do.

Also I have a new update from the support team. I hope it will be done soon.

Indeed, we have been working on this request for some time already. I have discussed this again with the relevant department and we have agreed to heighten the priority in order to resolve this faster. As soon as I know more in terms of timeline, I will be happy to let you know.

8 Likes

Yes, dropping the permission would be best.

If it’s not done, at least for custom Roms it would be best to patch Android to just ignore that permission and provide it to all apps - not sure how hard that is. Maybe such a change would make sense for Linage OS in general.

The stock FPCamera app unfortunately is still not working without crashes if integrated in custom ROMs. But it’s able to access all cameras, when installed as SYSTEM_CAMERA app. I decompiled the camera app and now I’m trying to get behind some of the causes with remote debugging in Android Studio. But that’s time intensive and the learning curve for that is quite steep …

8 Likes

So the stock FPCamera App can come around all these missing features / bugs?
Or only accessing all camera lenses?

In general - if I get that right:

  • all non-stock apps (Open Camera, GCam Ports, etc. …) have the described problems, as they use the Camera2 API and
  • there are bugs in it for the FP Camera(s) Fairphone needs to fix, right?
  • So is this a closed source component (of the phone’s firmware)?
  • What is the stock FPCamera doing differently? How does it access the Camera’s?
  • How is /e/-OS dealing with it - as there is an official partnership?

As far as I can see, this was reported a while ago and the problem is well described by @Razem in the first post.

  • Is there any way the community can push this / push Fairphone to fix this?

I imagine they have heard the chatter and are doing all they can.

/e/-OS includes a modified version of OpenCamera that is installed as part of the system and has the SYSTEM_CAMERA permission. Only with that permission it’s possible to use the Wide Angle camera. e / os / Camera · GitLab

User-installed camera apps are unable to use the wide angle camera. That’s not really a bug but was done that way by design. Not sure how common this is. On a Pixel Phone, can third party apps use auxiliary cameras?

The part that defines which camera is a system camera is closed source, unfortunately. Fairphone should change this to make everything accessible by all apps.

Another thing is that some open source Android components seem to be modified with Fairphone specific proprietary extensions (i.e. libcameraservice from camera · ks-aosp.lnx.3.0.r4-rel · CodeLinaro / la / platform / frameworks / av · GitLab). Fairphone could release that modifications as open source, but due to Apache 2.0 License there is no obligation, unfortunately. That mostly matters for custom roms.

5 Likes

I assume when many unhappy people contact them, they might work on this (faster)…so I would say contactsupport

3 Likes

Thanks @xblax for the details.

Only point I don’t get which seems to be not answered to me is:
Does the e / os / camera have all the other issues/bugs described here apart from the possibility to use the wide angle camera?

In general to deal with that, as long as it not fixed by Fairphone:
Why not using the “e / os / camera” and transform it to a system app for now? (also for other custom roms)
I know there are people which prefer the Gcam (or the ports) in regards of the photo quality, but still, I think Open Camera is a good camera app, which fits, at least to my needs. So is there a place where one can get the “e / os / camera” as apk or do I need to create an APK on my own out of the code in GitLab (never did that up to now but I’m willing to find out)?

@yvmuell

Will do. :wink:

Hi @Smojo

Does the e / os / camera have all the other issues/bugs described here apart from the possibility to use the wide angle camera?

I have not tried e-/os/ myself. But all third party camera apps do not get access to the full 16MP resolution - that is definitely a bug. I also tried GrapheneOs Camera which uses CameraX instead of using Camera2 APIs directly - only ~12MP.

At the moment I cannot say if that is due to missing SYSTEM_CAMERA permission or not. I will try to find out.

Might also be related to another “feature” in the Camera implementation. Basically there’s a check which camera app uses the camera APIs. If it’s the stock camera app it uses a different capture pipeline.

On custom roms we could theoretically force to use the Fairphone pipelines for all apps, but for example the stock AOSP camera app crashes immediately then.

Not sure what’s the reason behind this. I found some references to other Qualcomm based phones doing the same. Don’t think that comes from Qualcomm but rather from the ODM which does the camera integration.

Here is a discussion in German that indicates that with #leos the wide angel lense is accessible e.g. with BigKaka Gcam port and the statement is “it works because its a GSI ROM based on PHH Treble with treble settings phhusson. The advantage of GSIs is that they use the standard kernel what allows to use all OEM funtions…” (no idea if this is correct or what it really means but maybe it helps to troubleshoot this).

3 Likes

I’ve had a look at that before, but still couldn’t make wideangle work on non stock, not even for the FPCamera (then again, not a developer, just randomly trying things… ).

For people who want to take a look, the settings app is here, relevant code likely here:

MiscSettings.multiCameras -> {
    val value = sp.getBoolean(key, false)

    safeSetprop("persist.sys.phh.include_all_cameras", if(value) "true" else "false")
    if (value ||
            SystemProperties.get("vendor.camera.aux.packagelist", null) == null ||
            SystemProperties.get("camera.aux.packagelist", null) == null) {
        safeSetprop("vendor.camera.aux.packagelist", if (value) "nothing" else null)
        safeSetprop("camera.aux.packagelist", if (value) "nothing" else null)
        safeSetprop("ctl.restart", "vendor.camera-provider-2-4")
        safeSetprop("ctl.restart", "camera-provider-2-4")
        safeSetprop("ctl.restart", "cameraserver")
    }
}
MiscSettings.forceCamera2APIHAL3 -> {
    val value = sp.getBoolean(key, false)
    val defValue = "0"
    val newValue = if (value) "1" else defValue

    if (value ||
            SystemProperties.get("persist.vendor.camera.HAL3.enabled", defValue) != newValue ||
            SystemProperties.get("persist.vendor.camera.eis.enable", defValue) != newValue) {
        safeSetprop("persist.vendor.camera.HAL3.enabled", newValue)
        safeSetprop("persist.vendor.camera.eis.enable", newValue)
        Log.d("PHH", "forced Camera2API HAL3 to $value")
        // Restart services
        safeSetprop("ctl.restart", "vendor.camera-provider-2-4")
        safeSetprop("ctl.restart", "camera-provider-2-4")
    }
}
2 Likes

Thanks @yvmuell interesting infos.

Had to update myself about this topic (Treble) again.

  • DSI - Generic System Image
  • Phhusson is a developer

So the project exist since Android 8 - Oreo (https://apilevels.com/).
So do all the custom roms (except #leos) still skip / ignore it?

I think the relevant code in that GSI rom is that change here:

If the property is enabled it then treats the camera as public and ignores that the HAL flagged the camera as system only.

I tried various Camera Apps and patched them to have SYSTEM_CAMERA permission (GrapheneOs, Camera2 Api Prober, Open Camera). Only Open Camera then detects the Wide Angle Camera, for the other apps there appears to be no change.

Open Camera can use the full 4000x3000 resolution, even without SYSTEM_CAMERA permission.

In the Android documentation I found this:

Starting from API level 29:

Some or all physical cameras may not be independently exposed to the application, in which case the physical camera IDs will not be available in CameraManager.getCameraIdList(). But the application can still query the physical cameras’ characteristics by calling CameraManager.getCameraCharacteristics(String).

Maybe the wide angle lens is not exposed at all via Camera2? But OpenCamera somehow detects it, which the other apps can’t.

Also interesting: in OpenCamera 4000x3000 resolution is listed as not “Burst” capable. So maybe the other apps only request burst capable modes?

Unless Fairphone improves how Cameras and Modes are exposed it’s probably our best option to get the Stock camera fully functional on custom roms.

7 Likes