Update session module registration
PiperOrigin-RevId: 636482934
This commit is contained in:
parent
37c2d9957e
commit
08006651fa
@ -40,6 +40,7 @@ import androidx.media3.common.AudioAttributes;
|
||||
import androidx.media3.common.C;
|
||||
import androidx.media3.common.DeviceInfo;
|
||||
import androidx.media3.common.MediaItem;
|
||||
import androidx.media3.common.MediaLibraryInfo;
|
||||
import androidx.media3.common.MediaMetadata;
|
||||
import androidx.media3.common.PlaybackException;
|
||||
import androidx.media3.common.PlaybackParameters;
|
||||
@ -520,6 +521,7 @@ public class MediaController implements Player {
|
||||
|
||||
/** Creates a {@link MediaController} from the {@link SessionToken}. */
|
||||
// This constructor has to be package-private in order to prevent subclassing outside the package.
|
||||
@SuppressWarnings("argument.type.incompatible") // Using this in System.identityHashCode
|
||||
/* package */ MediaController(
|
||||
Context context,
|
||||
SessionToken token,
|
||||
@ -530,6 +532,15 @@ public class MediaController implements Player {
|
||||
@Nullable BitmapLoader bitmapLoader) {
|
||||
checkNotNull(context, "context must not be null");
|
||||
checkNotNull(token, "token must not be null");
|
||||
Log.i(
|
||||
TAG,
|
||||
"Init "
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " ["
|
||||
+ MediaLibraryInfo.VERSION_SLASHY
|
||||
+ "] ["
|
||||
+ Util.DEVICE_DEBUG_INFO
|
||||
+ "]");
|
||||
|
||||
// Initialize default values.
|
||||
window = new Timeline.Window();
|
||||
@ -583,6 +594,17 @@ public class MediaController implements Player {
|
||||
if (released) {
|
||||
return;
|
||||
}
|
||||
Log.i(
|
||||
TAG,
|
||||
"Release "
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " ["
|
||||
+ MediaLibraryInfo.VERSION_SLASHY
|
||||
+ "] ["
|
||||
+ Util.DEVICE_DEBUG_INFO
|
||||
+ "] ["
|
||||
+ MediaLibraryInfo.registeredModules()
|
||||
+ "]");
|
||||
released = true;
|
||||
applicationHandler.removeCallbacksAndMessages(null);
|
||||
try {
|
||||
|
@ -232,10 +232,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
@DoNotMock
|
||||
public class MediaSession {
|
||||
|
||||
static {
|
||||
MediaLibraryInfo.registerModule("media3.session");
|
||||
}
|
||||
|
||||
// It's better to have private static lock instead of using MediaSession.class because the
|
||||
// private lock object isn't exposed.
|
||||
private static final Object STATIC_LOCK = new Object();
|
||||
|
@ -111,7 +111,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
|
||||
private static final long DEFAULT_SESSION_POSITION_UPDATE_DELAY_MS = 3_000;
|
||||
|
||||
public static final String TAG = "MSImplBase";
|
||||
public static final String TAG = "MediaSessionImpl";
|
||||
|
||||
private static final SessionResult RESULT_WHEN_CLOSED = new SessionResult(RESULT_INFO_SKIPPED);
|
||||
|
||||
@ -154,6 +154,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
private ImmutableList<CommandButton> customLayout;
|
||||
private Bundle sessionExtras;
|
||||
|
||||
@SuppressWarnings("argument.type.incompatible") // Using this in System.identityHashCode
|
||||
public MediaSessionImpl(
|
||||
MediaSession instance,
|
||||
Context context,
|
||||
@ -167,6 +168,15 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
BitmapLoader bitmapLoader,
|
||||
boolean playIfSuppressed,
|
||||
boolean isPeriodicPositionUpdateEnabled) {
|
||||
Log.i(
|
||||
TAG,
|
||||
"Init "
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " ["
|
||||
+ MediaLibraryInfo.VERSION_SLASHY
|
||||
+ "] ["
|
||||
+ Util.DEVICE_DEBUG_INFO
|
||||
+ "]");
|
||||
this.instance = instance;
|
||||
this.context = context;
|
||||
sessionId = id;
|
||||
@ -283,6 +293,17 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
Log.i(
|
||||
TAG,
|
||||
"Release "
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " ["
|
||||
+ MediaLibraryInfo.VERSION_SLASHY
|
||||
+ "] ["
|
||||
+ Util.DEVICE_DEBUG_INFO
|
||||
+ "] ["
|
||||
+ MediaLibraryInfo.registeredModules()
|
||||
+ "]");
|
||||
synchronized (lock) {
|
||||
if (closed) {
|
||||
return;
|
||||
|
@ -73,6 +73,10 @@ import java.util.List;
|
||||
// android.media.session.MediaSessionManager.Callback#onAddressedPlayerChanged
|
||||
public final class SessionToken implements Bundleable {
|
||||
|
||||
static {
|
||||
MediaLibraryInfo.registerModule("media3.session");
|
||||
}
|
||||
|
||||
private static final long WAIT_TIME_MS_FOR_SESSION3_TOKEN = 500;
|
||||
|
||||
/** Types of {@link SessionToken}. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user