summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2018-11-21 10:43:18 -0800
committerJoel Galenson <jgalenson@google.com>2018-11-21 15:25:17 -0800
commitad219787cc5b3fbcd3f4db16150bf4b369f640d5 (patch)
tree4cceb4f9942ecb6af1f6197b62d0e40a75489ba8 /core/java
parent588bdc6719523ed2fca73abcaae81233709c2895 (diff)
Add a new getPackageInfoAsUser as a SystemApi.
This is needed so the PermissionController can differentiate between multiple versions of the same app. Bug: 119811056 Test: Call API. Change-Id: I19150e1c8e5f204a846500cfe0021da742235213
Diffstat (limited to 'core/java')
-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 e9b240448eed..ab271c9282de 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 e14b17e5cdd3..cb7766e32e83 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -3131,6 +3131,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.