Loading core/java/android/content/ContentResolver.java +2 −0 Original line number Diff line number Diff line Loading @@ -1819,6 +1819,7 @@ public abstract class ContentResolver { * calling app. That is, the returned permissions have been granted * <em>to</em> the calling app. Only persistable grants taken with * {@link #takePersistableUriPermission(Uri, int)} are returned. * <p>Note: Some of the returned URIs may not be usable until after the user is unlocked. * * @see #takePersistableUriPermission(Uri, int) * @see #releasePersistableUriPermission(Uri, int) Loading @@ -1837,6 +1838,7 @@ public abstract class ContentResolver { * calling app. That is, the returned permissions have been granted * <em>from</em> the calling app. Only grants taken with * {@link #takePersistableUriPermission(Uri, int)} are returned. * <p>Note: Some of the returned URIs may not be usable until after the user is unlocked. */ public @NonNull List<UriPermission> getOutgoingPersistedUriPermissions() { try { Loading services/core/java/com/android/server/am/ActivityManagerService.java +5 −26 Original line number Diff line number Diff line Loading @@ -8337,7 +8337,7 @@ public final class ActivityManagerService extends ActivityManagerNative final IPackageManager pm = AppGlobals.getPackageManager(); final String authority = grantUri.uri.getAuthority(); final ProviderInfo pi = getProviderInfoLocked(authority, grantUri.sourceUserId, MATCH_DEBUG_TRIAGED_MISSING); MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE); if (pi == null) { Slog.w(TAG, "No content provider found for permission revoke: " + grantUri.toSafeString()); Loading Loading @@ -8435,7 +8435,7 @@ public final class ActivityManagerService extends ActivityManagerNative final String authority = uri.getAuthority(); final ProviderInfo pi = getProviderInfoLocked(authority, userId, MATCH_DEBUG_TRIAGED_MISSING); MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE); if (pi == null) { Slog.w(TAG, "No content provider found for permission revoke: " + uri.toSafeString()); Loading Loading @@ -8832,10 +8832,11 @@ public final class ActivityManagerService extends ActivityManagerNative Preconditions.checkNotNull(packageName, "packageName"); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getUserId(callingUid); final IPackageManager pm = AppGlobals.getPackageManager(); try { final int packageUid = pm.getPackageUid(packageName, MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(callingUid)); final int packageUid = pm.getPackageUid(packageName, MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, callingUserId); if (packageUid != callingUid) { throw new SecurityException( "Package " + packageName + " does not belong to calling UID " + callingUid); Loading @@ -8852,30 +8853,8 @@ public final class ActivityManagerService extends ActivityManagerNative if (perms == null) { Slog.w(TAG, "No permission grants found for " + packageName); } else { final int userId = UserHandle.getUserId(callingUid); Set<String> existingAuthorities = null; for (UriPermission perm : perms.values()) { if (packageName.equals(perm.targetPkg) && perm.persistedModeFlags != 0) { // Is this provider available in the current boot state? If the user // is not running and unlocked we check if the provider package exists. if (!mUserController.isUserRunningLocked(userId, ActivityManager.FLAG_AND_UNLOCKED)) { String authority = perm.uri.uri.getAuthority(); if (existingAuthorities == null || !existingAuthorities.contains(authority)) { ProviderInfo providerInfo = getProviderInfoLocked(authority, userId, MATCH_DEBUG_TRIAGED_MISSING); if (providerInfo != null) { if (existingAuthorities == null) { existingAuthorities = new ArraySet<>(); } existingAuthorities.add(authority); } else { continue; } } } result.add(perm.buildPersistedPublicApiObject()); } } Loading Loading
core/java/android/content/ContentResolver.java +2 −0 Original line number Diff line number Diff line Loading @@ -1819,6 +1819,7 @@ public abstract class ContentResolver { * calling app. That is, the returned permissions have been granted * <em>to</em> the calling app. Only persistable grants taken with * {@link #takePersistableUriPermission(Uri, int)} are returned. * <p>Note: Some of the returned URIs may not be usable until after the user is unlocked. * * @see #takePersistableUriPermission(Uri, int) * @see #releasePersistableUriPermission(Uri, int) Loading @@ -1837,6 +1838,7 @@ public abstract class ContentResolver { * calling app. That is, the returned permissions have been granted * <em>from</em> the calling app. Only grants taken with * {@link #takePersistableUriPermission(Uri, int)} are returned. * <p>Note: Some of the returned URIs may not be usable until after the user is unlocked. */ public @NonNull List<UriPermission> getOutgoingPersistedUriPermissions() { try { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +5 −26 Original line number Diff line number Diff line Loading @@ -8337,7 +8337,7 @@ public final class ActivityManagerService extends ActivityManagerNative final IPackageManager pm = AppGlobals.getPackageManager(); final String authority = grantUri.uri.getAuthority(); final ProviderInfo pi = getProviderInfoLocked(authority, grantUri.sourceUserId, MATCH_DEBUG_TRIAGED_MISSING); MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE); if (pi == null) { Slog.w(TAG, "No content provider found for permission revoke: " + grantUri.toSafeString()); Loading Loading @@ -8435,7 +8435,7 @@ public final class ActivityManagerService extends ActivityManagerNative final String authority = uri.getAuthority(); final ProviderInfo pi = getProviderInfoLocked(authority, userId, MATCH_DEBUG_TRIAGED_MISSING); MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE); if (pi == null) { Slog.w(TAG, "No content provider found for permission revoke: " + uri.toSafeString()); Loading Loading @@ -8832,10 +8832,11 @@ public final class ActivityManagerService extends ActivityManagerNative Preconditions.checkNotNull(packageName, "packageName"); final int callingUid = Binder.getCallingUid(); final int callingUserId = UserHandle.getUserId(callingUid); final IPackageManager pm = AppGlobals.getPackageManager(); try { final int packageUid = pm.getPackageUid(packageName, MATCH_DEBUG_TRIAGED_MISSING, UserHandle.getUserId(callingUid)); final int packageUid = pm.getPackageUid(packageName, MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, callingUserId); if (packageUid != callingUid) { throw new SecurityException( "Package " + packageName + " does not belong to calling UID " + callingUid); Loading @@ -8852,30 +8853,8 @@ public final class ActivityManagerService extends ActivityManagerNative if (perms == null) { Slog.w(TAG, "No permission grants found for " + packageName); } else { final int userId = UserHandle.getUserId(callingUid); Set<String> existingAuthorities = null; for (UriPermission perm : perms.values()) { if (packageName.equals(perm.targetPkg) && perm.persistedModeFlags != 0) { // Is this provider available in the current boot state? If the user // is not running and unlocked we check if the provider package exists. if (!mUserController.isUserRunningLocked(userId, ActivityManager.FLAG_AND_UNLOCKED)) { String authority = perm.uri.uri.getAuthority(); if (existingAuthorities == null || !existingAuthorities.contains(authority)) { ProviderInfo providerInfo = getProviderInfoLocked(authority, userId, MATCH_DEBUG_TRIAGED_MISSING); if (providerInfo != null) { if (existingAuthorities == null) { existingAuthorities = new ArraySet<>(); } existingAuthorities.add(authority); } else { continue; } } } result.add(perm.buildPersistedPublicApiObject()); } } Loading