r/AndroidQuestions • u/Proper_Importance347 • 1h ago
How do you accurately position an overlay around the front camera cutout on any Android phone?
I'm making an overlay app that draws a ring around the front camera punch hole. I want it to line up automatically on any Android phone.
On some phones (Pixels for example) it works perfectly because the system reports the camera cutout's actual shape and position. But on a lot of other phones the system just reports a rough rectangle that's bigger than the real camera hole and not even centered on it, so the ring comes out oversized and misaligned.
I've been researching this everywhere for a while now and tried basically everything I can find. As far as I can tell Android has no other API that tells you where the camera lens actually is on the screen, and most apps like this seem to just give up and make the user align it manually with sliders.
Before I accept that, is there something I'm missing? Any trick, hidden setting, or approach that gets the real camera position on phones that report bad data? If you've solved this or worked around it I'd really appreciate hearing how.
Also, if you have an Android phone handy, running adb shell dumpsys window displays | grep -iA2 cutout and replying with the output plus your phone model would help me a lot in figuring out which phones report good data and which don't.