summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm/PackageManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/content/pm/PackageManager.java')
-rw-r--r--core/java/android/content/pm/PackageManager.java158
1 files changed, 100 insertions, 58 deletions
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 80bed0d..99c4c7f 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -150,21 +150,21 @@ public abstract class PackageManager {
* {@link PackageInfo#permissions}.
*/
public static final int GET_PERMISSIONS = 0x00001000;
-
+
/**
* Flag parameter to retrieve all applications(even uninstalled ones) with data directories.
- * This state could have resulted if applications have been deleted with flag
+ * This state could have resulted if applications have been deleted with flag
* DONT_DELETE_DATA
* with a possibility of being replaced or reinstalled in future
*/
public static final int GET_UNINSTALLED_PACKAGES = 0x00002000;
-
+
/**
* {@link PackageInfo} flag: return information about
* hardware preferences in
* {@link PackageInfo#configPreferences PackageInfo.configPreferences} and
* requested features in {@link PackageInfo#reqFeatures
- * PackageInfo.reqFeatures}.
+ * PackageInfo.reqFeatures}.
*/
public static final int GET_CONFIGURATIONS = 0x00004000;
@@ -244,7 +244,7 @@ public abstract class PackageManager {
public static final int INSTALL_REPLACE_EXISTING = 0x00000002;
/**
- * Flag parameter for {@link #installPackage} to indicate that you want to
+ * Flag parameter for {@link #installPackage} to indicate that you want to
* allow test packages (those that have set android:testOnly in their
* manifest) to be installed.
* @hide
@@ -555,7 +555,7 @@ public abstract class PackageManager {
* Return code for when package deletion succeeds. This is passed to the
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
* succeeded in deleting the package.
- *
+ *
* @hide
*/
public static final int DELETE_SUCCEEDED = 1;
@@ -564,7 +564,7 @@ public abstract class PackageManager {
* Deletion failed return code: this is passed to the
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
* failed to delete the package for an unspecified reason.
- *
+ *
* @hide
*/
public static final int DELETE_FAILED_INTERNAL_ERROR = -1;
@@ -574,7 +574,7 @@ public abstract class PackageManager {
* {@link IPackageDeleteObserver} by {@link #deletePackage()} if the system
* failed to delete the package because it is the active DevicePolicy
* manager.
- *
+ *
* @hide
*/
public static final int DELETE_FAILED_DEVICE_POLICY_MANAGER = -2;
@@ -583,7 +583,7 @@ public abstract class PackageManager {
* Return code that is passed to the {@link IPackageMoveObserver} by
* {@link #movePackage(android.net.Uri, IPackageMoveObserver)} when the
* package has been successfully moved by the system.
- *
+ *
* @hide
*/
public static final int MOVE_SUCCEEDED = 1;
@@ -641,7 +641,7 @@ public abstract class PackageManager {
* {@link #movePackage(android.net.Uri, IPackageMoveObserver)} if the
* specified package already has an operation pending in the
* {@link PackageHandler} queue.
- *
+ *
* @hide
*/
public static final int MOVE_FAILED_OPERATION_PENDING = -7;
@@ -789,7 +789,7 @@ public abstract class PackageManager {
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
-
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device has a telephony radio with data
@@ -797,14 +797,14 @@ public abstract class PackageManager {
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
-
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device has a CDMA telephony stack.
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
-
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device has a GSM telephony stack.
@@ -847,8 +847,8 @@ public abstract class PackageManager {
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
-
-
+
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device's touch screen supports
@@ -856,7 +856,7 @@ public abstract class PackageManager {
*/
@SdkConstant(SdkConstantType.FEATURE)
public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
-
+
/**
* Feature for {@link #getSystemAvailableFeatures} and
* {@link #hasSystemFeature}: The device's touch screen is capable of
@@ -932,11 +932,11 @@ public abstract class PackageManager {
* @return Returns a PackageInfo object containing information about the package.
* If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
* found in the list of installed applications, the package information is
- * retrieved from the list of uninstalled applications(which includes
+ * retrieved from the list of uninstalled applications(which includes
* installed applications as well as applications
* with data directory ie applications which had been
* deleted with DONT_DELTE_DATA flag set).
- *
+ *
* @see #GET_ACTIVITIES
* @see #GET_GIDS
* @see #GET_CONFIGURATIONS
@@ -947,7 +947,7 @@ public abstract class PackageManager {
* @see #GET_SERVICES
* @see #GET_SIGNATURES
* @see #GET_UNINSTALLED_PACKAGES
- *
+ *
*/
public abstract PackageInfo getPackageInfo(String packageName, int flags)
throws NameNotFoundException;
@@ -960,7 +960,7 @@ public abstract class PackageManager {
* the canonical name for each package.
*/
public abstract String[] currentToCanonicalPackageNames(String[] names);
-
+
/**
* Map from a packages canonical name to the current name in use on the device.
* @param names Array of new names to be mapped.
@@ -968,7 +968,7 @@ public abstract class PackageManager {
* the current name for each package.
*/
public abstract String[] canonicalToCurrentPackageNames(String[] names);
-
+
/**
* Return a "good" intent to launch a front-door activity in a package,
* for use for example to implement an "open" button when browsing through
@@ -976,12 +976,12 @@ public abstract class PackageManager {
* activity in the category {@link Intent#CATEGORY_INFO}, next for a
* main activity in the category {@link Intent#CATEGORY_LAUNCHER}, or return
* null if neither are found.
- *
+ *
* <p>Throws {@link NameNotFoundException} if a package with the given
* name can not be found on the system.
*
* @param packageName The name of the package to inspect.
- *
+ *
* @return Returns either a fully-qualified Intent that can be used to
* launch the main activity in the package, or null if the package does
* not contain such an activity.
@@ -1077,16 +1077,16 @@ public abstract class PackageManager {
*
* @param packageName The full name (i.e. com.google.apps.contacts) of an
* application.
- * @param flags Additional option flags. Use any combination of
+ * @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
* {@link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
*
- * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
+ * @return {@link ApplicationInfo} Returns ApplicationInfo object containing
* information about the package.
* If flag GET_UNINSTALLED_PACKAGES is set and if the package is not
- * found in the list of installed applications,
- * the application information is retrieved from the
- * list of uninstalled applications(which includes
+ * found in the list of installed applications,
+ * the application information is retrieved from the
+ * list of uninstalled applications(which includes
* installed applications as well as applications
* with data directory ie applications which had been
* deleted with DONT_DELTE_DATA flag set).
@@ -1108,7 +1108,7 @@ public abstract class PackageManager {
* @param component The full component name (i.e.
* com.google.apps.contacts/com.google.apps.contacts.ContactsList) of an Activity
* class.
- * @param flags Additional option flags. Use any combination of
+ * @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
* to modify the data (in ApplicationInfo) returned.
*
@@ -1131,7 +1131,7 @@ public abstract class PackageManager {
* @param component The full component name (i.e.
* com.google.apps.calendar/com.google.apps.calendar.CalendarAlarm) of a Receiver
* class.
- * @param flags Additional option flags. Use any combination of
+ * @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
* to modify the data returned.
*
@@ -1154,12 +1154,12 @@ public abstract class PackageManager {
* @param component The full component name (i.e.
* com.google.apps.media/com.google.apps.media.BackgroundPlayback) of a Service
* class.
- * @param flags Additional option flags. Use any combination of
+ * @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
* to modify the data returned.
*
* @return ServiceInfo containing information about the service.
- *
+ *
* @see #GET_META_DATA
* @see #GET_SHARED_LIBRARY_FILES
*/
@@ -1206,7 +1206,7 @@ public abstract class PackageManager {
*
* @return A List of PackageInfo objects, one for each package that is
* installed on the device. In the unlikely case of there being no
- * installed packages, an empty list is returned.
+ * installed packages, an empty list is returned.
* If flag GET_UNINSTALLED_PACKAGES is set, a list of all
* applications including those deleted with DONT_DELETE_DATA
* (partially installed apps with data directory) will be returned.
@@ -1221,7 +1221,7 @@ public abstract class PackageManager {
* @see #GET_SERVICES
* @see #GET_SIGNATURES
* @see #GET_UNINSTALLED_PACKAGES
- *
+ *
*/
public abstract List<PackageInfo> getInstalledPackages(int flags);
@@ -1283,7 +1283,7 @@ public abstract class PackageManager {
* the device is rebooted before it is written.
*/
public abstract boolean addPermissionAsync(PermissionInfo info);
-
+
/**
* Removes a permission that was previously added with
* {@link #addPermission(PermissionInfo)}. The same ownership rules apply
@@ -1370,7 +1370,7 @@ public abstract class PackageManager {
* user id is not currently assigned.
*/
public abstract String getNameForUid(int uid);
-
+
/**
* Return the user id associated with a shared user name. Multiple
* applications can specify a shared user name in their manifest and thus
@@ -1391,38 +1391,38 @@ public abstract class PackageManager {
* device. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all
* applications including those deleted with DONT_DELETE_DATA(partially
* installed apps with data directory) will be returned.
- *
- * @param flags Additional option flags. Use any combination of
+ *
+ * @param flags Additional option flags. Use any combination of
* {@link #GET_META_DATA}, {@link #GET_SHARED_LIBRARY_FILES},
* {link #GET_UNINSTALLED_PACKAGES} to modify the data returned.
*
* @return A List of ApplicationInfo objects, one for each application that
* is installed on the device. In the unlikely case of there being
- * no installed applications, an empty list is returned.
+ * no installed applications, an empty list is returned.
* If flag GET_UNINSTALLED_PACKAGES is set, a list of all
* applications including those deleted with DONT_DELETE_DATA
* (partially installed apps with data directory) will be returned.
- *
+ *
* @see #GET_META_DATA
* @see #GET_SHARED_LIBRARY_FILES
* @see #GET_UNINSTALLED_PACKAGES
*/
public abstract List<ApplicationInfo> getInstalledApplications(int flags);
-
+
/**
* Get a list of shared libraries that are available on the
* system.
- *
+ *
* @return An array of shared library names that are
* available on the system, or null if none are installed.
- *
+ *
*/
public abstract String[] getSystemSharedLibraryNames();
/**
* Get a list of features that are available on the
* system.
- *
+ *
* @return An array of FeatureInfo classes describing the features
* that are available on the system, or null if there are none(!!).
*/
@@ -1431,7 +1431,7 @@ public abstract class PackageManager {
/**
* Check whether the given feature name is one of the available
* features as returned by {@link #getSystemAvailableFeatures()}.
- *
+ *
* @return Returns true if the devices supports the feature, else
* false.
*/
@@ -1448,7 +1448,7 @@ public abstract class PackageManager {
* that {@link android.content.Context#startActivity(Intent)} and
* {@link android.content.Intent#resolveActivity(PackageManager)
* Intent.resolveActivity(PackageManager)} do.</p>
- *
+ *
* @param intent An intent containing all of the desired specification
* (action, data, type, category, and/or component).
* @param flags Additional option flags. The most important is
@@ -1747,7 +1747,7 @@ public abstract class PackageManager {
*
* @return Returns the image of the logo or null if the activity has no
* logo specified.
- *
+ *
* @throws NameNotFoundException Thrown if the resources for the given
* activity could not be loaded.
*
@@ -1768,7 +1768,7 @@ public abstract class PackageManager {
*
* @return Returns the image of the logo, or null if the activity has no
* logo specified.
- *
+ *
* @throws NameNotFoundException Thrown if the resources for application
* matching the given intent could not be loaded.
*
@@ -1801,7 +1801,7 @@ public abstract class PackageManager {
*
* @return Returns the image of the logo, or null if no application logo
* has been specified.
- *
+ *
* @throws NameNotFoundException Thrown if the resources for the given
* application could not be loaded.
*
@@ -1935,7 +1935,7 @@ public abstract class PackageManager {
* @see #GET_RECEIVERS
* @see #GET_SERVICES
* @see #GET_SIGNATURES
- *
+ *
*/
public PackageInfo getPackageArchiveInfo(String archiveFilePath, int flags) {
PackageParser packageParser = new PackageParser(archiveFilePath);
@@ -1952,7 +1952,7 @@ public abstract class PackageManager {
/**
* @hide
- *
+ *
* Install a package. Since this may take a little while, the result will
* be posted back to the given observer. An installation will fail if the calling context
* lacks the {@link android.Manifest.permission#INSTALL_PACKAGES} permission, if the
@@ -2012,11 +2012,11 @@ public abstract class PackageManager {
/**
* Retrieve the package name of the application that installed a package. This identifies
* which market the package came from.
- *
+ *
* @param packageName The name of the package to query
*/
public abstract String getInstallerPackageName(String packageName);
-
+
/**
* Attempts to clear the user data directory of an application.
* Since this may take a little while, the result will
@@ -2071,7 +2071,7 @@ public abstract class PackageManager {
* of bytes if possible.
* @param observer call back used to notify when
* the operation is completed
- *
+ *
* @hide
*/
public abstract void freeStorageAndNotify(long freeStorageSize, IPackageDataObserver observer);
@@ -2096,7 +2096,7 @@ public abstract class PackageManager {
* @param pi IntentSender call back used to
* notify when the operation is completed.May be null
* to indicate that no call back is desired.
- *
+ *
* @hide
*/
public abstract void freeStorage(long freeStorageSize, IntentSender pi);
@@ -2172,7 +2172,7 @@ public abstract class PackageManager {
* @deprecated This is a protected API that should not have been available
* to third party applications. It is the platform's responsibility for
* assigning preferred activities and this can not be directly modified.
- *
+ *
* Add a new preferred activity mapping to the system. This will be used
* to automatically select the given activity component when
* {@link Context#startActivity(Intent) Context.startActivity()} finds
@@ -2195,7 +2195,7 @@ public abstract class PackageManager {
* @deprecated This is a protected API that should not have been available
* to third party applications. It is the platform's responsibility for
* assigning preferred activities and this can not be directly modified.
- *
+ *
* Replaces an existing preferred activity mapping to the system, and if that were not present
* adds a new preferred activity. This will be used
* to automatically select the given activity component when
@@ -2304,7 +2304,7 @@ public abstract class PackageManager {
*/
public abstract void setApplicationEnabledSetting(String packageName,
int newState, int flags);
-
+
/**
* Return the the enabled setting for an application. This returns
* the last value set by
@@ -2345,4 +2345,46 @@ public abstract class PackageManager {
*/
public abstract void movePackage(
String packageName, IPackageMoveObserver observer, int flags);
+
+ /**
+ * Creates a user with the specified name and options.
+ *
+ * @param name the user's name
+ * @param flags flags that identify the type of user and other properties.
+ * @see UserInfo
+ *
+ * @return the UserInfo object for the created user, or null if the user could not be created.
+ * @hide
+ */
+ public abstract UserInfo createUser(String name, int flags);
+
+ /**
+ * @return the list of users that were created
+ * @hide
+ */
+ public abstract List<UserInfo> getUsers();
+
+ /**
+ * @param id the ID of the user, where 0 is the primary user.
+ * @hide
+ */
+ public abstract boolean removeUser(int id);
+
+ /**
+ * Updates the user's name.
+ *
+ * @param id the user's id
+ * @param name the new name for the user
+ * @hide
+ */
+ public abstract void updateUserName(int id, String name);
+
+ /**
+ * Changes the user's properties specified by the flags.
+ *
+ * @param id the user's id
+ * @param flags the new flags for the user
+ * @hide
+ */
+ public abstract void updateUserFlags(int id, int flags);
}