Blocking screenshots and the recent-apps preview

How Android apps keep private screens out of screenshots, screen recordings and the recent-apps view, and where that protection ends.

Part of: Encryption and securityUpdated November 24, 20267 min read

An encrypted vault protects photos while they are stored, but the moment you open one, it is a picture on the screen, and Android can capture screens in several ways: a screenshot, a screen recording, casting to a TV, and the thumbnail Android keeps for the recent-apps view. Android gives apps a window setting called FLAG_SECURE that keeps a screen out of screenshots and off non-secure displays; Google's documentation says a screenshot of such a window comes out blank. Android 13 added a separate control for the recent-apps thumbnail. HideBerry, the vault we make, sets FLAG_SECURE on its window, always on, to block screenshots and screen recording of the app and hide its preview in the recent-apps view. Below is what each of these covers, what none of them can cover, and how to check an app yourself.

This page is part of photo encryption and security explained.

Why a vault needs to block the screen, not just encrypt files

Encryption works on stored data. Once a photo is decrypted for you to look at, other parts of the phone can make a new, unencrypted copy of what is on screen:

  • A screenshot saves the screen as a normal image in the gallery, often backed up to the cloud a moment later.
  • A screen recording does the same as video.
  • Casting or screen sharing sends the screen to a TV, a projector or another person's device.
  • The recent-apps view shows a thumbnail of each app's last screen when you switch apps, which anyone looking at your phone can see.

Each one is a way for a private photo to end up outside the vault without you choosing Take out. A vault that encrypts files but allows all four has left the front window open.

What FLAG_SECURE does

FLAG_SECURE is a setting an Android app puts on a window. It has been part of Android since API level 1, the very first public version. According to Android's developer documentation:

  • The window's content is treated as secure and kept out of screenshots.
  • The window is not shown on non-secure displays, such as when casting the screen to a TV or projector.
  • When a screenshot is taken, the resulting image is blank.
  • It helps with remote screen-sharing too, which Google notes is often misused in scams.

For a photo vault, this is the main tool: the vault's screens don't end up in the gallery, in a recording, or on someone else's screen.

The recent-apps preview

When you leave an app, Android normally keeps a picture of its last screen to show in the recent-apps (Overview) view. For a vault, that picture could be the last photo you looked at.

Two Android controls deal with this:

  • FLAG_SECURE keeps secure windows out of screenshots. Android's reference describes it as broader than the recents-only control below: it covers the recent-apps picture as well as other screenshots.
  • setRecentsScreenshotEnabled(false), added in Android 13 (API level 33), tells the system never to take a screenshot of that screen for the recent-apps view. Android's reference notes that the system may show the app's plain background instead, and that, unlike FLAG_SECURE, it only affects the recent-apps picture, not other screenshots.

In HideBerry, FLAG_SECURE is on the app's window, so the recent-apps preview is hidden. When you switch apps, the vault doesn't show what you were looking at. It is always on: there is no setting to turn it off.

What's covered, and what isn't

Way a screen gets capturedBlocked by HideBerry's screen protection?
Screenshot with the phone's buttons or gesturesYes
Screen recordingYes
Casting or sharing the screen to a non-secure displayAndroid keeps secure windows off non-secure displays
Recent-apps thumbnailHidden
Another phone or camera pointed at the screenNo: nothing on the phone can see it
Someone looking over your shoulderNo
Overlay tricks by other appsNot reliably: Google says FLAG_SECURE isn't reliable against overlay attacks
Root access or malware with deep system controlNo, see what a photo vault can't stop

Google's developer page adds one more caution: on Android 11 and lower, FLAG_SECURE reliably helps on around 70% of devices, because on some devices keyboard taps can be recorded. That is a limit of the phone, not of any one app.

Blocking vs detecting screenshots

Android 14 added a screenshot detection API. It is different from blocking:

  • An app can register to be told when the user takes a screenshot while its screen is visible, and Android shows the user a notice.
  • The app doesn't get the screenshot itself.
  • It only detects screenshots taken with the phone's own button combination, not ones taken through developer tools like ADB.

Detection suits apps that want to warn someone ("a screenshot was taken of this chat"). For a vault, blocking is the right tool: there should be no screenshot to warn about.

Where else photos leak while the vault is open

Screen protection covers the screen. These are the other ways a photo can get out while you are using a vault:

  • Taking a copy out. In HideBerry, Take out saves a normal, unencrypted copy outside the vault, and the app labels it as leaving the vault's protection.
  • Leaving the vault open. HideBerry locks when you tap Lock now, and by itself after you leave the app: immediately, after 30 seconds (the default), 1 minute or 5 minutes. If you often hand your phone over, choose immediately.
  • Handing the phone over with the vault open. No screen protection helps if the person is holding the phone. See hiding photos when you hand your phone to someone.
  • Clipboard history. During setup, HideBerry's Copy button puts the recovery words on the clipboard for 60 seconds. Some keyboard apps keep their own clipboard history, which is why writing the words on paper is safer.

Check any app yourself in one minute

  1. Open the app and go to a screen with private content.
  2. Try to take a screenshot. A protected screen gives a blank image or the phone refuses to save one.
  3. Start a screen recording, open the app, then stop and play it back. The app's screens should be black or blank.
  4. Open the recent-apps view. The app's card should not show its last screen.
  5. Leave the app for longer than its auto-lock time, come back, and check it asks for the PIN again.

If any step shows your private content, that app's vault screens can leave the phone without you choosing it.

People Also Ask

Why can't I take a screenshot in some apps? Because the app has marked its window as secure with FLAG_SECURE. Google suggests it for apps such as banking apps and password managers, and photo vaults use it for the same reason. Android then keeps that screen out of screenshots and off non-secure displays, and a screenshot comes out blank.

Does a vault's screenshot blocking affect other apps? No. FLAG_SECURE is set on an app's own windows, so it only covers that app's screens. Screenshots elsewhere on your phone work as normal. If you need a photo from HideBerry outside the vault, Take out saves a normal copy and labels it as leaving the vault's protection.

Does screenshot blocking stop someone filming my screen? No. A second phone or camera pointed at your screen is outside anything software on your phone can detect. The protection there is behavior: open the vault where others can't see your screen, and lock it when you're done.

Is the recent-apps preview a real risk? It can be. The preview shows an app's last screen to anyone who opens the recent-apps view on your phone, even without opening the app. For a vault, that could be a private photo. Hiding it closes that gap.

FAQs

What is FLAG_SECURE on Android?

It is a window setting that tells Android to treat an app's screen as secure. Android keeps that screen out of screenshots and off non-secure displays, such as casting to a TV, and a screenshot of it comes out blank. It has been available since the first version of the Android API.

Does HideBerry block screenshots and screen recording?

Yes. Screenshots and screen recording of the app are blocked, and the recent-apps preview is hidden. HideBerry does this with FLAG_SECURE on its window, and it is always on, with no setting to turn it off. This doesn't stop someone from pointing another camera at your screen, and it doesn't protect copies you take out of the vault.

How do apps hide their preview in recent apps?

Secure windows marked with FLAG_SECURE are kept out of screenshots, including the picture Android uses for the recent-apps view. Since Android 13 (API level 33), apps can also call setRecentsScreenshotEnabled(false), which tells Android never to take a recent-apps screenshot of that screen.

Can malware get around screenshot blocking?

Sometimes. Google's own documentation says FLAG_SECURE isn't reliable against overlay attacks, and malware with deep system access or root can get past app protections in general. Screen protection is meant for everyday capture, not for a phone that has been taken over.

Is screenshot detection the same as blocking?

No. Android 14's screenshot detection tells an app that a screenshot was taken and shows the user a notice, but it doesn't stop the screenshot. It also only detects button-combination screenshots. Blocking with FLAG_SECURE means the screenshot comes out blank.

A vault that keeps the screen private too

HideBerry blocks screenshots and screen recording, hides its recent-apps preview, and locks itself after you leave. It is coming soon to Google Play. See every privacy feature, and the limits, on HideBerry features, and how the stored side works on how photo encryption works.

Sources

Keep private photos private

HideBerry encrypts photos, videos, notes and files on your Android phone. No account, no cloud, no ads. Free for up to 50 items, with every feature.

Coming soon toGoogle PlaySee how it works