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

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

Merge "Add system APIs to query intent components and application info."

parents 8b38fa96 8c7e93b1
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1215,6 +1215,7 @@ package android.content.pm {
    method public abstract boolean arePermissionsIndividuallyControlled();
    method public abstract boolean arePermissionsIndividuallyControlled();
    method public boolean canSuspendPackage(java.lang.String);
    method public boolean canSuspendPackage(java.lang.String);
    method public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(java.lang.String);
    method public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(java.lang.String);
    method public android.content.pm.ApplicationInfo getApplicationInfoAsUser(java.lang.String, int, android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
    method public android.content.pm.dex.ArtManager getArtManager();
    method public android.content.pm.dex.ArtManager getArtManager();
    method public abstract java.lang.String getDefaultBrowserPackageNameAsUser(int);
    method public abstract java.lang.String getDefaultBrowserPackageNameAsUser(int);
    method public java.lang.CharSequence getHarmfulAppWarning(java.lang.String);
    method public java.lang.CharSequence getHarmfulAppWarning(java.lang.String);
@@ -1230,6 +1231,9 @@ package android.content.pm {
    method public abstract int installExistingPackage(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract int installExistingPackage(java.lang.String) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract int installExistingPackage(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method public abstract int installExistingPackage(java.lang.String, int) throws android.content.pm.PackageManager.NameNotFoundException;
    method public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(android.content.Intent, int, android.os.UserHandle);
    method public java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceiversAsUser(android.content.Intent, int, android.os.UserHandle);
    method public java.util.List<android.content.pm.ResolveInfo> queryIntentActivitiesAsUser(android.content.Intent, int, android.os.UserHandle);
    method public java.util.List<android.content.pm.ResolveInfo> queryIntentContentProvidersAsUser(android.content.Intent, int, android.os.UserHandle);
    method public java.util.List<android.content.pm.ResolveInfo> queryIntentServicesAsUser(android.content.Intent, int, android.os.UserHandle);
    method public abstract void registerDexModule(java.lang.String, android.content.pm.PackageManager.DexModuleRegisterCallback);
    method public abstract void registerDexModule(java.lang.String, android.content.pm.PackageManager.DexModuleRegisterCallback);
    method public abstract void removeOnPermissionsChangeListener(android.content.pm.PackageManager.OnPermissionsChangedListener);
    method public abstract void removeOnPermissionsChangeListener(android.content.pm.PackageManager.OnPermissionsChangedListener);
    method public deprecated void replacePreferredActivity(android.content.IntentFilter, int, java.util.List<android.content.ComponentName>, android.content.ComponentName);
    method public deprecated void replacePreferredActivity(android.content.IntentFilter, int, java.util.List<android.content.ComponentName>, android.content.ComponentName);
+94 −0
Original line number Original line Diff line number Diff line
@@ -3376,6 +3376,33 @@ public abstract class PackageManager {
    public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
    public abstract ApplicationInfo getApplicationInfoAsUser(String packageName,
            @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;
            @ApplicationInfoFlags int flags, @UserIdInt int userId) throws NameNotFoundException;


    /**
     * Retrieve all of the information we know about a particular
     * package/application, for a specific user.
     *
     * @param packageName The full name (i.e. com.google.apps.contacts) of an
     *            application.
     * @param flags Additional option flags to modify the data returned.
     * @return An {@link ApplicationInfo} 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 application 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
     */
    @NonNull
    @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
    @SystemApi
    public ApplicationInfo getApplicationInfoAsUser(@NonNull String packageName,
            @ApplicationInfoFlags int flags, @NonNull UserHandle user)
            throws NameNotFoundException {
        return getApplicationInfoAsUser(packageName, flags, user.getIdentifier());
    }

    /**
    /**
     * Retrieve all of the information we know about a particular activity
     * Retrieve all of the information we know about a particular activity
     * class.
     * class.
@@ -4202,6 +4229,32 @@ public abstract class PackageManager {
    public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
    public abstract List<ResolveInfo> queryIntentActivitiesAsUser(Intent intent,
            @ResolveInfoFlags int flags, @UserIdInt int userId);
            @ResolveInfoFlags int flags, @UserIdInt int userId);


    /**
     * Retrieve all activities that can be performed for the given intent, for a
     * specific user.
     *
     * @param intent The desired intent as per resolveActivity().
     * @param flags Additional option flags to modify the data returned. The
     *            most important is {@link #MATCH_DEFAULT_ONLY}, to limit the
     *            resolution to only those activities that support the
     *            {@link android.content.Intent#CATEGORY_DEFAULT}. Or, set
     *            {@link #MATCH_ALL} to prevent any filtering of the results.
     * @param user The user being queried.
     * @return Returns a List of ResolveInfo objects containing one entry for
     *         each matching activity, ordered from best to worst. In other
     *         words, the first item is what would be returned by
     *         {@link #resolveActivity}. If there are no matching activities, an
     *         empty list is returned.
     * @hide
     */
    @NonNull
    @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
    @SystemApi
    public List<ResolveInfo> queryIntentActivitiesAsUser(@NonNull Intent intent,
            @ResolveInfoFlags int flags, @NonNull UserHandle user) {
        return queryIntentActivitiesAsUser(intent, flags, user.getIdentifier());
    }

    /**
    /**
     * Retrieve a set of activities that should be presented to the user as
     * Retrieve a set of activities that should be presented to the user as
     * similar options. This is like {@link #queryIntentActivities}, except it
     * similar options. This is like {@link #queryIntentActivities}, except it
@@ -4333,6 +4386,27 @@ public abstract class PackageManager {
    public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
    public abstract List<ResolveInfo> queryIntentServicesAsUser(Intent intent,
            @ResolveInfoFlags int flags, @UserIdInt int userId);
            @ResolveInfoFlags int flags, @UserIdInt int userId);


    /**
     * Retrieve all services that can match the given intent for a given user.
     *
     * @param intent The desired intent as per resolveService().
     * @param flags Additional option flags to modify the data returned.
     * @param user The user being queried.
     * @return Returns a List of ResolveInfo objects containing one entry for
     *         each matching service, ordered from best to worst. In other
     *         words, the first item is what would be returned by
     *         {@link #resolveService}. If there are no matching services, an
     *         empty list or null is returned.
     * @hide
     */
    @NonNull
    @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
    @SystemApi
    public List<ResolveInfo> queryIntentServicesAsUser(@NonNull Intent intent,
            @ResolveInfoFlags int flags, @NonNull UserHandle user) {
        return queryIntentServicesAsUser(intent, flags, user.getIdentifier());
    }

    /**
    /**
     * Retrieve all providers that can match the given intent.
     * Retrieve all providers that can match the given intent.
     *
     *
@@ -4349,6 +4423,26 @@ public abstract class PackageManager {
    public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
    public abstract List<ResolveInfo> queryIntentContentProvidersAsUser(
            Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);
            Intent intent, @ResolveInfoFlags int flags, @UserIdInt int userId);


    /**
     * Retrieve all providers that can match the given intent.
     *
     * @param intent An intent containing all of the desired specification
     *            (action, data, type, category, and/or component).
     * @param flags Additional option flags to modify the data returned.
     * @param user The user being queried.
     * @return Returns a List of ResolveInfo objects containing one entry for
     *         each matching provider, ordered from best to worst. If there are
     *         no matching services, an empty list or null is returned.
     * @hide
     */
    @NonNull
    @RequiresPermission(Manifest.permission.INTERACT_ACROSS_USERS)
    @SystemApi
    public List<ResolveInfo> queryIntentContentProvidersAsUser(@NonNull Intent intent,
            @ResolveInfoFlags int flags, @NonNull UserHandle user) {
        return queryIntentContentProvidersAsUser(intent, flags, user.getIdentifier());
    }

    /**
    /**
     * Retrieve all providers that can match the given intent.
     * Retrieve all providers that can match the given intent.
     *
     *