summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-11-23 15:05:59 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-11-23 15:05:59 +0000
commit457333a54a89cb0163bf9bbaa7fcc742fe26b36f (patch)
treea4be261b0caad4427d9f3aa834c8856918602dc5 /core/java/android
parent8e90ada67e4b160a9983be1733c5be7e1cfd98e7 (diff)
parentad219787cc5b3fbcd3f4db16150bf4b369f640d5 (diff)
Merge "Add a new getPackageInfoAsUser as a SystemApi."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/Intent.java3
-rw-r--r--core/java/android/content/pm/PackageManager.java27
2 files changed, 30 insertions, 0 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 10c6bc6f191c..75f5b1731e88 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1767,6 +1767,9 @@ public class Intent implements Parcelable, Cloneable {
* that should be managed by the launched UI.
* </p>
* <p>
+ * <li> {@link #EXTRA_USER} specifies the UserHandle of the user that owns the app.
+ * </p>
+ * <p>
* Output: Nothing.
* </p>
*
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 361bebaec3a2..ad06be3b026b 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3143,6 +3143,33 @@ public abstract class PackageManager {
@PackageInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
/**
+ * Retrieve overall information about an application package that is
+ * installed on the system.
+ *
+ * @param packageName The full name (i.e. com.google.apps.contacts) of the
+ * desired package.
+ * @param flags Additional option flags to modify the data returned.
+ * @param userHandle The user.
+ * @return A PackageInfo object containing information about the package. If
+ * flag {@code MATCH_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 installed applications as well as
+ * applications with data directory i.e. applications which had been
+ * deleted with {@code DONT_DELETE_DATA} flag set).
+ * @throws NameNotFoundException if a package with the given name cannot be
+ * found on the system.
+ * @hide
+ */
+ @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
+ @SystemApi
+ public @NonNull PackageInfo getPackageInfoAsUser(@NonNull String packageName,
+ @PackageInfoFlags int flags,
+ @NonNull UserHandle userHandle) throws NameNotFoundException {
+ return getPackageInfoAsUser(packageName, flags, userHandle.getIdentifier());
+ }
+
+ /**
* Map from the current package names in use on the device to whatever
* the current canonical name of that package is.
* @param names Array of current names to be mapped.