public class PackageInfo
extends Object implements Parcelable
| java.lang.Object | |
| android.content.pm.PackageInfo | |
有关软件包内容的全面信息。 这对应于从AndroidManifest.xml收集的所有信息。
常量(Constants) |
|
|---|---|
int |
INSTALL_LOCATION_AUTO 常数对应于 |
int |
INSTALL_LOCATION_INTERNAL_ONLY 常数对应于 |
int |
INSTALL_LOCATION_PREFER_EXTERNAL 常数对应于 |
int |
REQUESTED_PERMISSION_GRANTED 标志为 |
Inherited constants |
|---|
android.os.Parcelable
|
Fields |
|
|---|---|
public static final Creator<PackageInfo> |
CREATOR |
public ActivityInfo[] |
activities 包含<application>下包含的所有 |
public ApplicationInfo |
applicationInfo 从<application>标记收集的信息,如果没有则为null。 |
public int |
baseRevisionCode 此包的基本APK的修订版号,由<manifest>标记的 |
public ConfigurationInfo[] |
configPreferences Application指定的首选配置 |
public FeatureGroupInfo[] |
featureGroups 此应用程序请求的功能组。 |
public long |
firstInstallTime 应用程序首次安装的时间。 |
public int[] |
gids 所有已分配给此包的内核组标识。 |
public int |
installLocation 包所请求的安装位置。 |
public InstrumentationInfo[] |
instrumentation 包含<manifest>下包含的所有 |
public long |
lastUpdateTime 该应用上次更新的时间。 |
public String |
packageName 这个包的名字。 |
public PermissionInfo[] |
permissions 包含在<manifest>下的所有 |
public ProviderInfo[] |
providers <application>下包含的所有 |
public ActivityInfo[] |
receivers 包含<application>下包含的所有 |
public FeatureInfo[] |
reqFeatures 此应用程序要求的功能。 |
public String[] |
requestedPermissions 包含<manifest>下包含的所有 |
public int[] |
requestedPermissionsFlags 包含在<manifest>下的所有 |
public ServiceInfo[] |
services 包含<application>下包含的所有 |
public String |
sharedUserId 此包的共享用户标识名称,由<manifest>标记的 |
public int |
sharedUserLabel 此包的共享用户标识标签,由<manifest>标记的 |
public Signature[] |
signatures 从包文件中读取所有签名的数组。 |
public String[] |
splitNames 此软件包的所有已安装拆分APK的名称。 |
public int[] |
splitRevisionCodes 由<manifest>标记的 |
public int |
versionCode 此包的版本号,由<manifest>标记的 |
public String |
versionName 此包的版本名称,由<manifest>标记的 |
Public constructors |
|
|---|---|
PackageInfo() |
|
公共方法(Public methods) |
|
|---|---|
int |
describeContents() 描述此Parcelable实例的封送表示中包含的特殊对象的种类。 |
String |
toString() 返回对象的字符串表示形式。 |
void |
writeToParcel(Parcel dest, int parcelableFlags) 将此对象平铺到一个包裹中。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
android.os.Parcelable
|
|
int INSTALL_LOCATION_AUTO
常数对应于 auto在 installLocation属性。
常量值:0(0x00000000)
int INSTALL_LOCATION_INTERNAL_ONLY
常数对应于 internalOnly在 installLocation属性。
常数值:1(0x00000001)
int INSTALL_LOCATION_PREFER_EXTERNAL
常数对应于 preferExternal在 installLocation属性。
常量值:2(0x00000002)
int REQUESTED_PERMISSION_GRANTED
标记为 requestedPermissionsFlags :请求的权限当前被授予应用程序。
常量值:2(0x00000002)
ActivityInfo[] activities
包含<application>下包含的所有<activity>标记的数组,如果没有,则为null。 只有在标志GET_ACTIVITIES已设置时才会填充GET_ACTIVITIES 。
ApplicationInfo applicationInfo
从<application>标记收集的信息,如果没有则为null。
int baseRevisionCode
此包的基本APK的修订版号,由<manifest>标记的 revisionCode属性指定。
ConfigurationInfo[] configPreferences
应用程序指定的首选配置<uses-configuration>标签包含在<manifest>下,如果没有,则为空。 只有在设置标志GET_CONFIGURATIONS时才会填写。
FeatureGroupInfo[] featureGroups
此应用程序请求的功能组。 每个组都包含一组必需的功能。 设备必须与reqFeatures列出的功能以及一个或多个功能组匹配才能满足功能要求。
也可以看看:
int installLocation
包所请求的安装位置。 从installLocation属性之一INSTALL_LOCATION_AUTO , INSTALL_LOCATION_INTERNAL_ONLY , INSTALL_LOCATION_PREFER_EXTERNAL
InstrumentationInfo[] instrumentation
包含<manifest>下包含的所有<instrumentation>标记的数组,如果没有,则为null。 只有在标志GET_INSTRUMENTATION被设置时才会填写。
PermissionInfo[] permissions
包含<manifest>下包含的所有<permission>标记的数组,如果没有,则为null。 只有在标志GET_PERMISSIONS已设置时才会填充GET_PERMISSIONS 。
ProviderInfo[] providers
包含<application>下包含的所有<provider>标记的数组,如果没有,则为null。 只有在标志GET_PROVIDERS已设置时才会填充GET_PROVIDERS 。
ActivityInfo[] receivers
包含<application>下包含的所有<receiver>标记的数组,如果没有,则为null。 只有在标志GET_RECEIVERS被设置的情况下才会填写。
String[] requestedPermissions
包含<manifest>下包含的所有<uses-permission>标记的数组,如果没有,则为null。 只有在标志GET_PERMISSIONS被设置的情况下才会填写。 此列表包含所有请求的权限,即使是在安装时系统未授权或未知的权限。
int[] requestedPermissionsFlags
<manifest>下包含的所有<uses-permission>标记的标记数组,如果没有,则为null。 这仅在标志GET_PERMISSIONS已设置时填充。 每个值都与requestedPermissions中的相应条目相匹配,并将根据REQUESTED_PERMISSION_GRANTED设置标志REQUESTED_PERMISSION_GRANTED 。
ServiceInfo[] services
包含<application>下包含的所有<service>标记的数组,如果没有,则为null。 只有在设置了标志GET_SERVICES时才会填写。
int sharedUserLabel
此包的共享用户标识标签,由<manifest>标记的 sharedUserLabel属性指定。
int[] splitRevisionCodes
此包的任何拆分APK的修订版号,由<manifest>标记的revisionCode属性指定。 索引是针对splitNames的1:1映射。
int describeContents ()
描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象将在writeToParcel(Parcel, int)的输出中包含writeToParcel(Parcel, int) ,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR位。
| 返回(Returns) | |
|---|---|
int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. |
String toString ()
返回对象的字符串表示形式。 一般来说, toString方法返回一个“文本表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。
类Object的toString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”和对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:
getClass().getName() + '@' + Integer.toHexString(hashCode())
| 返回(Returns) | |
|---|---|
String |
a string representation of the object. |
void writeToParcel (Parcel dest, int parcelableFlags)
将此对象平铺到一个包裹中。
| 参数(Parameters) | |
|---|---|
dest |
Parcel: The Parcel in which the object should be written. |
parcelableFlags |
int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. |