summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-11-24 16:02:09 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-24 16:02:11 +0000
commit702d9e31b1bcacff975a2b8e0d04160bbd6811ed (patch)
tree5783311b109e6341cba16da9a34ef2c3281e6959 /services
parent671424951dcd2a0d1059c6d899a8649cbc8b5e26 (diff)
parentf8f56bce428bb2b89d1d572ccd2d604761dbbce8 (diff)
downloadframeworks_base-702d9e31b1bcacff975a2b8e0d04160bbd6811ed.zip
frameworks_base-702d9e31b1bcacff975a2b8e0d04160bbd6811ed.tar.gz
frameworks_base-702d9e31b1bcacff975a2b8e0d04160bbd6811ed.tar.bz2
Merge "Fix DPM.resetPassword("")" into lmp-mr1-dev
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 ac5fb18..6331dfe 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -77,6 +77,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;
@@ -2575,13 +2576,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,
@@ -2685,7 +2688,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);