use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method getPackagesForUid.
@Override
public String[] getPackagesForUid(int uid) {
int userId = VUserHandle.getUserId(uid);
checkUserId(userId);
synchronized (this) {
List<String> pkgList = new ArrayList<>(2);
for (VPackage p : mPackages.values()) {
PackageSetting settings = (PackageSetting) p.mExtras;
if (VUserHandle.getUid(userId, settings.appId) == uid) {
pkgList.add(p.packageName);
}
}
return pkgList.toArray(new String[pkgList.size()]);
}
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method getApplicationInfo.
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
VPackage p = mPackages.get(packageName);
if (p != null) {
PackageSetting ps = (PackageSetting) p.mExtras;
return PackageParserEx.generateApplicationInfo(p, flags, ps.readUserState(userId), userId);
}
}
return null;
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method querySharedPackages.
@Override
public List<String> querySharedPackages(String packageName) {
synchronized (mPackages) {
VPackage p = mPackages.get(packageName);
if (p == null || p.mSharedUserId == null) {
// noinspection unchecked
return Collections.EMPTY_LIST;
}
ArrayList<String> list = new ArrayList<>();
for (VPackage one : mPackages.values()) {
if (TextUtils.equals(one.mSharedUserId, p.mSharedUserId)) {
list.add(one.packageName);
}
}
return list;
}
}
use of com.lody.virtual.server.pm.parser.VPackage 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.parser.VPackage in project VirtualApp by asLody.
the class VAppManagerService method getInstalledApps.
@Override
public List<InstalledAppInfo> getInstalledApps(int flags) {
List<InstalledAppInfo> infoList = new ArrayList<>(getInstalledAppCount());
for (VPackage p : PackageCacheManager.PACKAGE_CACHE.values()) {
PackageSetting setting = (PackageSetting) p.mExtras;
infoList.add(setting.getAppInfo(flags));
}
return infoList;
}
Aggregations