[Galaxy Note 4 Android Development (Exynos)] ananjaser1211:
Note 4 Nougat Camera issue crash course

I will try to explain this without getting too technical

To explain since i got this very often,

before i do that, im gonna keep these definitions here to understand some references i will use

HAL: (Hardware Abstraction Layer) Easiest way to explain , would be Camera Driver, the thing that tells your system what camera hardware it has

Prebuilt : something that CANT be edited well, I.E Touchwiz libs

AOSP : Anything made in AOSP enviroment (LOS/RR libs)

So first thing is, What is a CAMERA to a system.

When the system boots, it loads a series of libs that define what is your camera hardware, the main one we will focus on is libexynoscamera, it contains ALL the information for what sensor to use (that is defined by an ID in kernel) and what is the features of the sensor etc. now we can explain all that camera crap as being Driver.

Now all of these are prebuilts, so we cant edit them really as we like (other than hex editing some minor stuff in it) and ofcourse we need to keep in mind that we can only use libexynoscamera when we meet very specific requirements, that includes both back/front sensor IDs to match the hardware in the device we got. any mismatch means it will fail to load. now till now things are simple, so we also keep in mind that we are FORCED to use libexynoscamera from MM NOTE 4 , because simply said, there is no other device that uses IMX258 and S5K6D1 setup for camera. Now yes i know that the NOTE 5 and S6/S6E have a quite similar setup, IMX258 And S5K3P3, Which actually i force loaded on our device, which worked, however due to 64bit camera firmware in the note 5/S6/S6E that was a dead end and couldnt get the camera to load properly.

So what is Refined 3.8 camera, or any MM camera, its basicly that file, that libexynoscamera, we must keep it Note 4s. now lets say we want to try to make it work with note 4 MM.

Then comes the roadblocks from the actual Android 7.0, Google added some security measures that allows camera to only get buffers from libstagefrieght (security lib) instead of the oldschool way in MM (which was from something called gralloc) and also moved to using cameraserver instead of mediaserver. therfore that libexynoscamera from note 4 cant communicate with that because it doesn't know what it wants, as it was never programmed to do such thing.

Now i hear you, but Anan in AOSP Camera is working, what gives? in AOSP you have the ability to BUILD everything, that includes the libs. which means you can bypass the security measures placed by google for loading legay camera hals (HAL 1). Example of bypass in AOSP

Can we use AOSP libs tho ? Answer would be No, because samsung has symbols basicly in every lib that connects to each other. one missing symbol and it will error.

Can we use MM libstagefrieght maybe ? . Same answer as above.

so to sum up, Any attempts to use N4 MM camera driver failed, one of the reasons behind the issues is these secuirty measures, that we basically cant bypass on TouchWiz because there is no source code we can build from, if there was we would be running TW Oreo.

Maybe there is a way to bypass, but in my case i have no ideas how that can happen.

So camera is more than the APP you run on your phone, there is tons of under the hood stuff that goes on before it actually gives you an image. the app is just an interface that connects with camera/media servers, that connect themselves to the libexynoscamera

This is a good article to read : Cameras in roms we use few shims to make the note 4 MM libexynoscamera even loading in the first place

So what now ? , Just wish me luck i can figure out more ideas i havent tried, it still looks like camera will NOT be fixed on Nougat, but who knows what the future might hold.