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