Class ShadowBinder

java.lang.Object
org.robolectric.shadows.ShadowBinder

@Implements(android.os.Binder.class) public class ShadowBinder extends Object
  • Constructor Details

    • ShadowBinder

      public ShadowBinder()
  • Method Details

    • transact

      @Implementation protected boolean transact(int code, Parcel data, Parcel reply, int flags) throws RemoteException
      Throws:
      RemoteException
    • getCallingPid

      @Implementation protected static int getCallingPid()
    • getCallingUid

      @Implementation protected static int getCallingUid()
    • getCallingUidOrThrow

      @Implementation(minSdk=29) protected static int getCallingUidOrThrow()
      See Binder.getCallingUidOrThrow(). Whether or not this returns a value is controlled by setCallingUid(int) (to set the value to be returned) or by reset() (to trigger the exception).
      Returns:
      the value set by setCallingUid(int)
      Throws:
      IllegalStateException - if no UID has been set
    • getCallingUserHandle

      @Implementation protected static UserHandle getCallingUserHandle()
    • setCallingPid

      public static void setCallingPid(int pid)
    • setCallingUid

      public static void setCallingUid(int uid)
    • setCallingUserHandle

      public static void setCallingUserHandle(UserHandle userHandle)
      Configures Binder.getCallingUserHandle() to return the specified UserHandle to subsequent callers on *any* thread, for testing purposes.
    • reset

      @Resetter public static void reset()