FileDocCategorySizeDatePackage
PackageInfo.javaAPI DocAndroid 5.1 API13678Thu Mar 12 22:22:10 GMT 2015android.content.pm

PackageInfo

public class PackageInfo extends Object implements android.os.Parcelable
Overall information about the contents of a package. This corresponds to all of the information collected from AndroidManifest.xml.

Fields Summary
public String
packageName
The name of this package. From the <manifest> tag's "name" attribute.
public String[]
splitNames
The names of any installed split APKs for this package.
public int
versionCode
The version number of this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_versionCode versionCode} attribute.
public String
versionName
The version name of this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_versionName versionName} attribute.
public int
baseRevisionCode
The revision number of the base APK for this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_revisionCode revisionCode} attribute.
public int[]
splitRevisionCodes
The revision number of any split APKs for this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_revisionCode revisionCode} attribute. Indexes are a 1:1 mapping against {@link #splitNames}.
public String
sharedUserId
The shared user ID name of this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_sharedUserId sharedUserId} attribute.
public int
sharedUserLabel
The shared user ID label of this package, as specified by the <manifest> tag's {@link android.R.styleable#AndroidManifest_sharedUserLabel sharedUserLabel} attribute.
public ApplicationInfo
applicationInfo
Information collected from the <application> tag, or null if there was none.
public long
firstInstallTime
The time at which the app was first installed. Units are as per {@link System#currentTimeMillis()}.
public long
lastUpdateTime
The time at which the app was last updated. Units are as per {@link System#currentTimeMillis()}.
public int[]
gids
All kernel group-IDs that have been assigned to this package. This is only filled in if the flag {@link PackageManager#GET_GIDS} was set.
public ActivityInfo[]
activities
Array of all {@link android.R.styleable#AndroidManifestActivity <activity>} tags included under <application>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_ACTIVITIES} was set.
public ActivityInfo[]
receivers
Array of all {@link android.R.styleable#AndroidManifestReceiver <receiver>} tags included under <application>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_RECEIVERS} was set.
public ServiceInfo[]
services
Array of all {@link android.R.styleable#AndroidManifestService <service>} tags included under <application>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_SERVICES} was set.
public ProviderInfo[]
providers
Array of all {@link android.R.styleable#AndroidManifestProvider <provider>} tags included under <application>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_PROVIDERS} was set.
public InstrumentationInfo[]
instrumentation
Array of all {@link android.R.styleable#AndroidManifestInstrumentation <instrumentation>} tags included under <manifest>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_INSTRUMENTATION} was set.
public PermissionInfo[]
permissions
Array of all {@link android.R.styleable#AndroidManifestPermission <permission>} tags included under <manifest>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_PERMISSIONS} was set.
public String[]
requestedPermissions
Array of all {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>} tags included under <manifest>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_PERMISSIONS} was set. This list includes all permissions requested, even those that were not granted or known by the system at install time.
public int[]
requestedPermissionsFlags
Array of flags of all {@link android.R.styleable#AndroidManifestUsesPermission <uses-permission>} tags included under <manifest>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_PERMISSIONS} was set. Each value matches the corresponding entry in {@link #requestedPermissions}, and will have the flags {@link #REQUESTED_PERMISSION_REQUIRED} and {@link #REQUESTED_PERMISSION_GRANTED} set as appropriate.
public static final int
REQUESTED_PERMISSION_REQUIRED
Flag for {@link #requestedPermissionsFlags}: the requested permission is required for the application to run; the user can not optionally disable it. Currently all permissions are required.
public static final int
REQUESTED_PERMISSION_GRANTED
Flag for {@link #requestedPermissionsFlags}: the requested permission is currently granted to the application.
public Signature[]
signatures
Array of all signatures read from the package file. This is only filled in if the flag {@link PackageManager#GET_SIGNATURES} was set.
public ConfigurationInfo[]
configPreferences
Application specified preferred configuration {@link android.R.styleable#AndroidManifestUsesConfiguration <uses-configuration>} tags included under <manifest>, or null if there were none. This is only filled in if the flag {@link PackageManager#GET_CONFIGURATIONS} was set.
public FeatureInfo[]
reqFeatures
Features that this application has requested.
public FeatureGroupInfo[]
featureGroups
Groups of features that this application has requested. Each group contains a set of features that are required. A device must match the features listed in {@link #reqFeatures} and one or more FeatureGroups in order to have satisfied the feature requirement.
public static final int
INSTALL_LOCATION_UNSPECIFIED
Constant corresponding to auto in the {@link android.R.attr#installLocation} attribute.
public static final int
INSTALL_LOCATION_AUTO
Constant corresponding to auto in the {@link android.R.attr#installLocation} attribute.
public static final int
INSTALL_LOCATION_INTERNAL_ONLY
Constant corresponding to internalOnly in the {@link android.R.attr#installLocation} attribute.
public static final int
INSTALL_LOCATION_PREFER_EXTERNAL
Constant corresponding to preferExternal in the {@link android.R.attr#installLocation} attribute.
public int
installLocation
The install location requested by the package. From the {@link android.R.attr#installLocation} attribute, one of {@link #INSTALL_LOCATION_AUTO}, {@link #INSTALL_LOCATION_INTERNAL_ONLY}, {@link #INSTALL_LOCATION_PREFER_EXTERNAL}
public boolean
coreApp
public boolean
requiredForAllUsers
public String
restrictedAccountType
public String
requiredAccountType
public String
overlayTarget
What package, if any, this package will overlay. Package name of target package, or null.
public static final Parcelable.Creator
CREATOR
Constructors Summary
public PackageInfo()


      
    
private PackageInfo(android.os.Parcel source)


       
        packageName = source.readString();
        splitNames = source.createStringArray();
        versionCode = source.readInt();
        versionName = source.readString();
        baseRevisionCode = source.readInt();
        splitRevisionCodes = source.createIntArray();
        sharedUserId = source.readString();
        sharedUserLabel = source.readInt();
        int hasApp = source.readInt();
        if (hasApp != 0) {
            applicationInfo = ApplicationInfo.CREATOR.createFromParcel(source);
        }
        firstInstallTime = source.readLong();
        lastUpdateTime = source.readLong();
        gids = source.createIntArray();
        activities = source.createTypedArray(ActivityInfo.CREATOR);
        receivers = source.createTypedArray(ActivityInfo.CREATOR);
        services = source.createTypedArray(ServiceInfo.CREATOR);
        providers = source.createTypedArray(ProviderInfo.CREATOR);
        instrumentation = source.createTypedArray(InstrumentationInfo.CREATOR);
        permissions = source.createTypedArray(PermissionInfo.CREATOR);
        requestedPermissions = source.createStringArray();
        requestedPermissionsFlags = source.createIntArray();
        signatures = source.createTypedArray(Signature.CREATOR);
        configPreferences = source.createTypedArray(ConfigurationInfo.CREATOR);
        reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
        featureGroups = source.createTypedArray(FeatureGroupInfo.CREATOR);
        installLocation = source.readInt();
        coreApp = source.readInt() != 0;
        requiredForAllUsers = source.readInt() != 0;
        restrictedAccountType = source.readString();
        requiredAccountType = source.readString();
        overlayTarget = source.readString();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public java.lang.StringtoString()

        return "PackageInfo{"
            + Integer.toHexString(System.identityHashCode(this))
            + " " + packageName + "}";
    
public voidwriteToParcel(android.os.Parcel dest, int parcelableFlags)

        dest.writeString(packageName);
        dest.writeStringArray(splitNames);
        dest.writeInt(versionCode);
        dest.writeString(versionName);
        dest.writeInt(baseRevisionCode);
        dest.writeIntArray(splitRevisionCodes);
        dest.writeString(sharedUserId);
        dest.writeInt(sharedUserLabel);
        if (applicationInfo != null) {
            dest.writeInt(1);
            applicationInfo.writeToParcel(dest, parcelableFlags);
        } else {
            dest.writeInt(0);
        }
        dest.writeLong(firstInstallTime);
        dest.writeLong(lastUpdateTime);
        dest.writeIntArray(gids);
        dest.writeTypedArray(activities, parcelableFlags);
        dest.writeTypedArray(receivers, parcelableFlags);
        dest.writeTypedArray(services, parcelableFlags);
        dest.writeTypedArray(providers, parcelableFlags);
        dest.writeTypedArray(instrumentation, parcelableFlags);
        dest.writeTypedArray(permissions, parcelableFlags);
        dest.writeStringArray(requestedPermissions);
        dest.writeIntArray(requestedPermissionsFlags);
        dest.writeTypedArray(signatures, parcelableFlags);
        dest.writeTypedArray(configPreferences, parcelableFlags);
        dest.writeTypedArray(reqFeatures, parcelableFlags);
        dest.writeTypedArray(featureGroups, parcelableFlags);
        dest.writeInt(installLocation);
        dest.writeInt(coreApp ? 1 : 0);
        dest.writeInt(requiredForAllUsers ? 1 : 0);
        dest.writeString(restrictedAccountType);
        dest.writeString(requiredAccountType);
        dest.writeString(overlayTarget);