use of com.lody.virtual.server.pm.PackageSetting in project VirtualApp by asLody.
the class BroadcastSystem method startApp.
public void startApp(VPackage p) {
PackageSetting setting = (PackageSetting) p.mExtras;
for (VPackage.ActivityComponent receiver : p.receivers) {
ActivityInfo info = receiver.info;
List<BroadcastReceiver> receivers = mReceivers.get(p.packageName);
if (receivers == null) {
receivers = new ArrayList<>();
mReceivers.put(p.packageName, receivers);
}
String componentAction = String.format("_VA_%s_%s", info.packageName, info.name);
IntentFilter componentFilter = new IntentFilter(componentAction);
BroadcastReceiver r = new StaticBroadcastReceiver(setting.appId, info, componentFilter);
mContext.registerReceiver(r, componentFilter, null, mScheduler);
receivers.add(r);
for (VPackage.ActivityIntentInfo ci : receiver.intents) {
IntentFilter cloneFilter = new IntentFilter(ci.filter);
redirectFilterActions(cloneFilter);
r = new StaticBroadcastReceiver(setting.appId, info, cloneFilter);
mContext.registerReceiver(r, cloneFilter, null, mScheduler);
receivers.add(r);
}
}
}
use of com.lody.virtual.server.pm.PackageSetting in project VirtualApp by asLody.
the class VActivityManagerService method startProcessIfNeedLocked.
ProcessRecord startProcessIfNeedLocked(String processName, int userId, String packageName) {
if (VActivityManagerService.get().getFreeStubCount() < 3) {
// run GC
killAllApps();
}
PackageSetting ps = PackageCacheManager.getSetting(packageName);
ApplicationInfo info = VPackageManagerService.get().getApplicationInfo(packageName, 0, userId);
if (ps == null || info == null) {
return null;
}
if (!ps.isLaunched(userId)) {
sendFirstLaunchBroadcast(ps, userId);
ps.setLaunched(userId, true);
VAppManagerService.get().savePersistenceData();
}
int uid = VUserHandle.getUid(userId, ps.appId);
ProcessRecord app = mProcessNames.get(processName, uid);
if (app != null && app.client.asBinder().isBinderAlive()) {
return app;
}
int vpid = queryFreeStubProcessLocked();
if (vpid == -1) {
return null;
}
app = performStartProcessLocked(uid, vpid, info, processName);
if (app != null) {
app.pkgList.add(info.packageName);
}
return app;
}
Aggregations