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")
}
}
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.
Edited the last post because it was not fully correct: With SYSTEM_CAMERA permission Open Camera v1.50.1 appears to be fully functional, even in Camera2 mode it can access the Wide Angle Lens and full resolution.
It’s accessed in the UI differently than in Legacy API Mode which got me confused.
You are completely right, that’s the more relevant part of code. I was referring to the code in the settings app that lets you toggle it (which didn’t get me very far with my own experiments).
Interestingly enough, the commit you linked is dated July 16th, but we have reports of a working wide-angle lens on LeOS from June, so as always with Camera2, it’s complicated
That’s probably the best interim solution, but you seem to make great progress here, keep up the good work
Dump question from someone less experienced than you guys: How to you “patch” the camera apps? Where exactly is the SYSTEM_CAMERA permission set? Or is this equal to install the Camera Apps as system app? EDIT: source.android.com - docs - system-cameras
Open Camera can use the full 4000x3000 resolution, even without SYSTEM_CAMERA permission.
4000x3000 is 12MP (and yes Open Camera shows this as max resolution, also without modification/patching or after a normal installation), while the cameras have 48MP in the specs - afaiu. Or is this the “Pixel Binning” I read about (best of 4 Pixels will be taken), which reduces the 48-Megapixel-photos to 12 Megapixel?
(default Camera of CalyxOS - package com.android.camera2 - also shows 12MP as max resolution but I only see one back camera in settings.)
After these facts, why it the overall interim conclusion to use the Stock camera or make it working?
The 12MP resolution (4000x3000) is accessible when using the old camera API. When using Camera2, it tops at 3952x1824 for some unknown reason. The primary sensor (IMX582) is actually capable of taking 48MP (8000x6000) photos, as seen in the stock camera app. The same applies to the selfie camera (IMX576), which is capable of taking 24MP (5760×4312) photos. The ultra-wide sensor is advertised as 48MP (I can’t find the exact sensor number), but I guess it uses binning, so you can’t really get a 48MP photo out of it, only 12MP.
The permission must be declared in the AndroidManifest.xml of the APK. This is where existing APKs need to be patched or compiled with the change. See
Then the app must be installed in /system/priv-app (or on the vendor partition). It must also be granted the system camera in /system/etc/permissions. For the stock camera we add privapp-permissions-com.fp.camera.xml
And last the camera package name must also be whitelisted in vendor.camera.aux.packagelist property. It’s easier to disable that property so that it’s empty. Then all apps are allowed if they fulfill the other requirements …
Camera2 from AOSP shows 12MP in the settings, but the captured image is not. I didn’t try modify if for SYSTEM_CAMERA permission. Also don’t know if it supports aux cameras at all.
I believe 12MP is the intended native resolution of the sensor. The “high res” 48mp images are probably only available in a special capture mode. Afaik that is a function of the Qualcomm camera HAL but the camera Apps need special support for it.
Because it implements all the features like High Res, Timelapse, Slomo etc and it can be extracted from the stock images like the other blobs. Usability is easier than for OpenCamera. Also I think it’s probably the best baseline for custom ROMs to see what features are working and which are not.
…
I will be unable to provide you further help regarding alternative/custom OS, but you can find some tips on … → links to the FP Forum and the e Forum for Fairphones …
We will take your feedback into consideration for our future developments.
We appreciate your response as it is very helpful for us and it gives a good insight into the wishes and needs of our community.
…
Thats it → pretty much a standard response, but I think it doesn’t make sense to bother them further, as they are already aware of the problem and they just got another feedback from a user who would like to get this fixed. → which is/was the intention here.
The problem is, when you mention somehow custom ROM, then they are done and dont bother to read the rest really. At the end its a FP “issue” not a custom ROM issue or something caused by flashing a custom ROM…let’s hope they will change this and all custom ROM (not only e/OS) can fully use all cams…
I was also interested in that. I asked FP support to check with the relevant department. The support replied after 2 weeks that they had done so. After another 2,5 weeks came the answer :
The ultra-wide-angle camera uses the same sensor as the main camera - a ½"-IMX582-sensor.
In the same request as my last post, I also asked about the solution for using alternative camera apps. I referred to this thread. I asked to contact the development team to ask when we can expect a solution. (This was my second request about this, by the way, because in the first one, support wanted to forward the question, but then closed the request with no response). An answer to this also came after another 2.5 weeks:
[…] Right now, our efforts are focused on making sure our camera app and all of its features work well. Other customers have given us feedback similar to yours, and we are considering how best to address it in the future. […]
I’m confused. It sounds to me like the issue is not being worked on right now and that they will look at it someday (or never?). But to @Razem it sounded like they are already on it:
I would never have thought that it is so difficult to use alternative camera apps with all the possibilities/functions of the hardware. That’s really sad. I just expected that alternative camera apps might not be that good. By that I mean that they don’t achieve the same good quality as the original Google Camera app.
If I remember correctly the e/OS stock cam App (is it still Open Camera?) can use all features, or? So FP made this happen, so they know how to, or do I miss something?
I have to admit, I have a hard time following the technical details in this thread. I’m not sure I understand what exactly the problem is, why you can’t just install an alternative camera app yourself and use it with all the features of the hardware. This is really driving me crazy. However, I believe that /e/ themselves have modified their fork of Open Camera and installed it as a system app so that you can use the super wide angle. That’s not a general solution to the problem for me though. I want to see for myself which camera apps I want to try and use. Just install and go. I have no idea what exactly Fairphone would have to do to make this work. Or how complex that is for them and if it is even feasible. I wonder why the problem exists? Is it because of the AOSP or did Fairphone do something “wrong” in their stock ROM? You see, I have no knowledge of this stuff. But would like to know the basic correlations.
The problem is Google added the option to Android (starting with 11) to declare some cameras as system cameras. Those can only be accessed by apps installed in on one of the system partitions (so basically shipping with the OS) or by apps signed with the system certificate (so by Fairphone in this case).
I don’t see any reason this option exists other than completely anti-consumer behavior, but it’s there and Fairphone are using it for the wide-angle camera for whatever stupid reason
Haven’t tried it, from what I read it only supports wide-angle and maybe some other options, but certainly not the full feature set that would be possible with the stock FP Camera app.
And it’s installed as a system app with the necessary permissions, something you can’t easily do with 3rd party camera apps…
There are more problems when it comes to the advanced functionality I don’t understand either, @xblax will have to break that down, but that’s basically the gist of it.
Then Fairphone just has to declare all cameras and the TOF sensor as a “normal” camera and most of the problems from the list in the first post are solved. And then they would have to gradually work through the remaining problems. It’s clear that they have other priorities at the beginning, of course. However, it is unsatisfactory that nothing concrete has come from Fairphone after more than half a year. But well, it’s probably not as easy to implement as I hinted at above. Let’s wait and see…