Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c6d3ba5 authored by Evan Chen's avatar Evan Chen Committed by Automerger Merge Worker
Browse files

Merge "Remove role checker for non-selfManaged association" into tm-dev am:...

Merge "Remove role checker for non-selfManaged association" into tm-dev am: 5f7154db am: 6c9bb47b

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



Change-Id: I39ec892bfb86d2823a8230d7eefe95cbfe545722
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5d3620c2 6c9bb47b
Loading
Loading
Loading
Loading
+2 −13
Original line number Diff line number Diff line
@@ -182,7 +182,7 @@ class AssociationRequestsProcessor {
        // 2b.1. Populate the request with required info.
        request.setPackageName(packageName);
        request.setUserId(userId);
        request.setSkipPrompt(mayAssociateWithoutPrompt(request, packageName, userId));
        request.setSkipPrompt(mayAssociateWithoutPrompt(packageName, userId));

        // 2b.2. Prepare extras and create an Intent.
        final Bundle extras = new Bundle();
@@ -321,18 +321,7 @@ class AssociationRequestsProcessor {
        }
    };

    private boolean mayAssociateWithoutPrompt(@NonNull AssociationRequest request,
            @NonNull String packageName, @UserIdInt int userId) {
        final String deviceProfile = request.getDeviceProfile();
        if (deviceProfile != null) {
            final boolean isRoleHolder = Binder.withCleanCallingIdentity(
                    () -> isRoleHolder(mContext, userId, packageName, deviceProfile));
            if (isRoleHolder) {
                // Don't need to collect user's consent since app already holds the role.
                return true;
            }
        }

    private boolean mayAssociateWithoutPrompt(@NonNull String packageName, @UserIdInt int userId) {
        // Below we check if the requesting package is allowlisted (usually by the OEM) for creating
        // CDM associations without user confirmation (prompt).
        // For this we'll check to config arrays: