public final class

MediaSession.ControllerInfo

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.MediaSession.ControllerInfo

Overview

Information of a MediaController or a MediaBrowser.

Summary

Fields
public static final intLEGACY_CONTROLLER_INTERFACE_VERSION

The MediaSession.ControllerInfo.getInterfaceVersion() interface version} of legacy controllers.

public static final java.lang.StringLEGACY_CONTROLLER_PACKAGE_NAME

The MediaSession.ControllerInfo.getPackageName() of legacy controllers if a more precise package cannot be obtained.

public static final intLEGACY_CONTROLLER_VERSION

The controller version of legacy controllers.

Methods
public static MediaSession.ControllerInfocreateTestOnlyControllerInfo(MediaSessionManager.RemoteUserInfo remoteUserInfo, int libraryVersion, int interfaceVersion, boolean trusted, Bundle connectionHints)

public static MediaSession.ControllerInfocreateTestOnlyControllerInfo(java.lang.String packageName, int pid, int uid, int libraryVersion, int interfaceVersion, boolean trusted, Bundle connectionHints)

Returns a MediaSession.ControllerInfo suitable for use when testing client code.

public booleanequals(java.lang.Object obj)

public BundlegetConnectionHints()

Returns the connection hints sent from controller.

public intgetControllerVersion()

Returns the library version of the controller.

public intgetInterfaceVersion()

Returns the interface version of the controller, or 0 if it's a legacy controller.

public java.lang.StringgetPackageName()

Returns the package name, or MediaSession.ControllerInfo.LEGACY_CONTROLLER_PACKAGE_NAME on API ≤ 24.

public intgetUid()

Returns the UID of the controller.

public inthashCode()

public booleanisTrusted()

Returns if the controller has been granted android.permission.MEDIA_CONTENT_CONTROL or has an enabled notification listener so it can be trusted to accept connection and incoming command requests.

public java.lang.StringtoString()

from java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait

Fields

public static final int LEGACY_CONTROLLER_VERSION

The controller version of legacy controllers.

public static final int LEGACY_CONTROLLER_INTERFACE_VERSION

The MediaSession.ControllerInfo.getInterfaceVersion() interface version} of legacy controllers.

public static final java.lang.String LEGACY_CONTROLLER_PACKAGE_NAME

The MediaSession.ControllerInfo.getPackageName() of legacy controllers if a more precise package cannot be obtained.

Methods

public int getControllerVersion()

Returns the library version of the controller.

It will be the same as MediaLibraryInfo.VERSION_INT of the controller, or less than 1000000 if the controller is a legacy controller.

public int getInterfaceVersion()

Returns the interface version of the controller, or 0 if it's a legacy controller.

public java.lang.String getPackageName()

Returns the package name, or MediaSession.ControllerInfo.LEGACY_CONTROLLER_PACKAGE_NAME on API ≤ 24.

public int getUid()

Returns the UID of the controller. Can be a negative value for interoperability.

Interoperability: If SDK_INT < 28, then UID would be a negative value because it cannot be obtained.

public Bundle getConnectionHints()

Returns the connection hints sent from controller.

public boolean isTrusted()

Returns if the controller has been granted android.permission.MEDIA_CONTENT_CONTROL or has an enabled notification listener so it can be trusted to accept connection and incoming command requests.

public int hashCode()

public boolean equals(java.lang.Object obj)

public java.lang.String toString()

public static MediaSession.ControllerInfo createTestOnlyControllerInfo(MediaSessionManager.RemoteUserInfo remoteUserInfo, int libraryVersion, int interfaceVersion, boolean trusted, Bundle connectionHints)

Deprecated: Use MediaSession.ControllerInfo.createTestOnlyControllerInfo(String, int, int, int, int, boolean, Bundle) instead.

public static MediaSession.ControllerInfo createTestOnlyControllerInfo(java.lang.String packageName, int pid, int uid, int libraryVersion, int interfaceVersion, boolean trusted, Bundle connectionHints)

Returns a MediaSession.ControllerInfo suitable for use when testing client code.