CTS test for Android Security CVE-2017-18275

Test: successful run of newly introduced CTS test case.

Bug: 111211205
Change-Id: Ied56fbd81dba3e2598b5edcb28a1a9df490257d3
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_07.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_07.java
index 172f0fc..64929d9 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_07.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_07.java
@@ -35,4 +35,26 @@
         AdbUtils.runPocAssertNoCrashes(
             "CVE-2018-9424", getDevice(), "android\\.hardware\\.drm@\\d\\.\\d-service");
     }
+
+    /*
+     * CVE-2017-18275
+     */
+    @Test
+    @SecurityTest(minPatchLevel = "2018-07")
+    public void testPocCVE_2017_18275() throws Exception {
+      String command =
+          "am startservice "
+          + "-n com.qualcomm.simcontacts/com.qualcomm.simcontacts.SimAuthenticateService "
+          + "-a android.accounts.AccountAuthenticator -e account_name cve_2017_18275";
+      String result = AdbUtils.runCommandLine(
+          "pm list packages | grep com.qualcomm.simcontacts", getDevice());
+      if (result.contains("com.qualcomm.simcontacts")) {
+          AdbUtils.runCommandLine("logcat -c", getDevice());
+          AdbUtils.runCommandLine(command, getDevice());
+          String logcat = AdbUtils.runCommandLine("logcat -d", getDevice());
+          assertNotMatchesMultiLine(
+                "Authenticator: Add SIM account.*ContactsProvider: Accounts changed",
+                logcat);
+      }
+    }
 }