Package org.robolectric.shadows
Class ShadowBinder
java.lang.Object
org.robolectric.shadows.ShadowBinder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static intprotected static intprotected static intprotected static UserHandleprotected voidlinkToDeath(IBinder.DeathRecipient deathRecipient, int flags) static voidreset()static voidsetCallingPid(int pid) static voidsetCallingUid(int uid) static voidsetCallingUserHandle(UserHandle userHandle) ConfiguresBinder.getCallingUserHandle()to return the specifiedUserHandleto subsequent callers on *any* thread, for testing purposes.protected booleanprotected booleanunlinkToDeath(IBinder.DeathRecipient deathRecipient, int flags)
-
Constructor Details
-
ShadowBinder
public ShadowBinder()
-
-
Method Details
-
transact
@Implementation protected boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException - Throws:
RemoteException
-
linkToDeath
-
unlinkToDeath
-
getCallingPid
@Implementation protected static int getCallingPid() -
getCallingUid
@Implementation protected static int getCallingUid() -
getCallingUidOrThrow
@Implementation(minSdk=29) protected static int getCallingUidOrThrow()SeeBinder.getCallingUidOrThrow(). Whether or not this returns a value is controlled bysetCallingUid(int)(to set the value to be returned) or byreset()(to trigger the exception).- Returns:
- the value set by
setCallingUid(int) - Throws:
IllegalStateException- if no UID has been set
-
getCallingUserHandle
-
getDeathRecipients
-
setCallingPid
public static void setCallingPid(int pid) -
setCallingUid
public static void setCallingUid(int uid) -
setCallingUserHandle
ConfiguresBinder.getCallingUserHandle()to return the specifiedUserHandleto subsequent callers on *any* thread, for testing purposes. -
reset
@Resetter public static void reset()
-