Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 457333a5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add a new getPackageInfoAsUser as a SystemApi."

parents 8e90ada6 ad219787
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1225,6 +1225,7 @@ package android.content.pm {
    method public abstract java.util.List<android.content.pm.InstantAppInfo> getInstantApps();
    method public abstract java.util.List<android.content.pm.IntentFilterVerificationInfo> getIntentFilterVerifications(java.lang.String);
    method public abstract int getIntentVerificationStatusAsUser(java.lang.String, int);
    method public android.content.pm.PackageInfo getPackageInfoAsUser(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract int getPermissionFlags(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract void grantRuntimePermission(java.lang.String, java.lang.String, android.os.UserHandle);
    method public abstract int installExistingPackage(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
+3 −0
Original line number Diff line number Diff line
@@ -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>
     *
+27 −0
Original line number Diff line number Diff line
@@ -3142,6 +3142,33 @@ public abstract class PackageManager {
    public abstract PackageInfo getPackageInfoAsUser(String packageName,
            @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.