public final class

MediaSession.ControllerInfo

extends java.lang.Object

 java.lang.Object

↳androidx.media2.session.MediaSession.ControllerInfo

Overview

Information of a controller.

Summary

Methods
public booleanequals(java.lang.Object obj)

public BundlegetConnectionHints()

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

public java.lang.StringgetPackageName()

Gets the package name.

public intgetUid()

Gets the UID of the controller.

public inthashCode()

public booleanisTrusted()

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

public java.lang.StringtoString()

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

Methods

public java.lang.String getPackageName()

Gets the package name. Can be 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 with UID.
It's sufficient for most cases, but doesn't precisely distinguish caller if it uses shared user ID.
21 ≤ SDK_VERSION < 24 LEGACY_CONTROLLER

Returns:

package name of the controller. Can be LEGACY_CONTROLLER if the package name cannot be obtained.

public int getUid()

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

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

Returns:

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

public Bundle getConnectionHints()

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

public boolean isTrusted()

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

Returns:

true if the controller is trusted.

public int hashCode()

public boolean equals(java.lang.Object obj)

public java.lang.String toString()