use of android.app.IServiceConnection in project VirtualApp by asLody.
the class VActivityManagerService method publishService.
@Override
public void publishService(IBinder token, Intent intent, IBinder service, int userId) {
synchronized (this) {
ServiceRecord r = (ServiceRecord) token;
if (r != null) {
ServiceRecord.IntentBindRecord boundRecord = r.peekBinding(intent);
if (boundRecord != null) {
boundRecord.binder = service;
for (IServiceConnection conn : boundRecord.connections) {
ComponentName component = ComponentUtils.toComponentName(r.serviceInfo);
connectService(conn, component, boundRecord);
}
}
}
}
}
use of android.app.IServiceConnection in project VirtualApp by asLody.
the class BindService method call.
@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);
}
use of android.app.IServiceConnection in project VirtualApp by asLody.
the class UnbindService method call.
@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);
}
Aggregations