Merge "Don't require MANAGE_ROLE_HOLDERS when removing CDM associatons" into udc-dev am: c01e1ce412

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21475550

Change-Id: I263955ec3f3c5e9966b5c23283e96044d185386c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Evan Chen
2023-02-17 21:32:13 +00:00
committed by Automerger Merge Worker

View File

@@ -27,6 +27,7 @@ import android.annotation.UserIdInt;
import android.app.role.RoleManager; import android.app.role.RoleManager;
import android.companion.AssociationInfo; import android.companion.AssociationInfo;
import android.content.Context; import android.content.Context;
import android.os.Binder;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.Log; import android.util.Log;
import android.util.Slog; import android.util.Slog;
@@ -84,7 +85,9 @@ final class RolesUtils {
Slog.i(TAG, "Removing CDM role holder, role=" + deviceProfile Slog.i(TAG, "Removing CDM role holder, role=" + deviceProfile
+ ", package=u" + userId + "\\" + packageName); + ", package=u" + userId + "\\" + packageName);
roleManager.removeRoleHolderAsUser(deviceProfile, packageName, final long identity = Binder.clearCallingIdentity();
try {
roleManager.removeRoleHolderAsUser(deviceProfile, packageName,
MANAGE_HOLDERS_FLAG_DONT_KILL_APP, userHandle, context.getMainExecutor(), MANAGE_HOLDERS_FLAG_DONT_KILL_APP, userHandle, context.getMainExecutor(),
success -> { success -> {
if (!success) { if (!success) {
@@ -92,6 +95,9 @@ final class RolesUtils {
+ " from the list of " + deviceProfile + " holders."); + " from the list of " + deviceProfile + " holders.");
} }
}); });
} finally {
Binder.restoreCallingIdentity(identity);
}
} }
private RolesUtils() {}; private RolesUtils() {};