Repository navigation
add per-app screenshot and screen recording controls - #476
Draft
BrickyStudios wants to merge 2 commits into
Draft
BrickyStudios wants to merge 2 commits into
BrickyStudios wants to merge 2 commits into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds per-app screen capture controls as app switches, so Settings can show them on the app info page:
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