当前位置: 首页>>代码示例>>Java>>正文


Java IInterface类代码示例

本文整理汇总了Java中android.os.IInterface的典型用法代码示例。如果您正苦于以下问题:Java IInterface类的具体用法?Java IInterface怎么用?Java IInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IInterface类属于android.os包,在下文中一共展示了IInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: call

import android.os.IInterface; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    String creator = (String) args[1];
    String[] resolvedTypes = (String[]) args[6];
    int type = (int) args[0];
    int flags = (int) args[7];
    if ((PendingIntent.FLAG_UPDATE_CURRENT & flags) != 0) {
        flags = (flags & ~(PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_NO_CREATE)) | PendingIntent.FLAG_CANCEL_CURRENT;
    }
    if (args[5] instanceof Intent[]) {
        Intent[] intents = (Intent[]) args[5];
        if (intents.length > 0) {
            Intent intent = intents[intents.length - 1];
            if (resolvedTypes != null && resolvedTypes.length > 0) {
                intent.setDataAndType(intent.getData(), resolvedTypes[resolvedTypes.length - 1]);
            }
            Intent targetIntent = redirectIntentSender(type, creator, intent);
            if (targetIntent != null) {
                args[5] = new Intent[]{targetIntent};
            }
        }
    }
    args[7] = flags;
    args[1] = getHostPkg();
    // Force userId to 0
    if (args[args.length - 1] instanceof Integer) {
        args[args.length - 1] = 0;
    }
    IInterface sender = (IInterface) method.invoke(who, args);
    if (sender != null && creator != null) {
        VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
    }
    return sender;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:35,代码来源:MethodProxies.java

示例2: HookHandler

import android.os.IInterface; //导入依赖的package包/类
public HookHandler(IBinder base, Class<?> stubClass,
                   InvocationHandler InvocationHandler) {
    mInvocationHandler = InvocationHandler;

    try {
        Method asInterface = stubClass.getDeclaredMethod("asInterface", IBinder.class);
        this.mBase = asInterface.invoke(null, base);

        Class clazz = mBase.getClass();
        Field mRemote = clazz.getDeclaredField("mRemote");
        mRemote.setAccessible(true);
        //新建一个 BinderProxy 的代理对象
        Object binderProxy = Proxy.newProxyInstance(mBase.getClass().getClassLoader(),
                new Class[] {IBinder.class}, new TransactionWatcherHook((IBinder) mRemote.get(mBase), (IInterface) mBase));
        mRemote.set(mBase, binderProxy);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:zhaozepeng,项目名称:ServiceHook,代码行数:20,代码来源:ServiceHook.java

示例3: getInterface

import android.os.IInterface; //导入依赖的package包/类
public static final IInterface getInterface(int type, IBinder binder) {
    switch (type) {
        case 0:
            return SystemOptimizeStub.asInterface(binder);
        case 1:
            return VirusScanStub.asInterface(binder);
        case 2:
            return DisturbInterceptStub.asInterface(binder);
        case 3:
            return FileSafeEncryptStub.asInterface(binder);
        case 4:
            return PassWordSystemStub.asInterface(binder);
        case 5:
            return RootServiceStub.asInterface(binder);
        case 6:
            return PaySecureStub.asInterface(binder);
        case 7:
            return SoftMoveServiceStub.asInterface(binder);
        case 8:
            return NetworkMgrServiceStub.asInterface(binder);
        case 9:
            return AccountSecureStub.asInterface(binder);
        default:
            return null;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:27,代码来源:ServiceManager.java

示例4: initServiceHandlers

import android.os.IInterface; //导入依赖的package包/类
/**
 * Search for the fields marked with @{@link ServiceInfo}
 */
private void initServiceHandlers(Class targetClass, Object target, Context context) throws IllegalArgumentException {
    Field[] fields = targetClass.getDeclaredFields();
    for (Field field : fields) {
        ServiceInfo serviceInfo = field.getAnnotation(ServiceInfo.class);
        if (serviceInfo != null) {
            if (IInterface.class.isAssignableFrom(field.getType())) {
                addServiceHandler(serviceInfo, (Class<? extends IInterface>) field.getType(), context);
                addFieldInfo(serviceInfo, field, target);
            } else if (isRemoter(field.getType())) {
                addRemoterServiceHandler(serviceInfo, field.getType(), context);
                addFieldInfo(serviceInfo, field, target);

            } else {
                throw new IllegalArgumentException(field.getName() + " is not a field of type IInterface or Remoter");
            }
        }
    }
}
 
开发者ID:josesamuel,项目名称:serviceconnector,代码行数:22,代码来源:ServiceConnector.java

示例5: call

import android.os.IInterface; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IInterface sender = (IInterface) args[0];
    if (sender != null) {
        IBinder binder = sender.asBinder();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            PendingIntent pendingIntent = PendingIntentData.readPendingIntent(binder);
            Intent intent = PendingIntentJBMR2.getIntent.call(pendingIntent);
            if (intent != null) {
                String creator = intent.getStringExtra("_VA_|_creator_");
                if (creator != null) {
                    return creator;
                }
            }
        } else {
            PendingIntentData data = VActivityManager.get().getPendingIntent(binder);
            if (data != null) {
                return data.creator;
            }
        }
    }
    return super.call(who, method, args);
}
 
开发者ID:codehz,项目名称:container,代码行数:24,代码来源:GetPackageForIntentSender.java

示例6: getService

import android.os.IInterface; //导入依赖的package包/类
@Override
public IBinder getService(final Context context, ClassLoader classLoader, IBinder binder) {
	return new StubBinder(classLoader, binder) {
		@Override
		public InvocationHandler createHandler(Class<?> interfaceClass, final IInterface base) {
			return new InvocationHandler() {
				@Override
				public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
					try {
						return method.invoke(base, args);
					} catch (InvocationTargetException e) {
						if (e.getCause() != null) {
							throw e.getCause();
						}
						throw e;
					}
				}
			};
		}
	};
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:22,代码来源:ProxyServiceFactory.java

示例7: getService

import android.os.IInterface; //导入依赖的package包/类
@Override
public IBinder getService(final Context context, ClassLoader classLoader, IBinder binder) {
	return new StubBinder(classLoader, binder) {

		@Override
		public InvocationHandler createHandler(Class<?> interfaceClass, final IInterface base) {
			return new InvocationHandler() {
				@Override
				public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
					try {
						return method.invoke(base, args);
					} catch (InvocationTargetException e) {
						if (e.getCause() != null) {
							throw e.getCause();
						}
						throw e;
					}
				}
			};
		}

	};
}
 
开发者ID:codehz,项目名称:container,代码行数:24,代码来源:ProxyServiceFactory.java

示例8: call

import android.os.IInterface; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    IInterface appThread = (IInterface) args[0];
    Intent service = (Intent) args[1];
    String resolvedType = (String) args[2];
    if (service.getComponent() != null
            && getHostPkg().equals(service.getComponent().getPackageName())) {
        // for server process
        return method.invoke(who, args);
    }
    int userId = VUserHandle.myUserId();
    if (service.getBooleanExtra("_VA_|_from_inner_", false)) {
        userId = service.getIntExtra("_VA_|_user_id_", userId);
        service = service.getParcelableExtra("_VA_|_intent_");
    } else {
        if (isServerProcess()) {
            userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL);
        }
    }
    service.setDataAndType(service.getData(), resolvedType);
    ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, VUserHandle.myUserId());
    if (serviceInfo != null) {
        return VActivityManager.get().startService(appThread, service, resolvedType, userId);
    }
    return method.invoke(who, args);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:27,代码来源:MethodProxies.java

示例9: factory

import android.os.IInterface; //导入依赖的package包/类
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);
}
 
开发者ID:wangyupeng1-iri,项目名称:springreplugin,代码行数:22,代码来源:ServiceWrapper.java

示例10: call

import android.os.IInterface; //导入依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
	Object session = method.invoke(who, args);
	if (session instanceof IInterface) {
		return patchSession((IInterface) session);
	}
	return session;
}
 
开发者ID:codehz,项目名称:container,代码行数:9,代码来源:BasePatchSession.java

示例11: RemoteEventListener_Stub

import android.os.IInterface; //导入依赖的package包/类
/**
 * Initialize this {@link RemoteEventListener_Stub} with the given {@link RemoteEventListener} implementation
 *
 * @param serviceImpl An implementation of {@link RemoteEventListener}
 */
public RemoteEventListener_Stub(RemoteEventListener serviceImpl) {
    this.serviceImpl = serviceImpl;
    this.attachInterface(new IInterface() {
                             public IBinder asBinder() {
                                 return RemoteEventListener_Stub.this;
                             }
                         }
            , DESCRIPTOR);
}
 
开发者ID:josesamuel,项目名称:RxRemote,代码行数:15,代码来源:RemoteEventListener_Stub.java

示例12: RemoteEventManager_Stub

import android.os.IInterface; //导入依赖的package包/类
/**
 * Initialize this {@link RemoteEventManager_Stub} with the given {@link RemoteEventManager} implementation
 *
 * @param serviceImpl An implementation of {@link RemoteEventManager}
 */
public RemoteEventManager_Stub(RemoteEventManager serviceImpl) {
    this.serviceImpl = serviceImpl;
    this.attachInterface(new IInterface() {
                             public IBinder asBinder() {
                                 return RemoteEventManager_Stub.this;
                             }
                         }
            , DESCRIPTOR);
}
 
开发者ID:josesamuel,项目名称:RxRemote,代码行数:15,代码来源:RemoteEventManager_Stub.java

示例13: asInterface

import android.os.IInterface; //导入依赖的package包/类
public static ICustomTabsService asInterface(IBinder obj) {
    if (obj == null) {
        return null;
    } else {
        IInterface iin = obj.queryLocalInterface("android.support.customtabs.ICustomTabsService");
        return (iin != null && iin instanceof ICustomTabsService ? (ICustomTabsService) iin : new ICustomTabsService.Stub.Proxy(obj));
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:9,代码来源:ICustomTabsService.java

示例14: asInterface

import android.os.IInterface; //导入依赖的package包/类
/**
 * Cast an IBinder object into an ILicensingService interface,
 * generating a proxy if needed.
 */
public static com.google.android.vending.licensing.ILicensingService asInterface(android.os.IBinder obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin = (android.os.IInterface)obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof com.google.android.vending.licensing.ILicensingService))) {
return ((com.google.android.vending.licensing.ILicensingService)iin);
}
return new com.google.android.vending.licensing.ILicensingService.Stub.Proxy(obj);
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:16,代码来源:ILicensingService.java

示例15: asInterface

import android.os.IInterface; //导入依赖的package包/类
/**
 * Cast an IBinder object into an ILicenseResultListener interface,
 * generating a proxy if needed.
 */
public static com.google.android.vending.licensing.ILicenseResultListener asInterface(android.os.IBinder obj)
{
if ((obj==null)) {
return null;
}
android.os.IInterface iin = (android.os.IInterface)obj.queryLocalInterface(DESCRIPTOR);
if (((iin!=null)&&(iin instanceof com.google.android.vending.licensing.ILicenseResultListener))) {
return ((com.google.android.vending.licensing.ILicenseResultListener)iin);
}
return new com.google.android.vending.licensing.ILicenseResultListener.Stub.Proxy(obj);
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:16,代码来源:ILicenseResultListener.java


注:本文中的android.os.IInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。