本文整理汇总了Java中com.lody.virtual.helper.compat.PackageParserCompat类的典型用法代码示例。如果您正苦于以下问题:Java PackageParserCompat类的具体用法?Java PackageParserCompat怎么用?Java PackageParserCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PackageParserCompat类属于com.lody.virtual.helper.compat包,在下文中一共展示了PackageParserCompat类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPackageInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public PackageInfo getPackageInfo(String packageName, int flags, int userId) {
synchronized (mPackages) {
PackageParser.Package pkg = mPackages.get(packageName);
if (pkg != null) {
AppSetting setting = (AppSetting) pkg.mExtras;
if ((flags & PackageManager.GET_SIGNATURES) != 0 && pkg.mSignatures == null) {
if (pkg.mAppMetaData != null && pkg.mAppMetaData.containsKey(Constants.FEATURE_FAKE_SIGNATURE)) {
String sig = pkg.mAppMetaData.getString("fake-signature");
if (sig != null) {
pkg.mSignatures = new Signature[] {new Signature(sig)};
}
} else {
PackageParserCompat.collectCertificates(setting.parser, pkg, PackageParser.PARSE_IS_SYSTEM);
}
}
PackageInfo packageInfo = PackageParserCompat.generatePackageInfo(pkg, flags,
getFirstInstallTime(pkg), getLastInstallTime(pkg));
if (packageInfo != null) {
ComponentFixer.fixApplicationInfo(setting, packageInfo.applicationInfo, userId);
return packageInfo;
}
}
}
return null;
}
示例2: queryReceivers
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public List<ReceiverInfo> queryReceivers(String processName, int uid, int flags) {
int userId = VUserHandle.getUserId(uid);
checkUserId(userId);
ArrayList<ReceiverInfo> finalList = new ArrayList<>(3);
synchronized (mPackages) {
for (PackageParser.Activity a : mReceivers.mActivities.values()) {
if (a.info.processName.equals(processName)) {
ActivityInfo receiverInfo = PackageParserCompat.generateActivityInfo(a, flags);
if (receiverInfo != null) {
AppSetting settings = (AppSetting) mPackages.get(receiverInfo.packageName).mExtras;
ComponentFixer.fixComponentInfo(settings, receiverInfo, userId);
ComponentName component = ComponentUtils.toComponentName(receiverInfo);
IntentFilter[] filters = null;
if (a.intents != null) {
filters = a.intents.toArray(new IntentFilter[a.intents.size()]);
}
finalList.add(new ReceiverInfo(component, filters, receiverInfo.permission));
}
}
}
}
return finalList;
}
示例3: queryContentProviders
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public VParceledListSlice<ProviderInfo> queryContentProviders(String processName, int vuid, int flags) {
int userId = VUserHandle.getUserId(vuid);
checkUserId(userId);
ArrayList<ProviderInfo> finalList = new ArrayList<>(3);
// reader
synchronized (mPackages) {
for (PackageParser.Provider p : mProvidersByComponent.values()) {
AppSetting setting = (AppSetting) p.owner.mExtras;
if (processName == null || setting.appId == VUserHandle.getAppId(vuid) && p.info.processName.equals(processName)) {
ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(p, flags);
ComponentFixer.fixApplicationInfo(setting, providerInfo.applicationInfo, userId);
finalList.add(providerInfo);
}
}
}
if (!finalList.isEmpty()) {
Collections.sort(finalList, mProviderInitOrderSorter);
}
return new VParceledListSlice<>(finalList);
}
示例4: newResult
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
protected ResolveInfo newResult(PackageParser.ActivityIntentInfo info, int match) {
final PackageParser.Activity activity = info.activity;
ActivityInfo ai = PackageParserCompat.generateActivityInfo(activity, mFlags);
if (ai == null) {
return null;
}
final ResolveInfo res = new ResolveInfo();
res.activityInfo = ai;
if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
res.filter = info;
}
res.priority = info.getPriority();
res.preferredOrder = activity.owner.mPreferredOrder;
// System.out.println("Result: " + res.activityInfo.className +
// " = " + res.priority);
res.match = match;
res.isDefault = info.hasDefault;
res.labelRes = info.labelRes;
res.nonLocalizedLabel = info.nonLocalizedLabel;
res.icon = info.icon;
return res;
}
示例5: newResult
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
protected ResolveInfo newResult(PackageParser.ProviderIntentInfo filter, int match) {
final PackageParser.Provider provider = filter.provider;
ProviderInfo pi = PackageParserCompat.generateProviderInfo(provider, mFlags);
if (pi == null) {
return null;
}
final ResolveInfo res = new ResolveInfo();
res.providerInfo = pi;
if ((mFlags & PackageManager.GET_RESOLVED_FILTER) != 0) {
res.filter = filter;
}
res.priority = filter.getPriority();
res.preferredOrder = provider.owner.mPreferredOrder;
res.match = match;
res.isDefault = filter.hasDefault;
res.labelRes = filter.labelRes;
res.nonLocalizedLabel = filter.nonLocalizedLabel;
res.icon = filter.icon;
return res;
}
示例6: parsePackage
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
public static VPackage parsePackage(File packageFile) throws Throwable {
PackageParser parser = PackageParserCompat.createParser(packageFile);
PackageParser.Package p = PackageParserCompat.parsePackage(parser, packageFile, 0);
if (p.requestedPermissions.contains("android.permission.FAKE_PACKAGE_SIGNATURE")
&& p.mAppMetaData != null
&& p.mAppMetaData.containsKey("fake-signature")) {
String sig = p.mAppMetaData.getString("fake-signature");
p.mSignatures = new Signature[]{new Signature(sig)};
VLog.d(TAG, "Using fake-signature feature on : " + p.packageName);
} else {
PackageParserCompat.collectCertificates(parser, p, PackageParser.PARSE_IS_SYSTEM);
}
return buildPackageCache(p);
}
示例7: getActivityInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
PackageParser.Activity a = mActivities.mActivities.get(component);
if (a != null) {
ActivityInfo activityInfo = PackageParserCompat.generateActivityInfo(a, flags);
PackageParser.Package p = mPackages.get(activityInfo.packageName);
AppSetting settings = (AppSetting) p.mExtras;
ComponentFixer.fixComponentInfo(settings, activityInfo, userId);
return activityInfo;
}
}
return null;
}
示例8: getReceiverInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ActivityInfo getReceiverInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
PackageParser.Activity a = mReceivers.mActivities.get(component);
if (a != null) {
ActivityInfo receiverInfo = PackageParserCompat.generateActivityInfo(a, flags);
PackageParser.Package p = mPackages.get(receiverInfo.packageName);
AppSetting settings = (AppSetting) p.mExtras;
ComponentFixer.fixComponentInfo(settings, receiverInfo, userId);
return receiverInfo;
}
}
return null;
}
示例9: getServiceInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ServiceInfo getServiceInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
PackageParser.Service s = mServices.mServices.get(component);
if (s != null) {
ServiceInfo serviceInfo = PackageParserCompat.generateServiceInfo(s, flags);
PackageParser.Package p = mPackages.get(serviceInfo.packageName);
AppSetting settings = (AppSetting) p.mExtras;
ComponentFixer.fixComponentInfo(settings, serviceInfo, userId);
return serviceInfo;
}
}
return null;
}
示例10: getProviderInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ProviderInfo getProviderInfo(ComponentName component, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
PackageParser.Provider p = mProvidersByComponent.get(component);
if (p != null) {
ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(p, flags);
PackageParser.Package pkg = mPackages.get(providerInfo.packageName);
AppSetting settings = (AppSetting) pkg.mExtras;
ComponentFixer.fixComponentInfo(settings, providerInfo, userId);
return providerInfo;
}
}
return null;
}
示例11: resolveContentProvider
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ProviderInfo resolveContentProvider(String name, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
final PackageParser.Provider provider = mProvidersByAuthority.get(name);
if (provider != null) {
ProviderInfo providerInfo = PackageParserCompat.generateProviderInfo(provider, flags);
PackageParser.Package p = mPackages.get(providerInfo.packageName);
AppSetting settings = (AppSetting) p.mExtras;
ComponentFixer.fixComponentInfo(settings, providerInfo, userId);
return providerInfo;
}
}
return null;
}
示例12: getApplicationInfo
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
@Override
public ApplicationInfo getApplicationInfo(String packageName, int flags, int userId) {
checkUserId(userId);
synchronized (mPackages) {
PackageParser.Package pkg = mPackages.get(packageName);
if (pkg != null) {
ApplicationInfo applicationInfo = PackageParserCompat.generateApplicationInfo(pkg, flags);
AppSetting settings = (AppSetting) pkg.mExtras;
ComponentFixer.fixApplicationInfo(settings, applicationInfo, userId);
return applicationInfo;
}
}
return null;
}
示例13: parsePackage
import com.lody.virtual.helper.compat.PackageParserCompat; //导入依赖的package包/类
public static VPackage parsePackage(File packageFile) throws Throwable {
PackageParser parser = PackageParserCompat.createParser(packageFile);
PackageParser.Package p = PackageParserCompat.parsePackage(parser, packageFile, 0);
PackageParserCompat.collectCertificates(parser, p, PackageParser.PARSE_IS_SYSTEM);
return buildPackageCache(p);
}