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 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); }
@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); }
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 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 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 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); }
@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 { 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); }