当前位置: 首页>>代码示例>>Java>>正文


Java PackageParser.Package方法代码示例

本文整理汇总了Java中android.content.pm.PackageParser.Package方法的典型用法代码示例。如果您正苦于以下问题:Java PackageParser.Package方法的具体用法?Java PackageParser.Package怎么用?Java PackageParser.Package使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.PackageParser的用法示例。


在下文中一共展示了PackageParser.Package方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryIntentContentProviders

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.KITKAT)
@Override
public List<ResolveInfo> queryIntentContentProviders(Intent intent, String resolvedType, int flags, int userId) {
	checkUserId(userId);
	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 ProviderInfo pi = getProviderInfo(comp, flags, userId);
		if (pi != null) {
			final ResolveInfo ri = new ResolveInfo();
			ri.providerInfo = pi;
			list.add(ri);
		}
		return list;
	}
	// reader
	synchronized (mPackages) {
		String pkgName = intent.getPackage();
		if (pkgName == null) {
			return mProviders.queryIntent(intent, resolvedType, flags);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers);
		}
		return null;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:VPackageManagerService.java

示例2: queryIntentServices

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public List<ResolveInfo> queryIntentServices(Intent intent, String resolvedType, int flags, int userId) {
	checkUserId(userId);
	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);
		}
		final PackageParser.Package pkg = mPackages.get(pkgName);
		if (pkg != null) {
			return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services);
		}
		return null;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:VPackageManagerService.java

示例3: parsePackage

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public static final PackageParser.Package parsePackage(final Context context, final File apk, final int flags) throws PackageParser.PackageParserException {
    if (Build.VERSION.SDK_INT >= 24) {
        return PackageParserV24.parsePackage(context, apk, flags);
    } else if (Build.VERSION.SDK_INT >= 21) {
        return PackageParserLollipop.parsePackage(context, apk, flags);
    } else {
        return PackageParserLegacy.parsePackage(context, apk, flags);
    }
}
 
开发者ID:didi,项目名称:VirtualAPK,代码行数:10,代码来源:PackageParserCompat.java

示例4: getInstalledPackages

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public VParceledListSlice<PackageInfo> getInstalledPackages(int flags, int userId) {
	checkUserId(userId);
	ArrayList<PackageInfo> pkgList = new ArrayList<>(mPackages.size());
	synchronized (mPackages) {
		for (PackageParser.Package pkg : mPackages.values()) {
			String packageName = pkg.packageName;
			pkgList.add(getPackageInfo(packageName, flags, userId));
		}
	}
	return new VParceledListSlice<>(pkgList);
}
 
开发者ID:codehz,项目名称:container,代码行数:13,代码来源:VPackageManagerService.java

示例5: getApplicationInfo

import android.content.pm.PackageParser; //导入方法依赖的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;
}
 
开发者ID:codehz,项目名称:container,代码行数:15,代码来源:VPackageManagerService.java

示例6: parsePackage

import android.content.pm.PackageParser; //导入方法依赖的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);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:15,代码来源:PackageParserEx.java

示例7: put

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public static void put(PackageParser.Package pkg, AppSetting appSetting) {
	synchronized (PackageCache.class) {
		pkg.mExtras = appSetting;
		sPackageCaches.put(pkg.packageName, pkg);
		VPackageManagerService.get().analyzePackageLocked(pkg);
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:8,代码来源:PackageCache.java

示例8: getSharedLibraries

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public List<String> getSharedLibraries(String pkgName) {
	synchronized (mPackages) {
		PackageParser.Package p = mPackages.get(pkgName);
		if (p != null) {
			return p.usesLibraries;
		}
		return null;
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:11,代码来源:VPackageManagerService.java

示例9: findAppInfo

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public AppSetting findAppInfo(String pkg) {
    synchronized (PackageCache.class) {
        if (pkg != null) {
            PackageParser.Package p = PackageCache.get(pkg);
            if (p != null) {
                return (AppSetting) p.mExtras;
            }
        }
        return null;
    }
}
 
开发者ID:codehz,项目名称:container,代码行数:12,代码来源:VAppManagerService.java

示例10: getActivityInfo

import android.content.pm.PackageParser; //导入方法依赖的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;
}
 
开发者ID:codehz,项目名称:container,代码行数:16,代码来源:VPackageManagerService.java

示例11: getAllApps

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public List<AppSetting> getAllApps() {
    List<AppSetting> settings = new ArrayList<>(getAppCount());
    for (PackageParser.Package p : PackageCache.sPackageCaches.values()) {
        settings.add((AppSetting) p.mExtras);
    }
    return settings;
}
 
开发者ID:codehz,项目名称:container,代码行数:8,代码来源:VAppManagerService.java

示例12: getPackagesForUid

import android.content.pm.PackageParser; //导入方法依赖的package包/类
@Override
public String[] getPackagesForUid(int uid) {
	int userId = VUserHandle.getUserId(uid);
	checkUserId(userId);
	synchronized (this) {
		List<String> pkgList = new ArrayList<>(2);
		for (PackageParser.Package p : mPackages.values()) {
			AppSetting settings = (AppSetting) p.mExtras;
			if (VUserHandle.getUid(userId, settings.appId) == uid) {
				pkgList.add(p.packageName);
			}
		}
		return pkgList.toArray(new String[pkgList.size()]);
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:16,代码来源:VPackageManagerService.java

示例13: canUpdate

import android.content.pm.PackageParser; //导入方法依赖的package包/类
private boolean canUpdate(PackageParser.Package existOne, PackageParser.Package newOne, int flags) {
    if ((flags & InstallStrategy.COMPARE_VERSION) != 0) {
        if (existOne.mVersionCode < newOne.mVersionCode) {
            return true;
        }
    }
    if ((flags & InstallStrategy.TERMINATE_IF_EXIST) != 0) {
        return false;
    }
    if ((flags & InstallStrategy.UPDATE_IF_EXIST) != 0) {
        return true;
    }
    return false;
}
 
开发者ID:codehz,项目名称:container,代码行数:15,代码来源:VAppManagerService.java

示例14: collectCertificates

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public static void collectCertificates(PackageParser.Package pkg, int flags)
        throws PackageParser.PackageParserException {
    PackageParser packageParser = new PackageParser();
    packageParser.collectCertificates(pkg, flags);
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:6,代码来源:HideApiOverrideM.java

示例15: remove

import android.content.pm.PackageParser; //导入方法依赖的package包/类
public static PackageParser.Package remove(String packageName) {
	synchronized (PackageCache.class) {
		VPackageManagerService.get().deletePackageLocked(packageName);
		return sPackageCaches.remove(packageName);
	}
}
 
开发者ID:codehz,项目名称:container,代码行数:7,代码来源:PackageCache.java


注:本文中的android.content.pm.PackageParser.Package方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。