package android.content.pm; import android.os.Parcel; import android.os.Parcelable; import android.util.Printer; import java.text.Collator; import java.util.Comparator; /** * Information you can retrieve about a particular application. This * corresponds to information collected from the AndroidManifest.xml's * <application> tag. */ public class ApplicationInfo extends PackageItemInfo implements Parcelable { /** * Default task affinity of all activities in this application. See * {@link ActivityInfo#taskAffinity} for more information. This comes * from the "taskAffinity" attribute. */ public String taskAffinity; /** * Optional name of a permission required to be able to access this * application's components. From the "permission" attribute. */ public String permission; /** * The name of the process this application should run in. From the * "process" attribute or, if not set, the same as * packageName. */ public String processName; /** * Class implementing the Application object. From the "class" * attribute. */ public String className; /** * A style resource identifier (in the package's resources) of the * description of an application. From the "description" attribute * or, if not set, 0. */ public int descriptionRes; /** * A style resource identifier (in the package's resources) of the * default visual theme of the application. From the "theme" attribute * or, if not set, 0. */ public int theme; /** * Class implementing the Application's manage space * functionality. From the "manageSpaceActivity" * attribute. This is an optional attribute and will be null if * applications don't specify it in their manifest */ public String manageSpaceActivityName; /** * Class implementing the Application's backup functionality. From * the "backupAgent" attribute. This is an optional attribute and * will be null if the application does not specify it in its manifest. * *
If android:allowBackup is set to false, this attribute is ignored. * * {@hide} */ public String backupAgentName; /** * Value for {@link #flags}: if set, this application is installed in the * device's system image. */ public static final int FLAG_SYSTEM = 1<<0; /** * Value for {@link #flags}: set to true if this application would like to * allow debugging of its * code, even when installed on a non-development system. Comes * from {@link android.R.styleable#AndroidManifestApplication_debuggable * android:debuggable} of the <application> tag. */ public static final int FLAG_DEBUGGABLE = 1<<1; /** * Value for {@link #flags}: set to true if this application has code * associated with it. Comes * from {@link android.R.styleable#AndroidManifestApplication_hasCode * android:hasCode} of the <application> tag. */ public static final int FLAG_HAS_CODE = 1<<2; /** * Value for {@link #flags}: set to true if this application is persistent. * Comes from {@link android.R.styleable#AndroidManifestApplication_persistent * android:persistent} of the <application> tag. */ public static final int FLAG_PERSISTENT = 1<<3; /** * Value for {@link #flags}: set to true if this application holds the * {@link android.Manifest.permission#FACTORY_TEST} permission and the * device is running in factory test mode. */ public static final int FLAG_FACTORY_TEST = 1<<4; /** * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. * Comes from {@link android.R.styleable#AndroidManifestApplication_allowTaskReparenting * android:allowTaskReparenting} of the <application> tag. */ public static final int FLAG_ALLOW_TASK_REPARENTING = 1<<5; /** * Value for {@link #flags}: default value for the corresponding ActivityInfo flag. * Comes from {@link android.R.styleable#AndroidManifestApplication_allowClearUserData * android:allowClearUserData} of the <application> tag. */ public static final int FLAG_ALLOW_CLEAR_USER_DATA = 1<<6; /** * Value for {@link #flags}: this is set if this application has been * install as an update to a built-in system application. */ public static final int FLAG_UPDATED_SYSTEM_APP = 1<<7; /** * Value for {@link #flags}: this is set of the application has specified * {@link android.R.styleable#AndroidManifestApplication_testOnly * android:testOnly} to be true. */ public static final int FLAG_TEST_ONLY = 1<<8; /** * Value for {@link #flags}: true when the application's window can be * reduced in size for smaller screens. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_smallScreens * android:smallScreens}. */ public static final int FLAG_SUPPORTS_SMALL_SCREENS = 1<<9; /** * Value for {@link #flags}: true when the application's window can be * displayed on normal screens. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_normalScreens * android:normalScreens}. */ public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1<<10; /** * Value for {@link #flags}: true when the application's window can be * increased in size for larger screens. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_largeScreens * android:smallScreens}. */ public static final int FLAG_SUPPORTS_LARGE_SCREENS = 1<<11; /** * Value for {@link #flags}: true when the application knows how to adjust * its UI for different screen sizes. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_resizeable * android:resizeable}. */ public static final int FLAG_RESIZEABLE_FOR_SCREENS = 1<<12; /** * Value for {@link #flags}: true when the application knows how to * accomodate different screen densities. Corresponds to * {@link android.R.styleable#AndroidManifestSupportsScreens_anyDensity * android:anyDensity}. */ public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 1<<13; /** * Value for {@link #flags}: this is false if the application has set * its android:allowBackup to false, true otherwise. * * {@hide} */ public static final int FLAG_ALLOW_BACKUP = 1<<14; /** * Value for {@link #flags}: this is false if the application has set * its android:killAfterRestore to false, true otherwise. * *
If android:allowBackup is set to false or no android:backupAgent * is specified, this flag will be ignored. * * {@hide} */ public static final int FLAG_KILL_AFTER_RESTORE = 1<<15; /** * Value for {@link #flags}: this is true if the application has set * its android:restoreNeedsApplication to true, false otherwise. * *
If android:allowBackup is set to false or no android:backupAgent
* is specified, this flag will be ignored.
*
* {@hide}
*/
public static final int FLAG_RESTORE_NEEDS_APPLICATION = 1<<16;
/**
* Value for {@link #flags}: this is true if the application has set
* its android:neverEncrypt to true, false otherwise. It is used to specify
* that this package specifically "opts-out" of a secured file system solution,
* and will always store its data in-the-clear.
*
* {@hide}
*/
public static final int FLAG_NEVER_ENCRYPT = 1<<17;
/**
* Value for {@link #flags}: Set to true if the application has been
* installed using the forward lock option.
*
* {@hide}
*/
public static final int FLAG_FORWARD_LOCK = 1<<18;
/**
* Value for {@link #flags}: Set to true if the application is
* currently installed on the sdcard.
*
* {@hide}
*/
public static final int FLAG_ON_SDCARD = 1<<19;
/**
* Value for {@link #flags}: Set to true if the application is
* native-debuggable, i.e. embeds a gdbserver binary in its .apk
*
* {@hide}
*/
public static final int FLAG_NATIVE_DEBUGGABLE = 1<<20;
/**
* Flags associated with the application. Any combination of
* {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},
* {@link #FLAG_PERSISTENT}, {@link #FLAG_FACTORY_TEST}, and
* {@link #FLAG_ALLOW_TASK_REPARENTING}
* {@link #FLAG_ALLOW_CLEAR_USER_DATA}, {@link #FLAG_UPDATED_SYSTEM_APP},
* {@link #FLAG_TEST_ONLY}, {@link #FLAG_SUPPORTS_SMALL_SCREENS},
* {@link #FLAG_SUPPORTS_NORMAL_SCREENS},
* {@link #FLAG_SUPPORTS_LARGE_SCREENS}, {@link #FLAG_RESIZEABLE_FOR_SCREENS},
* {@link #FLAG_SUPPORTS_SCREEN_DENSITIES}
*/
public int flags = 0;
/**
* Full path to the location of this package.
*/
public String sourceDir;
/**
* Full path to the location of the publicly available parts of this
* package (i.e. the primary resource package and manifest). For
* non-forward-locked apps this will be the same as {@link #sourceDir).
*/
public String publicSourceDir;
/**
* Full paths to the locations of extra resource packages this application
* uses. This field is only used if there are extra resource packages,
* otherwise it is null.
*/
public String[] resourceDirs;
/**
* Paths to all shared libraries this application is linked against. This
* field is only set if the {@link PackageManager#GET_SHARED_LIBRARY_FILES
* PackageManager.GET_SHARED_LIBRARY_FILES} flag was used when retrieving
* the structure.
*/
public String[] sharedLibraryFiles;
/**
* Full path to a directory assigned to the package for its persistent
* data.
*/
public String dataDir;
/**
* The kernel user-ID that has been assigned to this application;
* currently this is not a unique ID (multiple applications can have
* the same uid).
*/
public int uid;
/**
* The minimum SDK version this application targets. It may run on earlier
* versions, but it knows how to work with any new behavior added at this
* version. Will be {@link android.os.Build.VERSION_CODES#CUR_DEVELOPMENT}
* if this is a development build and the app is targeting that. You should
* compare that this number is >= the SDK version number at which your
* behavior was introduced.
*/
public int targetSdkVersion;
/**
* When false, indicates that all components within this application are
* considered disabled, regardless of their individually set enabled status.
*/
public boolean enabled = true;
public void dump(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
if (className != null) {
pw.println(prefix + "className=" + className);
}
if (permission != null) {
pw.println(prefix + "permission=" + permission);
}
pw.println(prefix + "uid=" + uid + " taskAffinity=" + taskAffinity);
if (theme != 0) {
pw.println(prefix + "theme=0x" + Integer.toHexString(theme));
}
pw.println(prefix + "flags=0x" + Integer.toHexString(flags)
+ " processName=" + processName);
pw.println(prefix + "sourceDir=" + sourceDir);
pw.println(prefix + "publicSourceDir=" + publicSourceDir);
pw.println(prefix + "resourceDirs=" + resourceDirs);
pw.println(prefix + "dataDir=" + dataDir);
if (sharedLibraryFiles != null) {
pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
}
pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion);
if (manageSpaceActivityName != null) {
pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
}
if (descriptionRes != 0) {
pw.println(prefix + "description=0x"+Integer.toHexString(descriptionRes));
}
super.dumpBack(pw, prefix);
}
public static class DisplayNameComparator
implements Comparator