Skip to content

[Android] Implement setting content sensitivity on Android - #158473

Closed
camsim99 wants to merge 0 commit into
flutter:masterfrom
camsim99:sc_try1
Closed

camsim99 wants to merge 0 commit into
flutter:masterfrom
camsim99:sc_try1

Conversation

@camsim99

@camsim99 camsim99 commented Nov 11, 2024 •

Copy link
Copy Markdown
Contributor

Important

Messed up this branch :') Landed in #167815.

Overview

Implements setting content sensitivity on Android via a new widget called SensitiveContent that currently will only function on Android.

How it's implemented

There are three different content sensitivity levels: autoSensitive, sensitive, notSensitive. All except autoSensitive behave as their Android counterpart level behaves (see links on the levels); for Flutter, autoSensitive will behave the same as notSensitive though it is implemented as if it works (see #160879 for more details.

In any given Flutter view, each SensitiveContent widget sets a content sensitivity level and there may be multiple SensitiveContent widgets in the widget tree at a time, but only the most severe content sensitivity level in the tree will be maintained in order to ensure secure content remains obscured during screen projection. This means that even widgets that are not visible may still impact the overall content sensitivity of the entire Flutter view (see #160051 for more details).

Under the hood, the implementation uses method channels. Theoretically, this could cause a delay in setting the content sensitivity level and a Flutter view being obscured during screen projection on time, so we will investigate using JNIgen in the future (see #160050 for more details). Over the method channel, the framework will send a Flutter view ID and content sensitivity level to the engine to set the expected content sensitivity level for the view.

Timeline

Required for feature shipping

  • Land this PR with the method channel implementation of content sensitivity.

Short-term follow up tasks

Long-term follow up tasks

Stretch goals

Open questions

  • Is it okay to hard-code the FlutterActivity and FlutterFragment view IDs? Does this impact add-to-app in any way? I assume we would need extenders of those classes to use a different view ID than the hardcoded one. Approach not used.
  • Should we expose autoSensitive for now? If so, what behavior should it have? Exposing autoSensitive as if it works.

One way to test this PR (rough steps)

  1. Create a Flutter app that has some number of SensitiveContent widgets.
  2. Run the app on an emulator/device that runs API 35 and has the Google meets app downloaded.
  3. Start a Google meets meeting and screen share (works with full screen and single app mode).
  4. Join the Google meets meeting from another device and witness a blacked out screen if content has been marked sensitive.

Pre-launch Checklist

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

Labels

engine flutter/engine related. See also e: labels. framework flutter/packages/flutter repository. See also f: labels. platform-android Android applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants