Introduce LockscreenCredential
Bug: 65239740
Test: builds
Change-Id: I04085c2f047ffb450c6cee7876e8b62a122be737
diff --git a/Common/src/com/googlecode/android_scripting/facade/SettingsFacade.java b/Common/src/com/googlecode/android_scripting/facade/SettingsFacade.java
index 7228695..282de8f 100644
--- a/Common/src/com/googlecode/android_scripting/facade/SettingsFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/SettingsFacade.java
@@ -19,7 +19,6 @@
import android.app.AlarmManager;
import android.app.NotificationManager;
import android.app.Service;
-import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
@@ -33,6 +32,7 @@
import android.view.WindowManager;
import com.android.internal.widget.LockPatternUtils;
+import com.android.internal.widget.LockscreenCredential;
import com.googlecode.android_scripting.BaseApplication;
import com.googlecode.android_scripting.FutureActivityTaskExecutor;
@@ -270,8 +270,9 @@
// mLockPatternUtils.setLockPatternEnabled(true, UserHandle.myUserId());
mLockPatternUtils.setLockScreenDisabled(false, UserHandle.myUserId());
mLockPatternUtils.setCredentialRequiredToDecrypt(true);
- mLockPatternUtils.saveLockPassword(password, previousPassword,
- DevicePolicyManager.PASSWORD_QUALITY_NUMERIC, UserHandle.myUserId());
+ mLockPatternUtils.setLockCredential(LockscreenCredential.createPin(password),
+ LockscreenCredential.createPasswordOrNone(previousPassword),
+ UserHandle.myUserId());
}
@Rpc(description = "Disable screen lock password on the device. Note that disabling the " +
@@ -283,9 +284,9 @@
description = "The current password used to lock the device")
@RpcDefault("1111")
@RpcOptional String currentPassword) {
- byte[] currentPasswordBytes = currentPassword != null ? currentPassword.getBytes()
- : null;
- mLockPatternUtils.clearLock(currentPasswordBytes, UserHandle.myUserId());
+ mLockPatternUtils.setLockCredential(LockscreenCredential.createNone(),
+ LockscreenCredential.createPasswordOrNone(currentPassword),
+ UserHandle.myUserId());
mLockPatternUtils.setLockScreenDisabled(true, UserHandle.myUserId());
}