Loading core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3609,6 +3609,7 @@ package android.content.pm { public abstract class PackageManager { method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void addOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener); method public abstract boolean arePermissionsIndividuallyControlled(); method @NonNull public boolean[] canPackageQuery(@NonNull String, @NonNull String[]) throws android.content.pm.PackageManager.NameNotFoundException; method @NonNull public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(@NonNull String); method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, @NonNull android.content.pm.PackageManager.ApplicationInfoFlags, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; core/java/android/app/ApplicationPackageManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -3816,8 +3816,17 @@ public class ApplicationPackageManager extends PackageManager { @NonNull String targetPackageName) throws NameNotFoundException { Objects.requireNonNull(sourcePackageName); Objects.requireNonNull(targetPackageName); return canPackageQuery(sourcePackageName, new String[]{targetPackageName})[0]; } @Override @NonNull public boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames) throws NameNotFoundException { Objects.requireNonNull(sourcePackageName); Objects.requireNonNull(targetPackageNames); try { return mPM.canPackageQuery(sourcePackageName, targetPackageName, getUserId()); return mPM.canPackageQuery(sourcePackageName, targetPackageNames, getUserId()); } catch (ParcelableException e) { e.maybeRethrow(PackageManager.NameNotFoundException.class); throw new RuntimeException(e); Loading core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -797,5 +797,5 @@ interface IPackageManager { void setKeepUninstalledPackages(in List<String> packageList); boolean canPackageQuery(String sourcePackageName, String targetPackageName, int userId); boolean[] canPackageQuery(String sourcePackageName, in String[] targetPackageNames, int userId); } core/java/android/content/pm/PackageManager.java +24 −0 Original line number Diff line number Diff line Loading @@ -10387,6 +10387,30 @@ public abstract class PackageManager { "canPackageQuery not implemented in subclass"); } /** * Same as {@link #canPackageQuery(String, String)} but accepts an array of target packages to * be queried. * * @param sourcePackageName The source package that would receive details about the * target package. * @param targetPackageNames An array of target packages whose details would be shared with the * source package. * @return An array of booleans where each member specifies whether the source package is able * to query for details about the target package given by the corresponding value at the same * index in the array of target packages. * @throws NameNotFoundException if either a given package can not be found on the * system, or if the caller is not able to query for details about the source or * target packages. * @hide */ @SystemApi @NonNull public boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames) throws NameNotFoundException { throw new UnsupportedOperationException( "canPackageQuery not implemented in subclass"); } /** * Makes a package that provides an authority {@code visibleAuthority} become visible to the * application {@code recipientUid}. Loading services/core/java/com/android/server/pm/Computer.java +3 −2 Original line number Diff line number Diff line Loading @@ -570,8 +570,9 @@ public interface Computer extends PackageDataSnapshot { @PackageManager.InstallReason int getInstallReason(@NonNull String packageName, @UserIdInt int userId); boolean canPackageQuery(@NonNull String sourcePackageName, @NonNull String targetPackageName, @UserIdInt int userId); @NonNull boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames, @UserIdInt int userId); boolean canForwardTo(@NonNull Intent intent, @Nullable String resolvedType, @UserIdInt int sourceUserId, @UserIdInt int targetUserId); Loading Loading
core/api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3609,6 +3609,7 @@ package android.content.pm { public abstract class PackageManager { method @RequiresPermission("android.permission.OBSERVE_GRANT_REVOKE_PERMISSIONS") public abstract void addOnPermissionsChangeListener(@NonNull android.content.pm.PackageManager.OnPermissionsChangedListener); method public abstract boolean arePermissionsIndividuallyControlled(); method @NonNull public boolean[] canPackageQuery(@NonNull String, @NonNull String[]) throws android.content.pm.PackageManager.NameNotFoundException; method @NonNull public abstract java.util.List<android.content.IntentFilter> getAllIntentFilters(@NonNull String); method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException; method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS) public android.content.pm.ApplicationInfo getApplicationInfoAsUser(@NonNull String, @NonNull android.content.pm.PackageManager.ApplicationInfoFlags, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
core/java/android/app/ApplicationPackageManager.java +10 −1 Original line number Diff line number Diff line Loading @@ -3816,8 +3816,17 @@ public class ApplicationPackageManager extends PackageManager { @NonNull String targetPackageName) throws NameNotFoundException { Objects.requireNonNull(sourcePackageName); Objects.requireNonNull(targetPackageName); return canPackageQuery(sourcePackageName, new String[]{targetPackageName})[0]; } @Override @NonNull public boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames) throws NameNotFoundException { Objects.requireNonNull(sourcePackageName); Objects.requireNonNull(targetPackageNames); try { return mPM.canPackageQuery(sourcePackageName, targetPackageName, getUserId()); return mPM.canPackageQuery(sourcePackageName, targetPackageNames, getUserId()); } catch (ParcelableException e) { e.maybeRethrow(PackageManager.NameNotFoundException.class); throw new RuntimeException(e); Loading
core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -797,5 +797,5 @@ interface IPackageManager { void setKeepUninstalledPackages(in List<String> packageList); boolean canPackageQuery(String sourcePackageName, String targetPackageName, int userId); boolean[] canPackageQuery(String sourcePackageName, in String[] targetPackageNames, int userId); }
core/java/android/content/pm/PackageManager.java +24 −0 Original line number Diff line number Diff line Loading @@ -10387,6 +10387,30 @@ public abstract class PackageManager { "canPackageQuery not implemented in subclass"); } /** * Same as {@link #canPackageQuery(String, String)} but accepts an array of target packages to * be queried. * * @param sourcePackageName The source package that would receive details about the * target package. * @param targetPackageNames An array of target packages whose details would be shared with the * source package. * @return An array of booleans where each member specifies whether the source package is able * to query for details about the target package given by the corresponding value at the same * index in the array of target packages. * @throws NameNotFoundException if either a given package can not be found on the * system, or if the caller is not able to query for details about the source or * target packages. * @hide */ @SystemApi @NonNull public boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames) throws NameNotFoundException { throw new UnsupportedOperationException( "canPackageQuery not implemented in subclass"); } /** * Makes a package that provides an authority {@code visibleAuthority} become visible to the * application {@code recipientUid}. Loading
services/core/java/com/android/server/pm/Computer.java +3 −2 Original line number Diff line number Diff line Loading @@ -570,8 +570,9 @@ public interface Computer extends PackageDataSnapshot { @PackageManager.InstallReason int getInstallReason(@NonNull String packageName, @UserIdInt int userId); boolean canPackageQuery(@NonNull String sourcePackageName, @NonNull String targetPackageName, @UserIdInt int userId); @NonNull boolean[] canPackageQuery(@NonNull String sourcePackageName, @NonNull String[] targetPackageNames, @UserIdInt int userId); boolean canForwardTo(@NonNull Intent intent, @Nullable String resolvedType, @UserIdInt int sourceUserId, @UserIdInt int targetUserId); Loading