tonihei b03b22575f More safely clean potential dangling references from binder stubs
Binder stubs are GC roots and may be accidentally kept long after
the surrounding objects are gone (this is partially outside our
control, e.g. another app keeps a MediaController).

To prevent memory leaks, these binder stubs need to stop referencing
other instances whose data may be kept as well.

 - All stubs except one already use a WeakReference for the main
   owning class, which is cleared as soon as the class is released.
   - This change replace the AtomicReference in ExtraSession with
     a WeakReference to make it safer.
 - If the stub holds lists of data, these should be all cleared when
   released. This wasn't done in all cases yet.
 - Some local fields for MediaSessionManager can be removed entirely
   by just accessing the static variable on demand.

PiperOrigin-RevId: 755879020
2025-05-07 09:10:27 -07:00
..
2021-10-27 09:12:46 +01:00

Session module

This module provides media session functionality through which media information and controls can be exposed to the Android platform, as well as to other processes and applications.

Getting the module

The easiest way to get the module is to add it as a gradle dependency:

implementation 'androidx.media3:media3-session:1.X.X'

where 1.X.X is the version, which must match the version of the other media modules being used.

Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.