@Override public void connected(ComponentName name, IBinder service) throws RemoteException { connected(name, service, false); }
@Override public IBinder createProxyService(ComponentName component, IBinder binder) { return ProxyServiceFactory.getProxyService(getCurrentApplication(), component, binder); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IServiceConnection conn = (IServiceConnection) args[0]; ServiceConnectionDelegate delegate = ServiceConnectionDelegate.removeDelegate(conn); if (delegate == null) { return method.invoke(who, args); } return VActivityManager.get().unbindService(delegate); }
public static ServiceConnectionDelegate getDelegate(IServiceConnection conn) { if(conn instanceof ServiceConnectionDelegate){ return (ServiceConnectionDelegate)conn; } IBinder binder = conn.asBinder(); ServiceConnectionDelegate delegate = DELEGATE_MAP.get(binder); if (delegate == null) { delegate = new ServiceConnectionDelegate(conn); DELEGATE_MAP.put(binder, delegate); } return delegate; }
public int bindService(Context context, Intent service, ServiceConnection connection, int flags) { try { IServiceConnection conn = ServiceConnectionDelegate.getDelegate(context, connection, flags); return getService().bindService(null, null, service, null, conn, flags, 0); } catch (RemoteException e) { return VirtualRuntime.crash(e); } }
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; }
return null; InvocationHandler handler = createHandler(aidlType, targetInterface); mInterface = (IInterface) Proxy.newProxyInstance(mClassLoader, new Class[]{aidlType}, handler);
public static IServiceConnection removeDelegate(Context context, ServiceConnection conn) { IServiceConnection connection = null; try{ Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext()); connection = LoadedApk.forgetServiceDispatcher.call(loadApk, context, conn); }catch (Exception e){ Log.e("ConnectionDelegate", "forgetServiceDispatcher", e); } if(connection == null){ return null; } return ServiceConnectionDelegate.removeDelegate(connection); }
public void connected(ComponentName name, IBinder service, boolean dead) throws RemoteException { IBinderDelegateService delegateService = IBinderDelegateService.Stub.asInterface(service); if (delegateService != null) { name = delegateService.getComponent(); service = delegateService.getService(); IBinder proxy = ProxyServiceFactory.getProxyService(VClientImpl.get().getCurrentApplication(), name, service); if (proxy != null) { service = proxy; } } if(Build.VERSION.SDK_INT>=26) { IServiceConnectionO.connected.call(mConn, name, service, dead); }else { mConn.connected(name, service); } } }
@Override public void connected(ComponentName name, IBinder service) throws RemoteException { connected(name, service, false); }
public static ServiceConnectionDelegate getDelegate(IServiceConnection conn) { if(conn instanceof ServiceConnectionDelegate){ return (ServiceConnectionDelegate)conn; } IBinder binder = conn.asBinder(); ServiceConnectionDelegate delegate = DELEGATE_MAP.get(binder); if (delegate == null) { delegate = new ServiceConnectionDelegate(conn); DELEGATE_MAP.put(binder, delegate); } return delegate; }
public static IServiceConnection getDelegate(Context context, ServiceConnection connection,int flags) { IServiceConnection sd = null; if (connection == null) { throw new IllegalArgumentException("connection is null"); } try { Object activityThread = ActivityThread.currentActivityThread.call(); Object loadApk = ContextImpl.mPackageInfo.get(VirtualCore.get().getContext()); Handler handler = ActivityThread.getHandler.call(activityThread); sd = LoadedApk.getServiceDispatcher.call(loadApk, connection, context, handler, flags); } catch (Exception e) { Log.e("ConnectionDelegate", "getServiceDispatcher", e); } if (sd == null) { throw new RuntimeException("Not supported in system context"); } return getDelegate(sd); }
public boolean unbindService(Context context, ServiceConnection connection) { try { IServiceConnection conn = ServiceConnectionDelegate.removeDelegate(context, connection); return getService().unbindService(conn, VUserHandle.myUserId()); } catch (RemoteException e) { return VirtualRuntime.crash(e); } }
@Override public IBinder createProxyService(ComponentName component, IBinder binder) { return ProxyServiceFactory.getProxyService(getCurrentApplication(), component, binder); }
@Override public void connected(ComponentName name, IBinder service) throws RemoteException { connected(name, service, false); }
public static ServiceConnectionDelegate getDelegate(IServiceConnection conn) { if(conn instanceof ServiceConnectionDelegate){ return (ServiceConnectionDelegate)conn; } IBinder binder = conn.asBinder(); ServiceConnectionDelegate delegate = DELEGATE_MAP.get(binder); if (delegate == null) { delegate = new ServiceConnectionDelegate(conn); DELEGATE_MAP.put(binder, delegate); } return delegate; }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IInterface caller = (IInterface) args[0]; IBinder token = (IBinder) args[1]; Intent service = (Intent) args[2]; String resolvedType = (String) args[3]; IServiceConnection conn = (IServiceConnection) args[4]; int flags = (int) args[5]; int userId = VUserHandle.myUserId(); if (isServerProcess()) { userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL); } if (userId == VUserHandle.USER_NULL) { return method.invoke(who, args); } ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, userId); if (serviceInfo != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { service.setComponent(new ComponentName(serviceInfo.packageName, serviceInfo.name)); } conn = ServiceConnectionDelegate.getDelegate(conn); return VActivityManager.get().bindService(caller.asBinder(), token, service, resolvedType, conn, flags, userId); } return method.invoke(who, args); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IServiceConnection conn = (IServiceConnection) args[0]; ServiceConnectionDelegate delegate = ServiceConnectionDelegate.removeDelegate(conn); if (delegate == null) { return method.invoke(who, args); } return VActivityManager.get().unbindService(delegate); }
@Override public IBinder createProxyService(ComponentName component, IBinder binder) { return ProxyServiceFactory.getProxyService(getCurrentApplication(), component, binder); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IServiceConnection conn = (IServiceConnection) args[0]; ServiceConnectionDelegate delegate = ServiceConnectionDelegate.removeDelegate(conn); if (delegate == null) { return method.invoke(who, args); } return VActivityManager.get().unbindService(delegate); }