MediaSessionManager.RemoteUserInfo
class 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
to take a look at how it differentiate media controller.
See also | |
---|---|
isTrustedForMediaControl |
Summary
Constants |
|
---|---|
const String! |
LEGACY_CONTROLLER = "android.media.session.MediaController" Used by |
Public constructors |
---|
RemoteUserInfo(packageName: String, pid: Int, uid: Int) Public constructor. |
Public functions |
|
---|---|
Boolean |
Returns equality of two RemoteUserInfo by comparing their package name, UID, and PID. |
String |
|
Int |
getPid() |
Int |
getUid() |
Int |
hashCode() |
Constants
LEGACY_CONTROLLER
const val LEGACY_CONTROLLER = "android.media.session.MediaController": String!
Used by getPackageName
when the session is connected to the legacy controller whose exact package name cannot be obtained.
Public constructors
RemoteUserInfo
RemoteUserInfo(packageName: String, pid: Int, uid: Int)
Public constructor.
Can be used for isTrustedForMediaControl
}.
Parameters | |
---|---|
packageName: String |
package name of the remote user |
pid: Int |
pid of the remote user |
uid: Int |
uid of the remote user |
Throws | |
---|---|
java.lang.IllegalArgumentException |
if package name is empty |
Public functions
equals
fun equals(obj: 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. |
Returns | |
---|---|
Boolean |
|
getPackageName
fun getPackageName(): String
Returns | |
---|---|
String |
package name of the controller. Can be |
getPid
fun getPid(): Int
Returns | |
---|---|
Int |
pid of the controller. Can be a negative value if the pid cannot be obtained. |