Android 17 Silently Kills Background Audio Playback Unless You Use MediaSessionService
Any app that plays audio in the background — music players, podcast clients, navigation apps, alarm apps — will break silently on Android 17 without a foreground service carrying WIU capability. The silent-failure design means crash-free metrics won't catch it; only user complaints will.
Google's audio policy is tightening across two Android releases. Starting with targetSdk 35, requesting audio focus fails unless the app is in the foreground or running a foreground service. Android 17 escalates this into a full-chain lockdown: `AudioTrack.write()`, `AAudioStream_write`, and even volume APIs like `setStreamVolume()` silently fail in the background with no exceptions or log output. The only reliable escape hatch is a foreground service that carries "When In Use" (WIU) capability — and `SHORT_SERVICE` type services are explicitly excluded.
The practical consequence is that Media3's `MediaSessionService` stops being a recommendation and becomes the single viable implementation path. Apps handling audio manually or using older player APIs will hit silent failures that are nearly impossible to diagnose in production without `dumpsys audio` or a debug-only hardening flag. The change also breaks background preloading, boot-time autoplay, and independent volume controls that operate while the app isn't visible.
For teams still targeting SDK 34 or below, these restrictions are dormant but inevitable. The migration surface is large: foreground service lifecycle management, audio focus handling, and player stack rewrites all land at once if you jump straight to targetSdk 37, where WIU requirements tighten further unless the app holds `SCHEDULE_EXACT_ALARM` and operates on the `USAGE_ALARM` stream.
Google is building an audio system where background playback is treated as a privilege gated entirely by user-visible presence, not by app capability or developer intent.
The silent-failure design shifts the debugging burden entirely onto developers — crash analytics won't surface these breakages, so only user complaints or proactive `dumpsys` monitoring will catch them.
Media3's `MediaSessionService` transitions from a best-practice recommendation to a de facto hard requirement; any app maintaining a custom audio stack faces an existential migration decision.
The WIU concept introduces a tiered foreground-service model that most developers haven't internalized yet, and the distinction between standard FGS, BFSL, and system-initiated FGS will become a common source of subtle playback bugs.