-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Description
Use case
In FlutterActivity.java, there is a private method:
/**
* @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);
window.setStatusBarColor(0x40000000);
window.getDecorView().setSystemUiVisibility(PlatformPlugin.DEFAULT_SYSTEM_UI);
}
This method relies on window.setStatusBarColor, which is deprecated in Android 15. On API 35 devices the method does nothing – the status bar remains transparent.
✅ Screenshot on API 27: status bar has semi-transparent color

❌ Screenshot on API 35: status bar is fully transparent, color not applied

React Native is facing the same problem: facebook/react-native#51928.
Despite the breakage, the current fullscreen behavior actually looks quite good (more immersive). But Flutter should make an explicit decision here, rather than silently keeping a broken, deprecated method
Proposal
There are three possible directions
1. Implement a proper workaround for API 35+
Use the officially recommended WindowInsets APIs. Example:
@RequiresApi(API_LEVELS.API_35)
private void configureStatusBarForFullscreenFlutterExperienceApi35(View flutterView) {
ViewCompat.setOnApplyWindowInsetsListener(flutterView, (v, windowInsets) -> {
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.statusBars());
int height = insets.top;
View statusBarView = new View(flutterView.getContext());
statusBarView.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
height
));
statusBarView.setBackgroundColor(0x40000000);
addContentView(statusBarView, statusBarView.getLayoutParams());
return WindowInsetsCompat.CONSUMED;
});
}
2. Document a temporary manifest workaround
Advise users to add:
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
This restores old behavior on API 35+. But Google’s docs state it’s only temporary and may be removed.
3. Conditionalize + remove deprecation
Keep setStatusBarColor for API <35, and no-op for API ≥35.
Remove the @Deprecated
annotation since this remains the simplest and most consistent option with iOS (where the fullscreen status bar already looks transparent).
<img width="603" height="1311"alt="Image" src="https://github.com/user-attachments/assets/0ab3116a-dc97-4acc-8c18-6821623b49fd" />
Suggested Resolution
Option 3 seems the best compromise:
Keeps consistent behavior with iOS fullscreen experience
Avoids introducing heavy custom view hacks
Leaves room for users to override if they want stricter edge-to-edge styling
I've added PR for this #175501