Skip to content

Commit 3ccf23c

Browse files
camsim99sfshaza2
andauthored
Add page on the Android sensitive content feature (#12220)
_Description of what this PR is changing or adding, and why:_ Adds page covering the sensitive content protection feature on Android as it is being released in the next stable version. _Issues fixed by this PR (if any):_ N/A _PRs or commits this PR depends on (if any):_ N/A ## Presubmit checklist - [x] If you are unwilling, or unable, to sign the CLA, even for a _tiny_, one-word PR, please file an issue instead of a PR. - [x] If this PR is not meant to land until a future stable release, mark it as draft with an explanation. - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style)—for example, it doesn't use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first-person pronouns). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. --------- Co-authored-by: Shams Zakhour (ignore Sfshaza) <[email protected]>
1 parent 2256d5f commit 3ccf23c

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

src/_data/sidenav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,8 @@
550550
permalink: /platform-integration/android/restore-state-android
551551
- title: Target ChromeOS with Android
552552
permalink: /platform-integration/android/chromeos
553+
- title: Protect your app's sensitive content
554+
permalink: /platform-integration/android/sensitive-content
553555
- title: iOS
554556
permalink: /platform-integration/ios
555557
children:
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Protect your app's sensitive content
3+
short-title: Sensitive content
4+
description: >-
5+
Learn how to protect sensitive content in your Flutter app.
6+
---
7+
8+
This feature is available on Android API 35+, and you can try it out by using
9+
the [`SensitiveContent`] widget. See the guide below for details.
10+
11+
## About the `SensitiveContent` widget
12+
13+
You can use the `SensitiveContent` widget in your app to set the content
14+
sensitivity of a child `Widget` to one of the following [`ContentSensitivity`]
15+
values: `notSensitive`, `sensitive`, or `autoSensitive`. The mode that you
16+
choose helps to determine if the device screen should be obscured
17+
(blacked out) during media projection to protect users’ sensitive data.
18+
19+
You can have as many `SensitiveContent` widgets in your app as you wish,
20+
but if _any_ one of those widgets has a `sensitive` content value, then the
21+
screen will be obscured during media projection. Thus, for most use cases,
22+
using multiple `SensitiveContent` widgets provides no advantage over having
23+
one `SensitiveContent` widget in your app’s widget tree. This feature is
24+
available on Android API 35+ and has no effect on lower API versions and
25+
other platforms.
26+
27+
:::note
28+
The `autoSensitive` value isn't supported as of Flutter 3.35 and behaves
29+
the same as `notSensitive`. See the [Issue #160879][] for more information.
30+
:::
31+
32+
## Using the `SensitiveContent` widget
33+
34+
Given some content that you want to protect from media screen share
35+
(for example, a `MySensitiveContent()` widget), you can wrap it with the
36+
`SensitiveContent` widget as shown in the following example:
37+
38+
```dart
39+
class MyWidget extends StatelessWidget {
40+
...
41+
Widget build(BuildContext context) {
42+
return SensitiveContent(
43+
sensitivivity: ContentSensitivity.sensitive,
44+
child: MySensitiveContent(),
45+
);
46+
}
47+
}
48+
```
49+
50+
When running on Android API 34 and below, the screen will not been obscured
51+
during media projection. The widget will exist in the tree but has no other
52+
effect, and you do not need to avoid usages of `SensitiveContent` on platforms
53+
that do not support this feature.
54+
55+
## For more information
56+
57+
For more information, visit the [`SensitiveContent`][]
58+
and [`ContentSensitivity`][] API docs.
59+
60+
[`SensitiveContent`]: {{site.api}}/flutter/widgets/SensitiveContent-class.html
61+
[`ContentSensitivity`]: {{site.api}}/flutter/services/ContentSensitivity.html
62+
[Issue #160879]: {{site.github}}/flutter/flutter/issues/160879

0 commit comments

Comments
 (0)