public static IBinder factory(Context context, String name, IBinder binder) {
        String descriptor = null;
        try {
            descriptor = binder.getInterfaceDescriptor();
        } catch (RemoteException e) {
            if (DEBUG) {
                Log.d(TAG, "getInterfaceDescriptor()", e);
            }
        }
        android.os.IInterface iin = binder.queryLocalInterface(descriptor);
        if (iin != null) {
            /**
             * If the requested interface has local implementation, meaning that
             * it's living in the same process as the one who requests for it,
             * return the binder directly since in such cases our wrapper does
             * not help in any way.
             */
            return binder;
        }
        return new ServiceWrapper(context, name, binder);
    }
A Binder Wrapper class that monitors the death of the underlying remote
Binder and recovers it if needed.

@author RePlugin Team
replugin-host-library/replugin-host-lib/src/main/java/com/qihoo360/mobilesafe/svcmanager/ServiceWrapper.java