ControllerInfo

class ControllerInfo
kotlin.Any
   ↳ androidx.media2.session.MediaSession.ControllerInfo

Information of a controller.

Summary

Public methods
Boolean
equals(other: Any?)

Bundle

Gets the connection hints sent from controller, or Bundle#EMPTY if none.

String

Gets the package name.

Int

Gets the UID of the controller.

Int

String

Public methods

equals

fun equals(other: Any?): Boolean

getConnectionHints

@NonNull fun getConnectionHints(): Bundle

Gets the connection hints sent from controller, or Bundle#EMPTY if none.

getPackageName

@NonNull fun getPackageName(): String

Gets the package name. Can be androidx.media.MediaSessionManager.RemoteUserInfo#LEGACY_CONTROLLER for interoperability.

Interoperability: Package name may not be precisely obtained for legacy controller API on older device. Here are details.

SDK version when package name isn't precise ControllerInfo#getPackageName() for legacy controller
SDK_VERSION < 21 Actual package name via PackageManager#getNameForUid with UID.
It's sufficient for most cases, but doesn't precisely distinguish caller if it uses shared user ID.
21SDK_VERSION < 24 LEGACY_CONTROLLER
Return
String package name of the controller. Can be LEGACY_CONTROLLER if the package name cannot be obtained.

getUid

fun getUid(): Int

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

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

Return
Int uid of the controller. Can be a negative value if the uid cannot be obtained.

hashCode

fun hashCode(): Int

toString

fun toString(): String