本文整理匯總了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;
}
示例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();
}
}
示例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;
}
}
示例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");
}
}
}
}
示例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);
}
示例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;
}
}
};
}
};
}
示例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;
}
}
};
}
};
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}
}
示例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);
}
示例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);
}