當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。