Add a 'remove lock' step to CA notification test
As the notification doesn't show any more if a strong keyguard is set
Bug: 28443055
Change-Id: Iea073581a201d0f730a6e6a3ba636a77494f5b0c
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 72e3c9b..28fcddf 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1322,7 +1322,11 @@
<string name="cacert_done">Done</string>
<string name="cacert_install_cert">Use the CertInstaller to install the certificate. When it opens, just tap "Okay". If this button does nothing, pass the test and move on.</string>
<string name="cacert_check_cert_in_settings">Visit the user-installed trusted credentials page and confirm that the "Internet Widgits Pty Ltd" cert appears in the list.</string>
- <string name="cacert_check_notification">Please look at the new notification and confirm: It say the network may be monitored. Tapping it brings up a more detailed explanation and a button to check trusted credentials. Tapping that button brings up the Trusted Credentials page you just visited.</string>
+ <string name="cacert_remove_screen_lock">You may have been prompted to set a screen lock when installing the certificate. If so, remove it. If not, you may skip this step.</string>
+ <string name="cacert_check_notification">Look at the system notifications. Confirm that:\n
+1. There is a notification saying a certificate authority is installed.\n
+2. Tapping that notification brings up a more detailed explanation and a button to check trusted credentials.\n
+3. Tapping that button brings up the Trusted Credentials page you just visited.</string>
<string name="cacert_dismiss_notification">Dismiss the notification. If it cannot be dismissed, fail the test.</string>
<string name="caboot_test">CA Cert Notification on Boot test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/security/CAInstallNotificationVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/security/CAInstallNotificationVerifierActivity.java
index 3e8110e..d49047f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/security/CAInstallNotificationVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/security/CAInstallNotificationVerifierActivity.java
@@ -17,6 +17,7 @@
package com.android.cts.verifier.security;
import android.app.Service;
+import android.app.admin.DevicePolicyManager;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.os.Bundle;
@@ -60,6 +61,7 @@
protected boolean doneInstallingCert = false;
protected boolean doneCheckingInSettings = false;
+ protected boolean doneRemovingScreenLock = false;
protected boolean doneCheckingNotification = false;
protected boolean doneDismissingNotification = false;
@@ -112,6 +114,7 @@
private void createTestItems() {
createUserItem(R.string.cacert_install_cert, new InstallCert());
createUserItem(R.string.cacert_check_cert_in_settings, new OpenTrustedCredentials());
+ createUserItem(R.string.cacert_remove_screen_lock, new RemoveScreenLock());
createUserItem(R.string.cacert_check_notification,
new DoneCheckingNotification(), R.string.cacert_done);
createUserItem(R.string.cacert_dismiss_notification,
@@ -179,10 +182,13 @@
testCheckedSettings(1);
break;
case 2:
- testCheckedNotification(2);
+ testRemovedScreenLock(2);
break;
case 3:
- testNotificationDismissed(3);
+ testCheckedNotification(3);
+ break;
+ case 4:
+ testNotificationDismissed(4);
break;
}
}
@@ -247,6 +253,18 @@
}
}
+ class RemoveScreenLock implements OnClickListener {
+ @Override
+ public void onClick(View v) {
+ try {
+ startActivity(new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD));
+ } catch (ActivityNotFoundException e) {
+ Log.w(TAG, "Activity not found for ACTION_SET_NEW_PASSWORD");
+ }
+ doneRemovingScreenLock = true;
+ }
+ }
+
class DoneCheckingNotification implements OnClickListener {
@Override
public void onClick(View v) {
@@ -281,6 +299,15 @@
}
}
+ private void testRemovedScreenLock(final int i) {
+ if (doneRemovingScreenLock) {
+ mStatus[i] = PASS;
+ next();
+ } else {
+ delay();
+ }
+ }
+
private void testCheckedNotification(final int i) {
if (doneCheckingNotification) {
mStatus[i] = PASS;