Skip to content

Android: DisplayEdgeToEdgePreference still triggers Play Console's deprecated edge-to-edge API advisory #22042

Description

@Duracell1989

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

  1. Create an Avalonia Android app targeting API 35 (targetSdkVersion 35 / SupportedOSPlatformVersion high enough to trigger Android 15 edge-to-edge enforcement).
  2. Set TopLevel.InsetsManager.DisplayEdgeToEdgePreference = true somewhere in the view lifecycle (e.g. OnAttachedToVisualTree).
  3. Build a release AAB and upload it to Google Play Console.
  4. 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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions