Repository navigation
[Android] Reset system UI visibility flags when setting edge-to-edge mode - #187207
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the enableEdgeToEdge method in PlatformPlugin.java to clear previously applied system UI visibility flags before configuring the window. It also adds a corresponding unit test in PlatformPluginTest.java to verify this behavior. The review feedback suggests adding defensive null checks in enableEdgeToEdge to prevent potential NullPointerExceptions, and optimizing the new test by moving the MockedStatic block outside of the loop to improve performance.
|
Thanks for the quick turnaround, @camsim99 — and sorry the regression slipped through #183072. For the record / future archaeology: the Filed #187265 to add integration coverage for the full |
|
@dbebawy Thank you for the clear explanation and for filing the issue for integration tests! Those would be a major value add. |
flutter/flutter@e70534d...b05a9d7 2026-05-29 [email protected] Roll Skia from 47155534833e to d9d6b440c4e7 (1 revision) (flutter/flutter#187301) 2026-05-29 [email protected] Roll Skia from f93ed13d77fb to 47155534833e (4 revisions) (flutter/flutter#187291) 2026-05-29 [email protected] [web_ui] Optimize skwasm text layout and path decoding to eliminate dynamic boxing churn under Wasm (flutter/flutter#186978) 2026-05-29 [email protected] Roll Fuchsia Linux SDK from SBpmmPxqx3lAvGojE... to jMR_VXQi07kAk8vbR... (flutter/flutter#187279) 2026-05-29 [email protected] Remove Material import from sliver tree rendering test (flutter/flutter#187000) 2026-05-29 [email protected] [Impeller] Remove the y_coord_scale Y-flip plumbing (flutter/flutter#187224) 2026-05-29 [email protected] Add/remove overlay child RenderObject from the tree in `attach`/`detach` (flutter/flutter#186564) 2026-05-29 [email protected] Roll Skia from fcfe5975c945 to f93ed13d77fb (4 revisions) (flutter/flutter#187273) 2026-05-28 [email protected] Handle complex RSE rendering in the uber SDF pipeline (flutter/flutter#186434) 2026-05-28 [email protected] Roll Dart SDK from 082191101fcc to 683322426411 (2 revisions) (flutter/flutter#187270) 2026-05-28 [email protected] Clarify route transition animations (flutter/flutter#186552) 2026-05-28 [email protected] document that the default Key is null and explain proper usage in list diffing (flutter/flutter#185197) 2026-05-28 [email protected] [flutter_tools] Use super parameters in missed spots (flutter/flutter#186197) 2026-05-28 [email protected] docs: Document MediaQueryData.alwaysUse24HourFormat on macOS, Windows, Linux, web (#160664) (flutter/flutter#186642) 2026-05-28 [email protected] Roll Skia from 5493e4c144cd to fcfe5975c945 (3 revisions) (flutter/flutter#187256) 2026-05-28 [email protected] Shares opengles golden context (flutter/flutter#187243) 2026-05-28 [email protected] Update the Curl CIPD package in .ci.yaml to version 8.20.0 (flutter/flutter#187133) 2026-05-28 [email protected] Improve SizedBox's docs (flutter/flutter#187208) 2026-05-28 [email protected] [Impeller] Support instanced rendering across all backends (flutter/flutter#186653) 2026-05-28 [email protected] [Android] Reset system UI visibility flags when setting edge-to-edge mode (flutter/flutter#187207) 2026-05-28 [email protected] Roll Skia from a38708fb7926 to 5493e4c144cd (7 revisions) (flutter/flutter#187241) 2026-05-28 [email protected] Turned on impeller by default on macos (flutter/flutter#186546) 2026-05-28 [email protected] Clarify lazy scroll extent docs (flutter/flutter#186864) 2026-05-28 [email protected] [web] Fix WebParagraph locales test (flutter/flutter#186813) 2026-05-28 [email protected] Roll Packages from 4b424d7 to 10cbdc5 (3 revisions) (flutter/flutter#187238) 2026-05-28 [email protected] Roll Dart SDK from f3db7b7d9801 to 082191101fcc (8 revisions) (flutter/flutter#187235) 2026-05-28 [email protected] Roll Skia from 32acea791248 to a38708fb7926 (1 revision) (flutter/flutter#187221) 2026-05-28 [email protected] [Flutter GPU] Add r32Float and remove Apple-only XR pixel formats (flutter/flutter#187069) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
…r#11803) flutter/flutter@e70534d...b05a9d7 2026-05-29 [email protected] Roll Skia from 47155534833e to d9d6b440c4e7 (1 revision) (flutter/flutter#187301) 2026-05-29 [email protected] Roll Skia from f93ed13d77fb to 47155534833e (4 revisions) (flutter/flutter#187291) 2026-05-29 [email protected] [web_ui] Optimize skwasm text layout and path decoding to eliminate dynamic boxing churn under Wasm (flutter/flutter#186978) 2026-05-29 [email protected] Roll Fuchsia Linux SDK from SBpmmPxqx3lAvGojE... to jMR_VXQi07kAk8vbR... (flutter/flutter#187279) 2026-05-29 [email protected] Remove Material import from sliver tree rendering test (flutter/flutter#187000) 2026-05-29 [email protected] [Impeller] Remove the y_coord_scale Y-flip plumbing (flutter/flutter#187224) 2026-05-29 [email protected] Add/remove overlay child RenderObject from the tree in `attach`/`detach` (flutter/flutter#186564) 2026-05-29 [email protected] Roll Skia from fcfe5975c945 to f93ed13d77fb (4 revisions) (flutter/flutter#187273) 2026-05-28 [email protected] Handle complex RSE rendering in the uber SDF pipeline (flutter/flutter#186434) 2026-05-28 [email protected] Roll Dart SDK from 082191101fcc to 683322426411 (2 revisions) (flutter/flutter#187270) 2026-05-28 [email protected] Clarify route transition animations (flutter/flutter#186552) 2026-05-28 [email protected] document that the default Key is null and explain proper usage in list diffing (flutter/flutter#185197) 2026-05-28 [email protected] [flutter_tools] Use super parameters in missed spots (flutter/flutter#186197) 2026-05-28 [email protected] docs: Document MediaQueryData.alwaysUse24HourFormat on macOS, Windows, Linux, web (#160664) (flutter/flutter#186642) 2026-05-28 [email protected] Roll Skia from 5493e4c144cd to fcfe5975c945 (3 revisions) (flutter/flutter#187256) 2026-05-28 [email protected] Shares opengles golden context (flutter/flutter#187243) 2026-05-28 [email protected] Update the Curl CIPD package in .ci.yaml to version 8.20.0 (flutter/flutter#187133) 2026-05-28 [email protected] Improve SizedBox's docs (flutter/flutter#187208) 2026-05-28 [email protected] [Impeller] Support instanced rendering across all backends (flutter/flutter#186653) 2026-05-28 [email protected] [Android] Reset system UI visibility flags when setting edge-to-edge mode (flutter/flutter#187207) 2026-05-28 [email protected] Roll Skia from a38708fb7926 to 5493e4c144cd (7 revisions) (flutter/flutter#187241) 2026-05-28 [email protected] Turned on impeller by default on macos (flutter/flutter#186546) 2026-05-28 [email protected] Clarify lazy scroll extent docs (flutter/flutter#186864) 2026-05-28 [email protected] [web] Fix WebParagraph locales test (flutter/flutter#186813) 2026-05-28 [email protected] Roll Packages from 4b424d7 to 10cbdc5 (3 revisions) (flutter/flutter#187238) 2026-05-28 [email protected] Roll Dart SDK from f3db7b7d9801 to 082191101fcc (8 revisions) (flutter/flutter#187235) 2026-05-28 [email protected] Roll Skia from 32acea791248 to a38708fb7926 (1 revision) (flutter/flutter#187221) 2026-05-28 [email protected] [Flutter GPU] Add r32Float and remove Apple-only XR pixel formats (flutter/flutter#187069) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
Adds a Flutter Driver test under android_engine_test that drives `SystemChrome.setEnabledSystemUIMode` through transition pairs and asserts the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on `native_driver`. The regression-named test reproduces the `immersiveSticky -> edgeToEdge` cell from flutter#186723 / fixed in flutter#187207: without the fix, FLAG_FULLSCREEN and FLAG_HIDE_NAVIGATION from the prior immersiveSticky call persist on the decor view, leaving the system bars hidden under edgeToEdge. Tests skip on API < 29 since edgeToEdge requires API 29+. Closes flutter#187265
…187269) ## Summary Adds a Flutter Driver integration test under `dev/integration_tests/android_engine_test/` covering `SystemUiMode` transitions on Android. The test exposes a `requestData` handler that applies modes via `SystemChrome.setEnabledSystemUIMode` and reads the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on the existing `native_driver` method channel. Closes flutter#187265. ## Why flutter#186723 was a P1 regression introduced by flutter#183072 and fixed by flutter#187207. The Mockito-based `PlatformPluginTest` unit tests verify which APIs are called on a mocked `Window`/`View` but cannot observe residual `decorView` state that bleeds across mode switches — which is the exact bug class the regression was. A device-level integration test closes that gap. ## What the tests cover | Transition | Assertion | |------------|-----------| | `immersiveSticky → edgeToEdge` (regression case for flutter#186723) | `FLAG_FULLSCREEN` and `FLAG_HIDE_NAVIGATION` are cleared | | `immersive → edgeToEdge` | Same | | `leanBack → edgeToEdge` | Same | | `edgeToEdge → immersive` | `IMMERSIVE \| FULLSCREEN \| HIDE_NAVIGATION` set | | `edgeToEdge → immersiveSticky` | `IMMERSIVE_STICKY \| FULLSCREEN \| HIDE_NAVIGATION` set | | `edgeToEdge → leanBack` | `FULLSCREEN \| HIDE_NAVIGATION` set, no immersive flags | All tests skip on API < 29 since `edgeToEdge` requires Android 10+. ## Files - New: `lib/system_ui_mode_transitions_main.dart` — Flutter Driver entrypoint with mode-applying handler. - New: `test_driver/system_ui_mode_transitions_main_test.dart` — assertion suite. - Modified: `NativeDriverSupportPlugin.kt` — adds `get_system_ui_visibility` method that returns the decor view's `systemUiVisibility` int. Reading the deprecated field is the most direct signal of the regression class (flutter#186723 was specifically about flag bleed-through on this field). - Modified: `README.md` — adds the new entrypoint to the test list. CI auto-discovery is via `Glob('dev/integration_tests/android_engine_test/lib/**_main.dart')` in `dev/bots/suite_runners/run_android_engine_tests.dart` — no separate registration needed. ## Pre-launch Checklist - [x] I read the [Contributor Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview). - [x] I read the [Tree Hygiene](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) wiki page. - [x] I read and followed the [Flutter Style Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md). - [x] I signed the [CLA](https://cla.developers.google.com/). - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making. - [x] All existing and new tests are passing. ## Notes for reviewers - Marked as draft because I do not have a local Android emulator set up — `flutter analyze` is clean but I have not run the test end-to-end. CI is the source of truth. - The reason for reading the deprecated `systemUiVisibility` field on the native side (rather than `WindowInsetsCompat.isVisible(...)`) is that the regression was specifically about bit flags persisting on the decor view; the deprecated read gives a deterministic, version-independent signal. The production code still migrates to non-deprecated APIs for *setting* state per flutter#183072. - `SystemUiMode.manual` is out of scope here (different API surface — takes a `List<SystemUiOverlay>`) and can follow up.
…mode (flutter#187207) Resets system UI visibility flags before setting edge-to-edge mode if requested. System UI visibility flags will be set if the developer requests a non-edge-to-edge `SystemUiMode`, which can (and does in practice) conflict with [laying out a window edge-to-edge](https://developer.android.com/develop/ui/views/layout/edge-to-edge-manually#lay-out-in-full-screen). This is why [the docs](https://developer.android.com/reference/androidx/core/view/WindowCompat#setDecorFitsSystemWindows(android.view.Window,boolean)) warn against setting system UI visibility flags altogether; see flutter#133074 for details. Fixes flutter#186723. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…187269) ## Summary Adds a Flutter Driver integration test under `dev/integration_tests/android_engine_test/` covering `SystemUiMode` transitions on Android. The test exposes a `requestData` handler that applies modes via `SystemChrome.setEnabledSystemUIMode` and reads the resulting decor-view `systemUiVisibility` flags via a new `get_system_ui_visibility` method on the existing `native_driver` method channel. Closes flutter#187265. ## Why flutter#186723 was a P1 regression introduced by flutter#183072 and fixed by flutter#187207. The Mockito-based `PlatformPluginTest` unit tests verify which APIs are called on a mocked `Window`/`View` but cannot observe residual `decorView` state that bleeds across mode switches — which is the exact bug class the regression was. A device-level integration test closes that gap. ## What the tests cover | Transition | Assertion | |------------|-----------| | `immersiveSticky → edgeToEdge` (regression case for flutter#186723) | `FLAG_FULLSCREEN` and `FLAG_HIDE_NAVIGATION` are cleared | | `immersive → edgeToEdge` | Same | | `leanBack → edgeToEdge` | Same | | `edgeToEdge → immersive` | `IMMERSIVE \| FULLSCREEN \| HIDE_NAVIGATION` set | | `edgeToEdge → immersiveSticky` | `IMMERSIVE_STICKY \| FULLSCREEN \| HIDE_NAVIGATION` set | | `edgeToEdge → leanBack` | `FULLSCREEN \| HIDE_NAVIGATION` set, no immersive flags | All tests skip on API < 29 since `edgeToEdge` requires Android 10+. ## Files - New: `lib/system_ui_mode_transitions_main.dart` — Flutter Driver entrypoint with mode-applying handler. - New: `test_driver/system_ui_mode_transitions_main_test.dart` — assertion suite. - Modified: `NativeDriverSupportPlugin.kt` — adds `get_system_ui_visibility` method that returns the decor view's `systemUiVisibility` int. Reading the deprecated field is the most direct signal of the regression class (flutter#186723 was specifically about flag bleed-through on this field). - Modified: `README.md` — adds the new entrypoint to the test list. CI auto-discovery is via `Glob('dev/integration_tests/android_engine_test/lib/**_main.dart')` in `dev/bots/suite_runners/run_android_engine_tests.dart` — no separate registration needed. ## Pre-launch Checklist - [x] I read the [Contributor Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview). - [x] I read the [Tree Hygiene](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) wiki page. - [x] I read and followed the [Flutter Style Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md). - [x] I signed the [CLA](https://cla.developers.google.com/). - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making. - [x] All existing and new tests are passing. ## Notes for reviewers - Marked as draft because I do not have a local Android emulator set up — `flutter analyze` is clean but I have not run the test end-to-end. CI is the source of truth. - The reason for reading the deprecated `systemUiVisibility` field on the native side (rather than `WindowInsetsCompat.isVisible(...)`) is that the regression was specifically about bit flags persisting on the decor view; the deprecated read gives a deterministic, version-independent signal. The production code still migrates to non-deprecated APIs for *setting* state per flutter#183072. - `SystemUiMode.manual` is out of scope here (different API surface — takes a `List<SystemUiOverlay>`) and can follow up.
Resets system UI visibility flags before setting edge-to-edge mode if requested.
System UI visibility flags will be set if the developer requests a non-edge-to-edge
SystemUiMode, which can (and does in practice) conflict with laying out a window edge-to-edge. This is why the docs warn against setting system UI visibility flags altogether; see #133074 for details.Fixes #186723.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.