Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Offloaded audio left paused keeps AudioFlinger's AudioOffload wake lock forever, device never suspends

Open
#3,493 1 comment 0 reactions 1 assignee View on GitHub

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

bug
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());
  1. Play a local MP3 with audio offload enabled.
  2. adb shell dumpsys power shows PARTIAL_WAKE_LOCK 'AudioOffload' (uid=1041).
  3. Pause. In Twelve, turn the screen off. In the demo app, keep the screen on, because PlayerActivity releases the player in onStop().
  4. Run adb shell dumpsys power again 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 bugreport to [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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from androidx/media

All issues in androidx/media

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.