Skip to content

Add mobile app switcher privacy setting#3063

Open
aaravrav wants to merge 1 commit into
krille-chan:mainfrom
aaravrav:2453-hide-app-switcher-content
Open

Add mobile app switcher privacy setting#3063
aaravrav wants to merge 1 commit into
krille-chan:mainfrom
aaravrav:2453-hide-app-switcher-content

Conversation

@aaravrav

@aaravrav aaravrav commented Jun 3, 2026

Copy link
Copy Markdown

Adds a mobile-only app switcher privacy mode with Off, App lock, and Always options, defaulting to Always. The setting hides app content from recents/app switcher views without blocking normal foreground screenshots.

On Android 13+, uses the platform recents screenshot API. On Android 12L and older, applies FLAG_SECURE only while the app is leaving the foreground and clears it again on resume. On iOS and other mobile lifecycle snapshots, shows a full-screen privacy cover while inactive, hidden, or paused.

Closes #2453

Pull Request has been tested on:

  • Android
  • iOS
  • Browser (Chromium based)
  • Browser (Firefox based)
  • Browser (WebKit based)
  • Desktop Linux
  • Desktop Windows
  • Desktop macOS

Adds a mobile-only app switcher privacy mode with Off, App lock, and Always
options, defaulting to Always. The setting hides app content from recents/app
switcher views without blocking normal foreground screenshots.

On Android 13+, uses the platform recents screenshot API. On Android 12L and
older, applies FLAG_SECURE only while the app is leaving the foreground and
clears it again on resume. On iOS and other mobile lifecycle snapshots, shows a
full-screen privacy cover while inactive, hidden, or paused.

Also adds Security settings UI and tests for the privacy mode logic, lifecycle
cover behavior, and native channel calls.
@aaravrav aaravrav requested a review from krille-chan as a code owner June 3, 2026 09:18
}

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
// do nothing, because the engine was been configured in provideEngine

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are packages on pub.dev which can do this so I don't have to maintain it

@aaravrav aaravrav Jun 3, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. The closest ones either keep FLAG_SECURE enabled while protection is active, which blocks foreground screenshots, or still require MainActivity lifecycle integration for app switcher only behavior.

The Android 13+ part of this PR uses setRecentsScreenshotEnabled(false), which none of the packages expose. That API is the reason screenshots remain allowed while Recents is hidden on Android 13+, and is the idiomatic way to do so.

I could if you prefer,

  1. switch to a package even if that means foreground screenshots are blocked while enabled, or
  2. first propose/add setRecentsScreenshotEnabled support upstream to a package such as screen_protector?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@krille-chan Let me know because if you prefer the 2nd option then it'll take time to upstream those changes in the flutter package as well

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hide app content in app switcher/app overview screen

2 participants