Skip to content

add per-app screenshot and screen recording controls - #476

Draft
BrickyStudios wants to merge 2 commits into
GrapheneOS:17from
BrickyStudios:per-app-screen-capture-controls
Draft

BrickyStudios wants to merge 2 commits into
GrapheneOS:17from
BrickyStudios:per-app-screen-capture-controls

Conversation

@BrickyStudios

@BrickyStudios BrickyStudios commented Oct 25, 2026 •

Copy link
Copy Markdown

Adds per-app screen capture controls as app switches, so Settings can show them on the app info page:

  • Screenshots: Default / Allow / Block
  • Screen recording and screen sharing (MediaProjection): Default / Allow / Block
  • Block screenshot detection (Activity.ScreenCaptureCallback)
  • Block screen recording detection (WindowManager#addScreenRecordingCallback)

Default keeps the current behavior. Allow overrides only the capture part of FLAG_SECURE. Recents thumbnails, scroll capture and mirroring to non-secure displays stay blocked, and device policy and sensitive content protection still apply. Block leaves the app's windows out of the capture. With detection blocked, the APIs keep working but the app's callbacks don't fire, and the app isn't named in the "app detected this screenshot" notice.

The commit messages describe how the overrides are applied for screenshots (WindowManagerService#captureDisplay) and for MediaProjection sessions (SensitiveContentProtectionManagerService).

Settings UI: GrapheneOS/platform_packages_apps_Settings#457

This hasn't been built or run on a device yet. I only have frameworks/base and Settings checked out, not a full tree, so the unit tests added here haven't run either. Opening it as a draft to get feedback on the approach before a full build.

Related issues:
GrapheneOS/os-issue-tracker#664
GrapheneOS/os-issue-tracker#2931
GrapheneOS/os-issue-tracker#2590

🤖 Generated with Claude Code

BrickyStudios and others added 2 commits October 25, 2026 00:56
…ction

Apps can register for screenshot notifications (Activity.ScreenCaptureCallback,
Android 14) and for screen recording state changes
(WindowManager#addScreenRecordingCallback, Android 15). The new per-app
switches make these callbacks silent for the app. The APIs keep working, so
apps don't break. With screenshot detection blocked, the app also isn't named
in the "app detected this screenshot" notice.

GrapheneOS/os-issue-tracker#2590

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each app gets two three-state switches, one for screenshots and one for
screen recording / screen sharing (MediaProjection):

- Default: the app decides via FLAG_SECURE, as before.
- Allow: the app's FLAG_SECURE windows are captured. Only the capture aspect
  of FLAG_SECURE is overridden. Recents thumbnails, scroll capture and
  mirroring to non-secure displays stay blocked. Device policy and sensitive
  content protection can't be overridden.
- Block: the app's windows are left out of the capture.

Screenshots: WindowManagerService#captureDisplay applies the overrides when
SystemUI takes the screenshot. Blocked windows are excluded. If an allowed
FLAG_SECURE window is visible, secure layers are captured and every window
that isn't allowed and may contain secure content (secure windows and
untrusted windows, which can contain secure SurfaceViews) is excluded. Blocked
apps also get theme-based task snapshots, which covers screenshots taken from
recents and from task snapshots, and they're skipped for scroll capture.

Screen recording: SensitiveContentProtectionManagerService passes the per-app
choices to WindowManager when a MediaProjection session starts, including for
recorders exempted from sensitive content protection such as the SystemUI
screen recorder. Blocked apps become secure for the duration of the session
and their stale task snapshots are dropped. Allowed apps get a non-secure
surface during the session while WindowState#isSecureLocked() stays true, so
their recents thumbnails remain protected.

GrapheneOS/os-issue-tracker#664
GrapheneOS/os-issue-tracker#2931

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant