Show toast if lockscreen password is not set
The test requires a lockscreen as precondition. Check that's the case
and inform tester otherwise.
Bug: 63071841
Test: Run CtsVerifier->BYOD provisioning->Organization info; tap "GO"
without setting a lockscreen password beforehand.
Change-Id: I775be33f7179e892018651c0503a82112da8bbd5
Merged-In: I775be33f7179e892018651c0503a82112da8bbd5
(cherry picked from commit d342cd3608b9ca9adae23eb8a1954cc7ee7d992b)
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 405a2fc..a16ba9e 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -2421,6 +2421,9 @@
5. Verify that the background color of the resulting dialog is as set by you.\n
6. Verify that the header text has organization name as set by you.\n
</string>
+
+ <string name="provisioning_byod_no_secure_lockscreen">No work lockscreen password set. Please run \"Select work lock test\" and rerun this test</string>
+
<string name="provisioning_byod_parent_profile_password">Personal password test</string>
<string name="provisioning_byod_parent_profile_password_description">
This test verifies that the password on the personal side can be chosen from within a managed profile.\n
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
index e9b6523..48323a7 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
@@ -351,7 +351,11 @@
KeyguardManager keyguardManager =
(KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
Intent launchIntent = keyguardManager.createConfirmDeviceCredentialIntent(null, null);
- startActivity(launchIntent);
+ if (launchIntent != null) {
+ startActivity(launchIntent);
+ } else {
+ showToast(R.string.provisioning_byod_no_secure_lockscreen);
+ }
} else if (ACTION_SET_ORGANIZATION_INFO.equals(action)) {
if(intent.hasExtra(OrganizationInfoTestActivity.EXTRA_ORGANIZATION_NAME)) {
final String organizationName = intent