1 package org.robolectric.shadows; 2 3 import android.os.Binder; 4 import android.os.Parcel; 5 import android.os.RemoteException; 6 import org.robolectric.annotation.internal.DoNotInstrument; 7 import org.robolectric.util.ReflectionHelpers; 8 import org.robolectric.util.ReflectionHelpers.ClassParameter; 9 10 /** 11 * Bridge between shadow and {@link android.os.Binder}. 12 */ 13 @DoNotInstrument 14 public class ShadowBinderBridge { 15 private Binder realBinder; 16 17 public ShadowBinderBridge(Binder realBinder) { 18 this.realBinder = realBinder; 19 } 20 21 public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException { 22 return ReflectionHelpers.callInstanceMethod(realBinder, "onTransact", 23 ClassParameter.from(int.class, code), 24 ClassParameter.from(Parcel.class, data), 25 ClassParameter.from(Parcel.class, reply), 26 ClassParameter.from(int.class, flags)); 27 } 28 } 29