am 7b75fe24: Explicitly check for the presence of CTS Robot.
* commit '7b75fe243221384ca416e473d2001289173c2eea':
Explicitly check for the presence of CTS Robot.
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 176d506..af269c6 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -975,6 +975,7 @@
<string name="package_priority_info">This test checks that the NotificationManagerService respects
user preferences about relative package priorities.
</string>
+ <string name="package_priority_bot">Verifying that the CTS Robot helper package is installed.</string>
<string name="package_priority_high">Find \"%s\" under \"App notifications\" in the \"Sound & notifications\" settings panel, and mark it as having notification priority.</string>
<string name="package_priority_default">Find \"%s\" under \"App notifications\" in the \"Sound & notifications\" settings panel, and make sure it has default priority.</string>
<string name="package_priority_user_order">Check that ranker respects user priorities.</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/PackagePriorityVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/PackagePriorityVerifierActivity.java
index a6affb3..26000b2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/PackagePriorityVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/PackagePriorityVerifierActivity.java
@@ -18,6 +18,7 @@
import android.app.Notification;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -57,6 +58,7 @@
protected List<InteractiveTestCase> createTestItems() {
mAppLabel = getString(R.string.app_name);
List<InteractiveTestCase> tests = new ArrayList<>(17);
+ tests.add(new CheckForBot());
tests.add(new IsEnabledTest());
tests.add(new ServiceStartedTest());
tests.add(new WaitForSetPriorityDefault());
@@ -68,6 +70,27 @@
// Tests
+ /** Make sure the helper package is installed. */
+ protected class CheckForBot extends InteractiveTestCase {
+ @Override
+ View inflate(ViewGroup parent) {
+ return createAutoItem(parent, R.string.package_priority_bot);
+ }
+
+ @Override
+ void test() {
+ PackageManager pm = mContext.getPackageManager();
+ try {
+ pm.getPackageInfo(NOTIFICATION_BOT_PACKAGE, 0);
+ status = PASS;
+ } catch (PackageManager.NameNotFoundException e) {
+ status = FAIL;
+ logFail("You must install the CTS Robot helper, aka " + NOTIFICATION_BOT_PACKAGE);
+ }
+ next();
+ }
+ }
+
/** Wait for the user to set the target package priority to default. */
protected class WaitForSetPriorityDefault extends InteractiveTestCase {
@Override