Added in API level 28

RemoteUserInfo


class RemoteUserInfo
kotlin.Any
   ↳ android.media.session.MediaSessionManager.RemoteUserInfo

Information of a remote user of MediaSession or MediaBrowserService. This can be used to decide whether the remote user is trusted app, and also differentiate caller of MediaSession and MediaBrowserService callbacks.

See equals(java.lang.Object) to take a look at how it differentiate media controller.

Summary

Public constructors
RemoteUserInfo(packageName: String, pid: Int, uid: Int)

Create a new remote user information.

Public methods
Boolean
equals(other: Any?)

Returns equality of two RemoteUserInfo.

String!

Int

Int

Int

Returns a hash code value for the object.

Public constructors

RemoteUserInfo

Added in API level 28
RemoteUserInfo(
    packageName: String,
    pid: Int,
    uid: Int)

Create a new remote user information.

Parameters
packageName String: The package name of the remote user.
This value cannot be null.
pid Int: The pid of the remote user
uid Int: The uid of the remote user

Public methods

equals

Added in API level 28
fun equals(other: Any?): Boolean

Returns equality of two RemoteUserInfo. Two RemoteUserInfo objects are equal if and only if they have the same package name, same pid, and same uid.

Parameters
obj the reference object with which to compare.
This value may be null.
Return
Boolean true if equals, false otherwise

getPackageName

Added in API level 28
fun getPackageName(): String!
Return
String! package name of the controller

getPid

Added in API level 28
fun getPid(): Int
Return
Int pid of the controller

getUid

Added in API level 28
fun getUid(): Int
Return
Int uid of the controller

hashCode

Added in API level 28
fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Return
Int a hash code value for this object.