use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method getReceiverInfo.
@Override
public ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
VPackage p = mPackages.get(component.getPackageName());
if (p != null) {
PackageSetting ps = (PackageSetting) p.mExtras;
VPackage.ActivityComponent a = mReceivers.mActivities.get(component);
if (a != null) {
ActivityInfo receiverInfo = PackageParserEx.generateActivityInfo(a, flags, ps.readUserState(userId), userId);
ComponentFixer.fixComponentInfo(ps, receiverInfo, userId);
return receiverInfo;
}
}
}
return null;
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method getInstalledPackages.
@Override
public VParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) {
checkUserId(userId);
ArrayList<PackageInfo> pkgList = new ArrayList<>(mPackages.size());
synchronized (mPackages) {
for (VPackage p : mPackages.values()) {
PackageSetting ps = (PackageSetting) p.mExtras;
PackageInfo info = generatePackageInfo(p, ps, flags, userId);
if (info != null) {
pkgList.add(info);
}
}
}
return new VParceledListSlice<>(pkgList);
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method getServiceInfo.
@Override
public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
synchronized (mPackages) {
VPackage p = mPackages.get(component.getPackageName());
if (p != null) {
PackageSetting ps = (PackageSetting) p.mExtras;
VPackage.ServiceComponent s = mServices.mServices.get(component);
if (s != null) {
ServiceInfo serviceInfo = PackageParserEx.generateServiceInfo(s, flags, ps.readUserState(userId), userId);
ComponentFixer.fixComponentInfo(ps, serviceInfo, userId);
return serviceInfo;
}
}
}
return null;
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method deletePackageLocked.
void deletePackageLocked(String packageName) {
VPackage pkg = mPackages.get(packageName);
if (pkg == null) {
return;
}
int N = pkg.activities.size();
for (int i = 0; i < N; i++) {
VPackage.ActivityComponent a = pkg.activities.get(i);
mActivities.removeActivity(a, "activity");
}
N = pkg.services.size();
for (int i = 0; i < N; i++) {
VPackage.ServiceComponent a = pkg.services.get(i);
mServices.removeService(a);
}
N = pkg.receivers.size();
for (int i = 0; i < N; i++) {
VPackage.ActivityComponent a = pkg.receivers.get(i);
mReceivers.removeActivity(a, "receiver");
}
N = pkg.providers.size();
for (int i = 0; i < N; i++) {
VPackage.ProviderComponent p = pkg.providers.get(i);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
mProviders.removeProvider(p);
}
String[] names = p.info.authority.split(";");
for (String name : names) {
mProvidersByAuthority.remove(name);
}
mProvidersByComponent.remove(p.getComponentName());
}
N = pkg.permissions.size();
for (int i = 0; i < N; i++) {
VPackage.PermissionComponent permission = pkg.permissions.get(i);
mPermissions.remove(permission.className);
}
N = pkg.permissionGroups.size();
for (int i = 0; i < N; i++) {
VPackage.PermissionGroupComponent group = pkg.permissionGroups.get(i);
mPermissionGroups.remove(group.className);
}
}
use of com.lody.virtual.server.pm.parser.VPackage in project VirtualApp by asLody.
the class VPackageManagerService method queryIntentServices.
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags, int userId) {
checkUserId(userId);
flags = updateFlagsNought(flags);
ComponentName comp = intent.getComponent();
if (comp == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
}
if (comp != null) {
final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
final ServiceInfo si = getServiceInfo(comp, flags, userId);
if (si != null) {
final ResolveInfo ri = new ResolveInfo();
ri.serviceInfo = si;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mServices.queryIntent(intent, resolvedType, flags, userId);
}
final VPackage pkg = mPackages.get(pkgName);
if (pkg != null) {
return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services, userId);
}
return null;
}
}
Aggregations