diff options
| author | 2024-09-25 10:23:01 -0300 | |
|---|---|---|
| committer | 2024-09-25 10:23:01 -0300 | |
| commit | 2727b84fa2b051ce256470cb21485d4d84a0150f (patch) | |
| tree | a37a718f29f9b7a5eafd9fcc98f989123519f8f7 | |
| parent | 50e83ba8f0e7ffd3dd4f8e5abb867a5d15263397 (diff) | |
Remove RESET_PASSWORD_TOKEN policy when the generated escrow token is not valid.
Flag: android.app.admin.flags.reset_password_with_token_coexistence
Test: adb shell aflags enable
android.app.admin.flags.reset_password_with_token_coexistence && btest -s sw android.devicepolicy.cts.ResetPasswordWithTokenTest
Bug: 369152176
Change-Id: I7997957fd0440c7a4746eabc7b3ed36c0d9937be
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 407a5a638db1..b6a4481902ab 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -19384,11 +19384,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { PolicyDefinition.RESET_PASSWORD_TOKEN, enforcingAdmin, userId); - // TODO(b/369152176): Address difference in behavior regarding addEscrowToken when - // compared with the else branch. long tokenHandle = addEscrowToken( token, currentTokenHandle == null ? 0 : currentTokenHandle, userId); if (tokenHandle == 0) { + mDevicePolicyEngine.removeLocalPolicy( + PolicyDefinition.RESET_PASSWORD_TOKEN, + enforcingAdmin, + userId); return false; } mDevicePolicyEngine.setLocalPolicy( |