RemoteUserInfo
class RemoteUserInfo
kotlin.Any | |
↳ | androidx.media.MediaSessionManager.RemoteUserInfo |
Information of a remote user of MediaSessionCompat
or MediaBrowserServiceCompat
. This can be used to decide whether the remote user is trusted app, and also differentiate caller of MediaSessionCompat
and MediaBrowserServiceCompat
callbacks.
See equals(Object)
to take a look at how it differentiate media controller.
Summary
Constants |
|
---|---|
static String |
Used by |
Public constructors |
|
---|---|
Public constructor. |
Public methods |
|
---|---|
Boolean |
Returns equality of two RemoteUserInfo by comparing their package name, UID, and PID. |
String | |
Int |
getPid() |
Int |
getUid() |
Int |
hashCode() |
Constants
LEGACY_CONTROLLER
static val LEGACY_CONTROLLER: String
Used by getPackageName()
when the session is connected to the legacy controller whose exact package name cannot be obtained.
Value: "android.media.session.MediaController"
Public constructors
<init>
RemoteUserInfo(@NonNull packageName: String, pid: Int, uid: Int)
Public constructor.
Can be used for MediaSessionManager#isTrustedForMediaControl(RemoteUserInfo)
}.
Parameters | |
---|---|
packageName |
String: package name of the remote user |
pid |
String: pid of the remote user |
uid |
String: uid of the remote user |
Public methods
equals
fun equals(@Nullable other: Any?): Boolean
Returns equality of two RemoteUserInfo by comparing their package name, UID, and PID.
On P and before (API <= 28), two RemoteUserInfo objects equal if following conditions are met:
- UID and package name are the same
- One of the RemoteUserInfo's PID is UNKNOWN_PID or both of RemoteUserInfo's PID are the same
Parameters | |
---|---|
obj |
Any?: the reference object with which to compare. |
Return | |
---|---|
Boolean: true if equals, false otherwise |
getPackageName
@NonNull fun getPackageName(): String
Return | |
---|---|
String: package name of the controller. Can be LEGACY_CONTROLLER if the package name cannot be obtained. |
getPid
fun getPid(): Int
Return | |
---|---|
Int: pid of the controller. Can be a negative value if the pid cannot be obtained. |
getUid
fun getUid(): Int
Return | |
---|---|
Int: uid of the controller. Can be a negative value if the uid cannot be obtained. |
hashCode
fun hashCode(): Int