summaryrefslogtreecommitdiff
path: root/services/devicepolicy
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@google.com>2020-05-30 00:11:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-30 00:11:42 +0000
commitb9a239bef34ab52350924f3a17d59201b6192a69 (patch)
treed8e46f49fdbf003b0818dcc098db63bbf1ab0b21 /services/devicepolicy
parentaa5f48cffe92dd93bcae333d7b9e7a29595480b2 (diff)
parent307ea7a2fef3154683a013d6af565f311524de93 (diff)
Merge changes from topic "apr12" into rvc-dev
* changes: Collect NeededUriGrants without holding locks. Initial splitting of calculation and grants.
Diffstat (limited to 'services/devicepolicy')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 8d32d7c970bc..f1064d153814 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -297,6 +297,7 @@ import com.android.server.pm.RestrictionsSet;
import com.android.server.pm.UserRestrictionsUtils;
import com.android.server.pm.parsing.pkg.AndroidPackage;
import com.android.server.storage.DeviceStorageMonitorInternal;
+import com.android.server.uri.NeededUriGrants;
import com.android.server.uri.UriGrantsManagerInternal;
import com.android.server.wm.ActivityTaskManagerInternal;
@@ -8365,10 +8366,13 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
intent.putExtra(DeviceAdminReceiver.EXTRA_BUGREPORT_HASH, bugreportHash);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
- LocalServices.getService(UriGrantsManagerInternal.class)
- .grantUriPermissionFromIntent(Process.SHELL_UID,
- mOwners.getDeviceOwnerComponent().getPackageName(),
- intent, mOwners.getDeviceOwnerUserId());
+ final UriGrantsManagerInternal ugm = LocalServices
+ .getService(UriGrantsManagerInternal.class);
+ final NeededUriGrants needed = ugm.checkGrantUriPermissionFromIntent(intent,
+ Process.SHELL_UID, mOwners.getDeviceOwnerComponent().getPackageName(),
+ mOwners.getDeviceOwnerUserId());
+ ugm.grantUriPermissionUncheckedFromIntent(needed, null);
+
mContext.sendBroadcastAsUser(intent, UserHandle.of(mOwners.getDeviceOwnerUserId()));
}
} catch (FileNotFoundException e) {