-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Add page on the Android sensitive content feature #12220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
camsim99
wants to merge
9
commits into
main
Choose a base branch
from
sensitive_content
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0ea6e67
Add sensitive content page
camsim99 baf0760
Update src/content/platform-integration/android/sensitive-content.md
camsim99 7b5f499
Update src/content/platform-integration/android/sensitive-content.md
camsim99 d8bf8ce
Update src/content/platform-integration/android/sensitive-content.md
camsim99 f8fb607
Update src/content/platform-integration/android/sensitive-content.md
camsim99 c867372
Update src/content/platform-integration/android/sensitive-content.md
camsim99 8cb2b3b
draft #2
camsim99 9b060e6
address review
camsim99 5c637f1
include other features
camsim99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
62 changes: 62 additions & 0 deletions
62
src/content/platform-integration/android/sensitive-content.md
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
--- | ||
title: Protect your app's sensitive content | ||
short-title: Sensitive content | ||
description: >- | ||
Learn how to protect sensitive content in your Flutter app. | ||
--- | ||
|
||
This feature is available on Android API 35+, and you can try it out by using | ||
the [`SensitiveContent`] widget. See the guide below for details. | ||
|
||
## About the `SensitiveContent` widget | ||
|
||
You can use the `SensitiveContent` widget in your app to set the content | ||
sensitivity of a child `Widget` to one of the following [`ContentSensitivity`] | ||
values: `notSensitive`, `sensitive`, or `autoSensitive`. The mode that you | ||
choose helps to determine if the device screen should be obscured | ||
(blacked out) during media projection to protect users’ sensitive data. | ||
|
||
You can have as many `SensitiveContent` widgets in your app as you wish, | ||
but if _any_ one of those widgets has a `sensitive` content value, then the | ||
screen will be obscured during media projection. Thus, for most use cases, | ||
using multiple `SensitiveContent` widgets provides no advantage over having | ||
one `SensitiveContent` widget in your app’s widget tree. This feature is | ||
available on Android API 35+ and has no effect on lower API versions and | ||
other platforms. | ||
|
||
:::note | ||
The `autoSensitive` value isn't supported as of Flutter 3.35 and behaves | ||
the same as `notSensitive`. See the [Issue #160879][] for more information. | ||
::: | ||
|
||
## Using the `SensitiveContent` widget | ||
|
||
Given some content that you want to protect from media screen share | ||
(for example, a `MySensitiveContent()` widget), you can wrap it with the | ||
`SensitiveContent` widget as shown in the following example: | ||
|
||
```dart | ||
class MyWidget extends StatelessWidget { | ||
... | ||
Widget build(BuildContext context) { | ||
return SensitiveContent( | ||
sensitivivity: ContentSensitivity.sensitive, | ||
child: MySensitiveContent(), | ||
); | ||
} | ||
} | ||
``` | ||
|
||
When running on Android API 34 and below, the screen will not been obscured | ||
during media projection. The widget will exist in the tree but has no other | ||
effect, and you do not need to avoid usages of `SensitiveContent` on platforms | ||
that do not support this feature. | ||
|
||
## For more information | ||
|
||
For more information, visit the [`SensitiveContent`][] | ||
and [`ContentSensitivity`][] API docs. | ||
|
||
[`SensitiveContent`]: {{site.api}}/flutter/widgets/SensitiveContent-class.html | ||
[`ContentSensitivity`]: {{site.api}}/flutter/services/ContentSensitivity.html | ||
[Issue #160879]: {{site.github}}/flutter/flutter/issues/160879 |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include somewhere in this doc if users need to worry about using sensitive content on non android or non api 35+ platforms and what the fallback behavior is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was already included in the section above but added a note here, as well.