PackageInfo
包含 AndroidManifest.xml 所有信息的实体映射类,可获得所有该文件中定义的App信息。
PackageManager pm = contextWrapper.getPackageManager();
PackageInfo info = pm.getPackageInfo(packageName, flags);
List infoList = pm.getInstalledPackages(flags);
List infoList = pm.getPackagesHoldingPermissions(permissions, flags);
List infoList = pm.getPreferredPackages(flags);
ApplicationInfo
AndroidManifest.xml 中
该类不包含 Activity、Receiver、Service 的信息。
一部分用于判断 App 类型(系统应用、特权应用等)的算法隐藏(@hide)在该类代码中。
ApplicationInfo info = pm.getApplicationInfo(packageNmae, flags);
List infoList = pm.getInstalledApplications(flags);
ActivityInfo
AndroidManifest.xml 中
ActivityInfo info = pm.getActivityInfo(componentName, flags);
ActivityInfo info = pm.getReceiverInfo(componentName, flags);
ServiceInfo
AndroidManifest.xml 中
ServiceInfo info = pm.getServiceInfo(componentName, flags);
ProviderInfo
AndroidManifest.xml 中
ProviderInfo info = pm.getProviderInfo(componentName, flags);
ProviderInfo info = pm.resolveContentProvider(name, flags);
List infoList = pm.queryContentProviders(processName, uid, flags);
ResolveInfo
AndroidManifest.xml 中
用于通过给定 intent 反查系统中适配的项目信息,包含 ActivityInfo、ServiceInfo、ProviderInfo 等内容。
ResolveInfo info = pm.resolveActivity(intent, flags);
ResolveInfo info = pm.resolveService(intent, flags);
List infoList = pm.queryIntentActivities(intent, flags);
List infoList = pm.queryIntentContentProviders(intent, flags);
List infoList = pm.queryIntentServices(intent, flags);
List infoList = pm.queryBroadcastReceivers(intent, flags);
List infoList = pm.queryIntentActivityOptions(componentName, intents, intent, flags);
其他
其他 Info 系列的实体类还有 PermissionInfo
、PermissionGroupInfo
、InstrumentationInfo
参考:PackageItemInfo