summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-11-20 23:55:34 +0100
committerAdrian Roos <roosa@google.com>2014-11-21 13:34:06 +0100
commitf8f56bce428bb2b89d1d572ccd2d604761dbbce8 (patch)
tree34b6fc8c2a48584936a3514efa318d6d5a099229 /services
parent481a6df99fea124bc4354da34ff668750cdc9041 (diff)
downloadframeworks_base-f8f56bce428bb2b89d1d572ccd2d604761dbbce8.zip
frameworks_base-f8f56bce428bb2b89d1d572ccd2d604761dbbce8.tar.gz
frameworks_base-f8f56bce428bb2b89d1d572ccd2d604761dbbce8.tar.bz2
Fix DPM.resetPassword("")
While we're at it, also fix some multi-user issues in LockPatternUtils. Bug: 17496766 Change-Id: I8e557ea640fa589817c8f8f818c91463585d5ea7
Diffstat (limited to 'services')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java11
1 files changed, 9 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 9e51849..6c56bfe 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -76,6 +76,7 @@ import android.security.Credentials;
import android.security.IKeyChainService;
import android.security.KeyChain;
import android.security.KeyChain.KeyChainConnection;
+import android.text.TextUtils;
import android.util.Log;
import android.util.PrintWriterPrinter;
import android.util.Printer;
@@ -2561,13 +2562,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
return strictestAdmin;
}
- public boolean resetPassword(String password, int flags, int userHandle) {
+ public boolean resetPassword(String passwordOrNull, int flags, int userHandle) {
if (!mHasFeature) {
return false;
}
enforceCrossUserPermission(userHandle);
enforceNotManagedProfile(userHandle, "reset the password");
+ String password = passwordOrNull != null ? passwordOrNull : "";
+
int quality;
synchronized (this) {
// This api can only be called by an active device admin,
@@ -2671,7 +2674,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
long ident = Binder.clearCallingIdentity();
try {
LockPatternUtils utils = new LockPatternUtils(mContext);
- utils.saveLockPassword(password, quality, false, userHandle);
+ if (!TextUtils.isEmpty(password)) {
+ utils.saveLockPassword(password, quality, false, userHandle);
+ } else {
+ utils.clearLock(false, userHandle);
+ }
boolean requireEntry = (flags & DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY) != 0;
if (requireEntry) {
utils.requireCredentialEntry(UserHandle.USER_ALL);