Merge "Don't require MANAGE_ROLE_HOLDERS when removing CDM associatons"

This commit is contained in:
TreeHugger Robot
2020-12-22 22:11:58 +00:00
committed by Android (Google) Code Review

View File

@@ -612,20 +612,25 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
+ " for " + association
+ " - profile still present in " + otherAssociationWithDeviceProfile);
} else {
mRoleManager.removeRoleHolderAsUser(
association.getDeviceProfile(),
association.getPackageName(),
RoleManager.MANAGE_HOLDERS_FLAG_DONT_KILL_APP,
UserHandle.of(association.getUserId()),
getContext().getMainExecutor(),
success -> {
if (!success) {
Log.e(LOG_TAG, "Failed to revoke device profile role "
+ association.getDeviceProfile()
+ " to " + association.getPackageName()
+ " for user " + association.getUserId());
}
});
long identity = Binder.clearCallingIdentity();
try {
mRoleManager.removeRoleHolderAsUser(
association.getDeviceProfile(),
association.getPackageName(),
RoleManager.MANAGE_HOLDERS_FLAG_DONT_KILL_APP,
UserHandle.of(association.getUserId()),
getContext().getMainExecutor(),
success -> {
if (!success) {
Log.e(LOG_TAG, "Failed to revoke device profile role "
+ association.getDeviceProfile()
+ " to " + association.getPackageName()
+ " for user " + association.getUserId());
}
});
} finally {
Binder.restoreCallingIdentity(identity);
}
}
}
}