use of android.app.Service in project DroidPlugin by DroidPluginTeam.
the class ServcesManager method handleOnStartOne.
private void handleOnStartOne(Intent intent, int flags, int startIds) throws Exception {
ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
if (info != null) {
Service service = mNameService.get(info.name);
if (service != null) {
ClassLoader classLoader = getClassLoader(info.applicationInfo);
intent.setExtrasClassLoader(classLoader);
Object token = findTokenByService(service);
Integer integer = mServiceTaskIds.get(token);
if (integer == null) {
integer = -1;
}
int startId = integer + 1;
mServiceTaskIds.put(token, startId);
int res = service.onStartCommand(intent, flags, startId);
QueuedWorkCompat.waitToFinish();
}
}
}
use of android.app.Service in project DroidPlugin by DroidPluginTeam.
the class ServcesManager method handleOnTaskRemovedOne.
private void handleOnTaskRemovedOne(Intent intent) throws Exception {
if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
if (info != null) {
Service service = mNameService.get(info.name);
if (service != null) {
ClassLoader classLoader = getClassLoader(info.applicationInfo);
intent.setExtrasClassLoader(classLoader);
service.onTaskRemoved(intent);
QueuedWorkCompat.waitToFinish();
}
QueuedWorkCompat.waitToFinish();
}
}
}
use of android.app.Service in project DroidPlugin by DroidPluginTeam.
the class ServcesManager method onBind.
public IBinder onBind(Context context, Intent intent) throws Exception {
Intent targetIntent = intent.getParcelableExtra(Env.EXTRA_TARGET_INTENT);
if (targetIntent != null) {
ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(targetIntent, 0);
Service service = mNameService.get(info.name);
if (service == null) {
handleCreateServiceOne(context, intent, info);
}
return handleOnBindOne(targetIntent);
}
return null;
}
use of android.app.Service in project DroidPlugin by DroidPluginTeam.
the class ServcesManager method handleOnUnbindOne.
private boolean handleOnUnbindOne(Intent intent) throws Exception {
ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(intent, 0);
if (info != null) {
Service service = mNameService.get(info.name);
if (service != null) {
ClassLoader classLoader = getClassLoader(info.applicationInfo);
intent.setExtrasClassLoader(classLoader);
return service.onUnbind(intent);
}
}
return false;
}
use of android.app.Service in project DroidPlugin by DroidPluginTeam.
the class ServcesManager method onRebind.
public void onRebind(Context context, Intent intent) throws Exception {
Intent targetIntent = intent.getParcelableExtra(Env.EXTRA_TARGET_INTENT);
if (targetIntent != null) {
ServiceInfo info = PluginManager.getInstance().resolveServiceInfo(targetIntent, 0);
Service service = mNameService.get(info.name);
if (service == null) {
handleCreateServiceOne(context, intent, info);
}
handleOnRebindOne(targetIntent);
}
}
Aggregations