From 9be07d79a8a722e672c340d936ad2053eb62d029 Mon Sep 17 00:00:00 2001 From: Camille Simon <43054281+camsim99@users.noreply.github.com> Date: Wed, 25 Sep 2024 04:30:21 -0700 Subject: [PATCH] Update `setSystemChromeEnabledSystemUIMode` docs to note targeting Android 15+ change (flutter/engine#54560) Updates `setSystemChromeEnabledSystemUIMode` documentation to reflect that edge-to-edge mode is used by default if the Flutter app targets Android 15. Part of https://github.com/flutter/flutter/issues/150367 and engine counterpart to https://github.com/flutter/flutter/pull/153466. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../plugin/platform/PlatformPlugin.java | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java index 9810623f85..e798d76c7b 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java @@ -268,7 +268,13 @@ public class PlatformPlugin { if (systemUiMode == PlatformChannel.SystemUiMode.LEAN_BACK) { // LEAN BACK - // Available starting at SDK 16 + // Available starting at Android SDK 4.1 (API 16). + // + // If the Flutter Android app targets Android SDK 15 (API 35) or later then the Android + // system will ignore this value unless the app also follows the opt out + // instructions found in + // https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge. + // // Should not show overlays, tap to reveal overlays, needs onChange callback // When the overlays come in on tap, the app does not receive the gesture and does not know // the system overlay has changed. The overlays cannot be dismissed, so adding the callback @@ -282,7 +288,13 @@ public class PlatformPlugin { | View.SYSTEM_UI_FLAG_FULLSCREEN; } else if (systemUiMode == PlatformChannel.SystemUiMode.IMMERSIVE) { // IMMERSIVE - // Available starting at 19 + // Available starting at Android SDK 4.4 (API 19). + // + // If the Flutter Android app targets Android SDK 15 (API 35) or later then the Android + // system will ignore this value unless the app also follows the opt out + // instructions found in + // https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge. + // // Should not show overlays, swipe from edges to reveal overlays, needs onChange callback // When the overlays come in on swipe, the app does not receive the gesture and does not know // the system overlay has changed. The overlays cannot be dismissed, so adding callback @@ -297,7 +309,13 @@ public class PlatformPlugin { | View.SYSTEM_UI_FLAG_FULLSCREEN; } else if (systemUiMode == PlatformChannel.SystemUiMode.IMMERSIVE_STICKY) { // STICKY IMMERSIVE - // Available starting at 19 + // Available starting at Android SDK 4.4 (API 19). + // + // If the Flutter Android app targets Android SDK 15 (API 35) or later then the Android + // system will ignore this value unless the app also follows the opt out + // instructions found in + // https://docs.flutter.dev/release/breaking-changes/default-systemuimode-edge-to-edge. + // // Should not show overlays, swipe from edges to reveal overlays. The app will also receive // the swipe gesture. The overlays cannot be dismissed, so adding callback support will // allow users to restore the system ui and dismiss the overlays. @@ -312,7 +330,12 @@ public class PlatformPlugin { } else if (systemUiMode == PlatformChannel.SystemUiMode.EDGE_TO_EDGE && Build.VERSION.SDK_INT >= API_LEVELS.API_29) { // EDGE TO EDGE - // Available starting at 29 + // + // Available starting at Android SDK 10 (API 29). + // + // If the Flutter app targets Android SDK 15 (API 35) or later (Flutter does this by default), + // then this mode is used by default. + // // SDK 29 and up will apply a translucent body scrim behind 2/3 button navigation bars // to ensure contrast with buttons on the nav and status bars, unless the contrast is not // enforced in the overlay styling. @@ -390,8 +413,9 @@ public class PlatformPlugin { if (Build.VERSION.SDK_INT < API_LEVELS.API_30) { // Flag set to specify that this window is responsible for drawing the background for the - // system bars. Must be set for all operations on API < 30 excluding enforcing system - // bar contrasts. Deprecated in API 30. + // system bars. Must be set for all operations on API < 30 (Android SDK < 11) excluding + // enforcing + // system bar contrasts. Deprecated in API 30. window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // Flag set to dismiss any requests for translucent system bars to be provided in lieu of what