summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andrei Onea <andreionea@google.com> 2020-02-04 18:13:36 +0000
committer Andrei Onea <andreionea@google.com> 2020-02-04 18:21:36 +0000
commit7c8130368282d97289fcbfbdbb28169824c718dc (patch)
treec14f2154289f696cc055c4e9e9c15909c5499338
parentea2a33611353db16dde47c44f633edb003df8cb1 (diff)
Clear caller identity before calls to PlatformCompat
This is a pre-emptive fix for http://b/142942524 before the compat change permissions are re-added. Bug: 142942524 Test: atest DevicePolicyManagerTest Test: 1. Install TestDPC via adb 2. Invoke "Set up Te..." from the launcher to create a work profile and follow "next" button and select "skip adding an account" 3. Select TestDPC from the "work" tab of the list of all apps in launcher. 4. Using built-in search look for "Password constraints" and tap it. 5. tap "Minimum password length" and try to set it to 5. Before change: Neither user 1010193 nor current process has android.permission.INTERACT_ACROSS_USERS. After Change: password quality should be at least 131072 for setPasswordMinimumLength Change-Id: I026b15f0c2562293402bb8de55b0c63a4bb22a85
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 65cabadaa3d8..75516cf88a4d 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4680,12 +4680,15 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
private void ensureMinimumQuality(
int userId, ActiveAdmin admin, int minimumQuality, String operation) {
- if (admin.mPasswordPolicy.quality < minimumQuality
- && passwordQualityInvocationOrderCheckEnabled(admin.info.getPackageName(),
- userId)) {
- throw new IllegalStateException(String.format(
- "password quality should be at least %d for %s", minimumQuality, operation));
- }
+ mInjector.binderWithCleanCallingIdentity(() -> {
+ if (admin.mPasswordPolicy.quality < minimumQuality
+ && passwordQualityInvocationOrderCheckEnabled(admin.info.getPackageName(),
+ userId)) {
+ throw new IllegalStateException(String.format(
+ "password quality should be at least %d for %s",
+ minimumQuality, operation));
+ }
+ });
}
@Override