summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2014-11-25 15:15:35 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-11-25 15:15:35 +0000
commite1d84dd914ffe29fe821b814924b0a56506dc238 (patch)
treedff256de040e0af362af5b844d54195761c91a07 /services/devicepolicy/java
parent18032a083a0089c2b2f87b5bbb0c4c6626cccefd (diff)
parent9a4d0257beadf53c706afbcb4abc76c17a44ff00 (diff)
downloadframeworks_base-e1d84dd914ffe29fe821b814924b0a56506dc238.zip
frameworks_base-e1d84dd914ffe29fe821b814924b0a56506dc238.tar.gz
frameworks_base-e1d84dd914ffe29fe821b814924b0a56506dc238.tar.bz2
am 9a4d0257: am 520d20c1: am 702d9e31: Merge "Fix DPM.resetPassword("")" into lmp-mr1-dev
* commit '9a4d0257beadf53c706afbcb4abc76c17a44ff00': Fix DPM.resetPassword("")
Diffstat (limited to 'services/devicepolicy/java')
-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 5e332bd..8cf34c9 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -78,6 +78,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;
@@ -2576,13 +2577,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,
@@ -2686,7 +2689,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);