On Android, developers can prevent apps from being screenshotted by setting FLAG_SECURE. This has the intended side effect of also preventing app previews from being shown in the multitasking menu, as those previews are essentially screenshots of the app in their last used state. Banking apps and DRM-protected apps such as Netflix will typically make use of this protected flag, but it's the only way to prevent that preview from being shown. Now it seems Android 13 will let developers disable those image previews only, while still allowing screenshots to be taken by the user.

As spotted by Esper, Android 13 introduces the setRecentsScreenshotEnabled API. There are a few reasons why a developer may wish to employ this feature. The most important of which I can imagine is when handling sensitive data that it trusts the user to decide if it's safe to screenshot it or not. Currently, FLAG_SECURE is typically used to protect apps displaying copywritten content from having their contents captured, and it has the side effect of not allowing for app previews to be shown in the multitasking menu.

Let's say you need to send a screenshot of a bank transfer to someone. The developer of your banking app has a choice to either set FLAG_SECURE, or to make use of the new setRecentsScreenshotEnabled API to disable screenshots of the app showing in the multitasking preview. If you want to send a screenshot of that transfer, you can't do it while FLAG_SECURE is enabled. However, users may not want their bank's sensitive details to be shown in the multi-tasking menu -- sensitive details such as their bank balance or recent transfers. The introduction of this API solves exactly that problem.

It's certainly a solution to a niche problem, but I'm sure there are other situations that are similar in circumstance. Developers using FLAG_SECURE to hide app previews in the recents menu was definitely a workaround that wasn't really intended for that use, and it's good to see Google giving developers a choice in how they hide those app previews.


Source: Esper