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


Java IBinder.getInterfaceDescriptor方法代码示例

本文整理汇总了Java中android.os.IBinder.getInterfaceDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java IBinder.getInterfaceDescriptor方法的具体用法?Java IBinder.getInterfaceDescriptor怎么用?Java IBinder.getInterfaceDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.os.IBinder的用法示例。


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

示例1: getProxyService

import android.os.IBinder; //导入方法依赖的package包/类
public static IBinder getProxyService(Context context, ComponentName component, IBinder binder) {
	if (context == null || binder == null) {
		return null;
	}
	try {
		String description = binder.getInterfaceDescriptor();
		ServiceFetcher fetcher = sHookSecondaryServiceMap.get(description);
		if (fetcher != null) {
			IBinder res = fetcher.getService(context, context.getClassLoader(), binder);
			if (res != null) {
				return res;
			}
		}
	} catch (Throwable e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:19,代码来源:ProxyServiceFactory.java

示例2: factory

import android.os.IBinder; //导入方法依赖的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

示例3: markIPC

import android.os.IBinder; //导入方法依赖的package包/类
private void markIPC(XParam param) throws Throwable {
	// Allow management transactions
	int code = (Integer) param.args[0];
	if (isManagementTransaction(code))
		return;

	// Only for applications
	int uid = Binder.getCallingUid();
	if (!PrivacyManager.isApplication(uid))
		return;

	// Check interface name
	IBinder binder = (IBinder) param.thisObject;
	String descriptor = (binder == null ? null : binder.getInterfaceDescriptor());
	if (!cServiceDescriptor.contains(descriptor))
		return;

	// Search this object in call stack
	boolean ok = false;
	boolean found = false;
	StackTraceElement[] ste = Thread.currentThread().getStackTrace();
	for (int i = 0; i < ste.length; i++)
		if (ste[i].getClassName().equals(param.thisObject.getClass().getName())) {
			found = true;

			// Check if caller class in user space
			String callerClassName = (i + 2 < ste.length ? ste[i + 2].getClassName() : null);
			if (callerClassName != null && !callerClassName.startsWith("java.lang.reflect."))
				synchronized (mMapClassSystem) {
					if (!mMapClassSystem.containsKey(callerClassName))
						try {
							ClassLoader loader = Thread.currentThread().getContextClassLoader();
							Class<?> clazz = Class.forName(callerClassName, false, loader);
							boolean boot = Context.class.getClassLoader().equals(clazz.getClassLoader());
							mMapClassSystem.put(callerClassName, boot);
						} catch (ClassNotFoundException ignored) {
							mMapClassSystem.put(callerClassName, true);
						}
					ok = mMapClassSystem.get(callerClassName);
				}

			break;
		}

	// Conditionally mark
	if (ok) {
		int flags = (Integer) param.args[3];
		if ((flags & ~FLAG_ALL) != 0)
			Util.log(this, Log.ERROR, "Unknown flags=" + Integer.toHexString(flags) + " descriptor=" + descriptor
					+ " code=" + code + " uid=" + Binder.getCallingUid());
		flags |= (mToken << BITS_TOKEN);
		param.args[3] = flags;
	} else {
		int level = (found ? Log.WARN : Log.ERROR);
		Util.log(this, level, "Unmarked descriptor=" + descriptor + " found=" + found + " code=" + code + " uid="
				+ Binder.getCallingUid());
		Util.logStack(this, level, true);
	}
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:60,代码来源:XBinder.java


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