Magisk module for (system-)camera apps

would you look at that, the evenings are getting longer and colder… (:

2 Likes

That sounds reasonable, the low-light capabilities can be judged better at dark days.

3 Likes

So you would unpack the APKs code, change it (the manifest xml) and re-pack it?

Or is the code of these gcam ports somewhere available, so that it can be compiled directly with gradle or so (still not tried that up to now, but probably something on my list “for the cold dark winter days” :wink: )

Yep, that’s what the GCam modders are doing as well, I believe. I’ve seen apktool config files in some of the “source” packages a few of them offer.

Since GCam isn’t open source, there’s no repo you could build yourself.

1 Like

@xblax hat one line fix do you suggest? Simply delete that line?
Isnt’t the return value used somewhere else?

Sorry had not much time to reply here in the last weeks. The crash can be prevented by doing the following change in CameraMetadataNative.java:

-        String[] physicalCameraIdArray = physicalCamIdString.split("\0");
+        String[] physicalCameraIdArray = physicalCamIdString.trim().split("\0+");

But the root cause is that the Camera HAL is not returning a proper lists of physical sub cameras. It could probably also be patched in the binary blobs.

Thx for the patch! I’m building my own LOS version as I write.
What’s your opinion? Who is responsible for this bug? Google as the Android ‘maintainer’?

Well on Google side it’s just a bit sloppiness to not properly sanitize input data (which then results in the crash). But the malformed data comes from the Camera HAL which is maintained by Fairphone/Qualcomm. Probably it’s just not configured correctly by whoever Camera developer they have for the FP4.

At least, when Fairphone officialy updates to Android 12 they will have to fix this, otherwise it won’t work for them as well.

3 Likes

Thanks! I’ll post my result as soon as my build is complete. :slight_smile:

Yeah. That fixed the issue for crash when opening the app itself. Switching to video mode still crashes the app.

Are you talking about the stock Fpcamera app? Disable EIS in settings before going into camera mode. That’s something I could never get working properly, even with Lineageos 18.1 based ROM.

Since you’re working on getting the camera functional, I uploaded the latest device tree state that I got for a LineageOS 19.1 based ROM. It’s very much WIP and a lot of guessing for some things if they are required. But you might find something useful. Plan was to strip that down to a working set of patches after getting it functional.

In the Camera HAL apparently both the system camera property and the broken subcamera list that required the fix in the android Framework could be patched in com.qti.chi.override.so with Ghidra or IDA disassembler. I talked with DEVs on LineageOS IRC about this some while ago, but it was getting too time consuming for me.

3 Likes