cts: fix random failure in AmStartOptionsTests

Restrict display app checking to test packages.

During the test some other components may be launched because of
unrelated crashes, ignore app display traces from packages other
than the test ("android.server.app").

bug: 29451567
bug: 28333487
Change-Id: Ib6d465e07f5f9044d4964e02c575eb9df0a0a0e2
diff --git a/hostsidetests/services/activitymanager/src/android/server/cts/ActivityManagerAmStartOptionsTests.java b/hostsidetests/services/activitymanager/src/android/server/cts/ActivityManagerAmStartOptionsTests.java
index a18ed0c..0083be4 100644
--- a/hostsidetests/services/activitymanager/src/android/server/cts/ActivityManagerAmStartOptionsTests.java
+++ b/hostsidetests/services/activitymanager/src/android/server/cts/ActivityManagerAmStartOptionsTests.java
@@ -203,6 +203,11 @@
                 Matcher matcher = sDisplayTimePattern.matcher(line);
                 if (matcher.matches()) {
                     activityName = matcher.group(2);
+                    // Ignore activitiy displays from other packages, we don't
+                    // want some random activity starts to ruin our test.
+                    if (!activityName.startsWith("android.server.app")) {
+                        continue;
+                    }
                     if (!shouldStart) {
                         fail("Shouldn't display anything but displayed " + activityName);
                     }