Remove calls to resetPassword() in CTS verifier

New apps can no longer call resetPassword(). So remove that and ask user to
manually clear lockscreen if one exists before running the test.

Test: CTS verifier -> Device Owner Tests--> Disabled keyguard
Bug: 63115445
Change-Id: I753ccbda56a14038a7bb97a2db692cdbeb169bb9
Merged-In: I753ccbda56a14038a7bb97a2db692cdbeb169bb9
(cherry picked from commit 2e97208a4e119823c8fed7124a03370de6a02599)
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 405a2fc..e2f498f 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -2550,7 +2550,7 @@
     <string name="device_owner_reenable_statusbar_button">Reenable status bar</string>
     <string name="device_owner_disable_keyguard_test">Disable keyguard</string>
     <string name="device_owner_disable_keyguard_test_info">
-            Note that any device passwords that you might have set will be deleted during this test.\n
+            Before running this test, please make sure you have not set any device lockscreen password.\n
             Please press the below button to disable the keyguard. Press the power button on your device to
             switch off the screen. Then press the power button to switch the screen back on and verify that
             no keyguard was shown.\n
@@ -2560,6 +2560,7 @@
     <string name="device_owner_disable_keyguard_button">Disable keyguard</string>
     <string name="device_owner_reenable_keyguard_button">Reenable keyguard</string>
+    <string name="device_owner_lockscreen_secure">Please remove lockscreen password</string>
     <string name="device_profile_owner_permission_lockdown_test">Permissions lockdown</string>
     <string name="device_profile_owner_permission_lockdown_test_instructions">
             Select each of the three grant states for the permission shown below in turn.\n
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/
index 6f98241..5ecb1ef 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/
@@ -18,6 +18,7 @@
 import android.Manifest;
 import android.content.ComponentName;
@@ -35,6 +36,7 @@
 import android.provider.MediaStore;
 import android.provider.Settings;
 import android.util.Log;
+import android.widget.Toast;
@@ -206,10 +208,13 @@
                 } break;
                 case COMMAND_SET_KEYGUARD_DISABLED: {
                     boolean enforced = intent.getBooleanExtra(EXTRA_ENFORCED, false);
-                    if (enforced) {
-                        mDpm.resetPassword(null, 0);
+                    KeyguardManager km = this.getSystemService(KeyguardManager.class);
+                    if (km.isKeyguardSecure()) {
+                        Toast.makeText(this, getString(R.string.device_owner_lockscreen_secure),
+                                Toast.LENGTH_SHORT).show();
+                    } else {
+                        mDpm.setKeyguardDisabled(mAdmin, enforced);
-                    mDpm.setKeyguardDisabled(mAdmin, enforced);
                 } break;
                 case COMMAND_SET_STATUSBAR_DISABLED: {
                     boolean enforced = intent.getBooleanExtra(EXTRA_ENFORCED, false);