From 9eddcb7ba425dfabb8078377e882f413521692e7 Mon Sep 17 00:00:00 2001 From: Narek Malkhasyan Date: Tue, 29 Apr 2025 23:13:23 +0400 Subject: [PATCH] Deprecated methods that call setStatusBarColor, setNavigationBarColor, setNavigationBarDividerColor (#165737) Added @deprecated annotation and explanation to methods that use these methods: setStatusBarColor, setNavigationBarColor, setNavigationBarDividerColor This PR partially addresses #165327 --------- Co-authored-by: Reid Baker <1063596+reidbaker@users.noreply.github.com> Co-authored-by: Camille Simon <43054281+camsim99@users.noreply.github.com> Co-authored-by: Camille Simon --- .../io/flutter/embedding/android/FlutterActivity.java | 6 ++++++ .../embedding/android/FlutterFragmentActivity.java | 6 ++++++ .../io/flutter/plugin/platform/PlatformPlugin.java | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java index b46a8e70295..bca3584524a 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterActivity.java @@ -808,6 +808,12 @@ public class FlutterActivity extends Activity /*shouldDelayFirstAndroidViewDraw=*/ getRenderMode() == RenderMode.surface); } + /** + * @deprecated This method is outdated because it calls {@code setStatusBarColor}, which is + * deprecated in Android 15 and above. Consider using the new WindowInsetsController or other + * Android 15+ APIs for system UI styling. + */ + @Deprecated private void configureStatusBarForFullscreenFlutterExperience() { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); diff --git a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java index 033ea576b15..1af53203796 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java @@ -600,6 +600,12 @@ public class FlutterFragmentActivity extends FragmentActivity } } + /** + * @deprecated This method is outdated because it calls {@code setStatusBarColor}, which is + * deprecated in Android 15 and above. Consider using the new WindowInsetsController or other + * Android 15+ APIs for system UI styling. + */ + @Deprecated private void configureStatusBarForFullscreenFlutterExperience() { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); 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 e798d76c7be..2c94fe9c70a 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 @@ -403,7 +403,13 @@ public class PlatformPlugin { updateSystemUiOverlays(); } - @SuppressWarnings("deprecation") + /** + * @deprecated This method is outdated because it calls {@code setStatusBarColor}, {@code + * setNavigationBarColor} and {@code setNavigationBarDividerColor}, which are deprecated in + * Android 15 and above. Consider using the new WindowInsetsController or other Android 15+ + * APIs for system UI styling. + */ + @Deprecated private void setSystemChromeSystemUIOverlayStyle( PlatformChannel.SystemChromeStyle systemChromeStyle) { Window window = activity.getWindow();