DO NOT MERGE: Disable ENABLE_DYNAMIC_PERMISSIONS flag for now to avoid crashes.
Added TODO to enable this based on MediaProvider version (it needs a media provider version which includes as certain change.) Bug: 171491982 Test: No Change-Id: I717251f351a65255ff73bf782e4f2fce3a67328f
This commit is contained in:
@@ -991,7 +991,9 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub {
|
|||||||
// If this provider says that grants are always required, we need to
|
// If this provider says that grants are always required, we need to
|
||||||
// consult it directly to determine if the UID has permission
|
// consult it directly to determine if the UID has permission
|
||||||
final boolean forceMet;
|
final boolean forceMet;
|
||||||
if (ENABLE_DYNAMIC_PERMISSIONS && pi.forceUriPermissions) {
|
if (ENABLE_DYNAMIC_PERMISSIONS
|
||||||
|
&& pi.forceUriPermissions
|
||||||
|
&& isDynamicPermissionEnabledInMP()) {
|
||||||
final int providerUserId = UserHandle.getUserId(pi.applicationInfo.uid);
|
final int providerUserId = UserHandle.getUserId(pi.applicationInfo.uid);
|
||||||
final int clientUserId = UserHandle.getUserId(uid);
|
final int clientUserId = UserHandle.getUserId(uid);
|
||||||
if (providerUserId == clientUserId) {
|
if (providerUserId == clientUserId) {
|
||||||
@@ -1009,6 +1011,15 @@ public class UriGrantsManagerService extends IUriGrantsManager.Stub {
|
|||||||
return readMet && writeMet && forceMet;
|
return readMet && writeMet && forceMet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the available MediaProvider version contains the changes that enable dynamic
|
||||||
|
* permission.
|
||||||
|
*/
|
||||||
|
private boolean isDynamicPermissionEnabledInMP() {
|
||||||
|
// TODO(b/159995598) Check MediaProvider version.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
private void removeUriPermissionIfNeededLocked(UriPermission perm) {
|
private void removeUriPermissionIfNeededLocked(UriPermission perm) {
|
||||||
if (perm.modeFlags != 0) {
|
if (perm.modeFlags != 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user