Monday, May 30, 2016

How can I take on-device screenshots of "secure" apps?



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).




Answer



As your device is rooted, you could use the Xposed module DisableFlagSecure:



An Xposed Framework module that disables FLAG_SECURE on windows system-wide. This lets you take screenshots and do screen capture in apps that normally won't let you. (That said, you probably don't want to leave this on permanently).



You can of course also find it in the Xposed Repo.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...