我的脚本创建了密码并锁定了手机,但是如果我尝试将密码更改为
空白,它将失败。
我的锁定脚本:
DevicePolicyManager deviceManager = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
ComponentName compName = new ComponentName(MessageService.this, LockAdmin.class);
boolean active = deviceManager.isAdminActive(compName);
if (active) {
deviceManager.setPasswordQuality(compName,DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
deviceManager.setPasswordMinimumLength(compName, 5);
boolean result = deviceManager.resetPassword("blablabla", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);
}
所以我的问题是,如何将密码更改为空白或如何将锁定模式更改为“无”?
最佳答案
2分钟后,我尝试了
deviceManager.setPasswordMinimumLength(compName, 0);
boolean result = deviceManager.resetPassword("", DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY);
它就像一种魅力。