Description
Setting IInsetsManager.DisplayEdgeToEdgePreference = true on Android does not clear Google Play Console's "Your app uses deprecated APIs or parameters for edge-to-edge" advisory, because AndroidInsetsManager.UpdateDisplayEdgeToEgdeState() calls the legacy WindowCompat.SetDecorFitsSystemWindows(...) API unconditionally (regardless of the preference value):
https://github.com/AvaloniaUI/Avalonia/blob/master/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs
WindowCompat.setDecorFitsSystemWindows is itself an AndroidX compat shim that dispatches to per-SDK-level EdgeToEdgeApi21/23/26/29/35 impl classes, and those are what Play Console's static bytecode analysis flags as calling the deprecated Window.setStatusBarColor/setNavigationBarColor. This is flagged regardless of runtime SDK branching elsewhere in the file (e.g. the existing if (!OperatingSystem.IsAndroidVersionAtLeast(35)) guard around SystemBarColor's own direct calls) because Play's analysis traces reachable bytecode, not executed branches.
Play Console's own advisory text suggests the fix: "call enableEdgeToEdge() for Kotlin or EdgeToEdge.enable() for Java for backward compatibility" — i.e. migrate off WindowCompat.SetDecorFitsSystemWindows onto the modern androidx.activity.EdgeToEdge / WindowCompat.EnableEdgeToEdge helper.
.NET MAUI hit the identical advisory and is fixing it the same way: migrating MauiAppCompatActivity.OnCreate from SetDecorFitsSystemWindows(Window, false) to WindowCompat.EnableEdgeToEdge(Window) — see dotnet/maui#36226 (open, targets .NET 11).
To Reproduce
- Create an Avalonia Android app targeting API 35 (
targetSdkVersion 35 / SupportedOSPlatformVersion high enough to trigger Android 15 edge-to-edge enforcement).
- Set
TopLevel.InsetsManager.DisplayEdgeToEdgePreference = true somewhere in the view lifecycle (e.g. OnAttachedToVisualTree).
- Build a release AAB and upload it to Google Play Console.
- Under "Release > (your track) > Pre-launch report" or "For your next release", the advisory "Edge-to-edge may not display for all users" / "Your app uses deprecated APIs or parameters for edge-to-edge" is present, naming
androidx.activity.EdgeToEdgeApi35.setUp as the origin.
Expected behavior
Enabling DisplayEdgeToEdgePreference (or Avalonia's Android edge-to-edge support generally) should route through AndroidX's modern EdgeToEdge.enable()/WindowCompat.EnableEdgeToEdge API rather than the legacy WindowCompat.SetDecorFitsSystemWindows, so apps don't carry a reachable deprecated-API call purely from using Avalonia's own insets plumbing.
Environment
- Avalonia 12.1.1
- net10.0-android,
SupportedOSPlatformVersion 23, targeting SDK 35
- Reproduced on a real shipped app (Google Play Console, release 0.4.1)
Description
Setting
IInsetsManager.DisplayEdgeToEdgePreference = trueon Android does not clear Google Play Console's "Your app uses deprecated APIs or parameters for edge-to-edge" advisory, becauseAndroidInsetsManager.UpdateDisplayEdgeToEgdeState()calls the legacyWindowCompat.SetDecorFitsSystemWindows(...)API unconditionally (regardless of the preference value):https://github.com/AvaloniaUI/Avalonia/blob/master/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs
WindowCompat.setDecorFitsSystemWindowsis itself an AndroidX compat shim that dispatches to per-SDK-levelEdgeToEdgeApi21/23/26/29/35impl classes, and those are what Play Console's static bytecode analysis flags as calling the deprecatedWindow.setStatusBarColor/setNavigationBarColor. This is flagged regardless of runtime SDK branching elsewhere in the file (e.g. the existingif (!OperatingSystem.IsAndroidVersionAtLeast(35))guard aroundSystemBarColor's own direct calls) because Play's analysis traces reachable bytecode, not executed branches.Play Console's own advisory text suggests the fix: "call enableEdgeToEdge() for Kotlin or EdgeToEdge.enable() for Java for backward compatibility" — i.e. migrate off
WindowCompat.SetDecorFitsSystemWindowsonto the modernandroidx.activity.EdgeToEdge/WindowCompat.EnableEdgeToEdgehelper..NET MAUI hit the identical advisory and is fixing it the same way: migrating
MauiAppCompatActivity.OnCreatefromSetDecorFitsSystemWindows(Window, false)toWindowCompat.EnableEdgeToEdge(Window)— see dotnet/maui#36226 (open, targets .NET 11).To Reproduce
targetSdkVersion 35/SupportedOSPlatformVersionhigh enough to trigger Android 15 edge-to-edge enforcement).TopLevel.InsetsManager.DisplayEdgeToEdgePreference = truesomewhere in the view lifecycle (e.g.OnAttachedToVisualTree).androidx.activity.EdgeToEdgeApi35.setUpas the origin.Expected behavior
Enabling
DisplayEdgeToEdgePreference(or Avalonia's Android edge-to-edge support generally) should route through AndroidX's modernEdgeToEdge.enable()/WindowCompat.EnableEdgeToEdgeAPI rather than the legacyWindowCompat.SetDecorFitsSystemWindows, so apps don't carry a reachable deprecated-API call purely from using Avalonia's own insets plumbing.Environment
SupportedOSPlatformVersion23, targeting SDK 35