fix: set up edge-to-edge without Android 15's deprecated window APIs
Play's release dashboard listed Window.setStatusBarColor, Window.setNavigationBarColor and LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES under "deprecated APIs or parameters for edge-to-edge", starting in vr.b, xr.b and zr.b. None of those are app code: the R8 mapping resolves vr/xr/zr to androidx.activity's EdgeToEdgeApi26/29/35, and a dexdump of the release DEX finds six calls to the two colour setters, all reached through ComponentActivity.enableEdgeToEdge(). Its per-API implementations still paint the bar scrims (API 21/26/29) and select SHORT_EDGES on API 28/29, which Android 15 deprecates for apps targeting SDK 35+. MainActivity now calls ui/theme/EdgeToEdge.applyEdgeToEdge() instead. It keeps the parts that still matter - setDecorFitsSystemWindows(false), navigation-bar contrast off, cutout mode "always" on API 30+, and light/dark bar icons read from the system night mode - and drops the scrim writes. The transparent bars continue to come from the XML theme, which does not compile into a DEX call, so pre-35 devices look unchanged; API 28/29 keep the platform default cutout mode rather than the deprecated SHORT_EDGES. The insets handling in ScannerScreen (TopAppBar and navigationBarsPadding) is untouched. Verified on the connected Android 12 device in both light and dark mode: the window reports layoutInDisplayCutoutMode=always and the expected LIGHT_STATUS_BAR/LIGHT_NAVIGATION_BAR flags, and the screenshots show content behind both bars with readable icons. The rebuilt release APK and AAB contain zero references to setStatusBarColor/setNavigationBarColor and no androidx.activity.EdgeToEdge classes; testDebugUnitTest and lintDebug pass (only the pre-existing OldTargetApi warning). CHANGELOG records the change.
This commit is contained in:
@@ -10,6 +10,19 @@ upload needs a **higher `versionCode`** than every previous upload.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Play Console no longer reports deprecated edge-to-edge APIs.** The release build contained
|
||||
`Window.setStatusBarColor`, `Window.setNavigationBarColor` and
|
||||
`LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES`, all of which Android 15 deprecates for apps
|
||||
targeting SDK 35+. They came from `ComponentActivity.enableEdgeToEdge()` (androidx.activity
|
||||
1.13.0), whose per-API-level implementations still set the status/navigation bar scrims and use
|
||||
the deprecated cutout mode on API 28/29. `ui/theme/EdgeToEdge` now performs the same setup with
|
||||
current APIs only: `WindowCompat.setDecorFitsSystemWindows`, navigation-bar contrast off, cutout
|
||||
mode `always` on API 30+, and light/dark bar icons following the system night mode. `MainActivity`
|
||||
calls it instead of `enableEdgeToEdge()`; the theme still supplies the transparent bars below
|
||||
API 35, and the existing inset handling in `ScannerScreen` is unchanged.
|
||||
|
||||
## [1.0.1] — 2026-10-13 · versionCode 2
|
||||
|
||||
### Fixed
|
||||
|
||||
Reference in New Issue
Block a user