Offloaded audio left paused keeps AudioFlinger's AudioOffload wake lock forever, device never suspends
Maintainers usually reply within 5 days
@microkatz is already working on this.
Since Oct 28, 2026.
Assessment
This issue has not been assessed yet.
Description
Version
Media3 1.11.1
More version details
Seen in LineageOS Twelve (org.lineageos.twelve, bundles Media3 1.11.1, audio offload enabled by default). The same code is on main: DefaultAudioSink.pause() → AudioTrackAudioOutput.pause() only calls AudioTrack.pause(), and nothing releases the offloaded track while the player stays paused.
Devices that reproduce the issue
Motorola moto g52 (rhode, SM6225), LineageOS 24.0 (Android 17).
Devices that do not reproduce the issue
Not tested.
Reproducible in the demo app?
Yes
Reproduction steps
The demo app has no offload switch, so I enabled it in PlayerActivity.initializePlayer() (1.11.1 tag):
player.setTrackSelectionParameters(
trackSelectionParameters.buildUpon()
.setAudioOffloadPreferences(
new TrackSelectionParameters.AudioOffloadPreferences.Builder()
.setAudioOffloadMode(
TrackSelectionParameters.AudioOffloadPreferences.AUDIO_OFFLOAD_MODE_ENABLED)
.build())
.build());
- Play a local MP3 with audio offload enabled.
adb shell dumpsys powershowsPARTIAL_WAKE_LOCK 'AudioOffload' (uid=1041).- Pause. In Twelve, turn the screen off. In the demo app, keep the screen on, because
PlayerActivityreleases the player inonStop(). - Run
adb shell dumpsys poweragain a few minutes later.
Expected result
The paused offloaded output goes to standby after a timeout, and the device can suspend.
The platform player does this: NuPlayer::Renderer tears down the offloaded AudioTrack after kOffloadPauseMaxUs (10 s). AudioFlinger depends on that. From DirectOutputThread::shouldStandby_l():
// do not put the HAL in standby when paused. NuPlayer clear the offloaded AudioTrack
// after a timeout and we will enter standby then.
Actual result
audioserver holds the AudioOffload wake lock for as long as the player stays paused.
In the demo app, 3 minutes after pausing:
PARTIAL_WAKE_LOCK 'AudioOffload' ACQ=-3m16s681ms LONG (uid=1041 ...)
Output thread ..., name AudioOut_ED, type 4 (OFFLOAD):
Standby: no
In one real case, the user paused at 18:47 and left the phone. The wake lock was held for 20.7 hours, until the app was used again the next afternoon. Overnight (8.5 h) the kernel suspend count stayed at 0, and the battery drained at 44 mA on average, against about 8 mA on other nights.
player.stop() (here via cmd media_session dispatch stop) releases the wake lock within a few seconds. The position is kept and play resumes from it. I currently use that as a workaround: a script stops the session after 2 minutes of paused offload.
A possible fix is to do what NuPlayer does: release the offloaded AudioTrack after the player has been paused in offload mode for a few seconds, and recreate it on resume. Alternatively, the offload docs could say that apps have to stop the player on long pauses.
Media
Any local MP3 (tested with 44.1 kHz stereo).
Bug Report
- You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
The bug report was captured with Twelve paused for 3.4 minutes and the screen off, while the wake lock was held.
Assisted-by: LLM
- Dominant language
- Java
- Stars
- 3.1k
- Forks
- 998
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from androidx/media
-
Cast: system output switcher on Samsung One UI 9 (Android 17) only offers Samsung Audio Mirroring, never a Cast sessionPossibly taken @tanay187 claimed this today. Openbug cast needs triage
androidx/media#3500 · 3 comments · 2 assignees ·
Maintainers usually reply within 5 days
-
Waive ads when seek/start at the beginningPossibly taken @microkatz claimed this 2 days ago. Openenhancement
androidx/media#3496 · 3 comments · 1 assignee ·
Maintainers usually reply within 5 days
-
Since 1.9.0, skip buttons in SLOT_BACK / SLOT_FORWARD reach legacy controllers as custom actionsPossibly taken @marcbaechinger claimed this 2 days ago. Openbug
androidx/media#3495 · 1 comment · 1 assignee ·
Maintainers usually reply within 5 days
-
Allow configuring asset-list prefetch timing per HLS interstitialPossibly taken @marcbaechinger claimed this 3 days ago. Openenhancement
androidx/media#3494 · 3 comments · 1 assignee ·
Maintainers usually reply within 5 days
-
Allow opting into frame-index seeking for MP3s without reliable seek metadataPossibly taken @icbaker claimed this 2 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
androidx/media#3492 · 1 assignee ·
Maintainers usually reply within 5 days
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
IdentityArrayObjectSet iterator remove may throw ArrayIndexOutOfBoundsExceptionPossibly taken @jiteshkhatri11 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
javapathfinder/jpf-core#660 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
breaking change bug needs human review not ready priority medium size S
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
martin-francois/symphony-trello#1193 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day