This question already has an answer here:
- Disable Screenshot Security 6 answers
As per this Stack Overflow answer, Android apps using
FLAG_SECURE in their activities are protected from screenshots being taken by the system. You get a blank file when using
screencap and some other screenshot apps, and this error when using the hardware buttons:
Can't take screenshot due to limited storage space, or it isn't allowed by the app or your organization.
However, this is not a hard guarantee. In Android Studio, I can still take screenshots of such "secure" apps with the button pointed out in this SO answer.
I took a look through the Android Studio source code, and the screenshot is acquired through a
framebuffer: request to ADB, which in turn uses
screencap. Before I go looking through source for more info on how this works for adb but not for a root terminal and a possible "developer" solution, I thought I should ask: Has anyone already figured out what's happening behind the scenes here and can an end-user make use of it? Ideally, without needing a PC.
My device is rooted, so I'm open to apps/commands/etc. that require root (or having USB Debugging enabled). I've tried a few screenshot apps from pre-Android-2.3 that use root, but none of them still work (presumably due to how the framebuffer is now protected).