Don't require MANAGE_ROLE_HOLDERS when removing CDM associatons
Test: manual, using a test app Fixes: 176133554 Change-Id: Iaeb2eee9936c3ebd8772ad3c8790b3c592b2e401
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user