From f9dded9434277127a03fe80a6cc896c85c8b5e30 Mon Sep 17 00:00:00 2001 From: Evan Chen Date: Fri, 13 May 2022 15:38:13 -0700 Subject: Remove role checker for non-selfManaged association MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should always show the dialog except the certificate allowlist we introduced for Samsung for singleDevice associaiton. Reason: One application could manage multiple watches. Without user consent dialog, users don’t know which watch will be paired. "Make CDM skip the confirmation UI if the application that sent the association request already holds the role for that device profile" should only work for selfManaged device. Fix: 232578878 Test: atest CtsCompanionDeviceManagerCoreTestCases atest CtsCompanionDeviceManagerUiAutomationTestCases atest CtsOsTestCases:CompanionDeviceManagerTest Change-Id: Ieaf4e641a641d22ddb6f06e8ae21f51b875ba8e9 --- .../server/companion/AssociationRequestsProcessor.java | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java b/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java index 7a5fa628f645..570e4e6fdc3d 100644 --- a/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java +++ b/services/companion/java/com/android/server/companion/AssociationRequestsProcessor.java @@ -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: -- cgit v1.2.3-59-g8ed1b