本文整理汇总了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;
}
示例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);
}
示例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);
}
}