Switch CtsLibcoreOjTestCases to use AndroidJUnitRunner

Change Ia6b2334a761186d19867b3dc1a289cef9901bee0, amongst other things,
adds support for the 'runnerBuilder' instrumentation argument to the
AndroidJUnitRunner class. That allows custom RunnerBuilder
implementations to be supplied by a package under test.

That change made it possible for this change to switch the
CtsLibcoreOjTestCases CTS package from using CoreTestRunner (which
supports TestNgRunnerBuilder classes automatically) to using
AndroidJUnitRunner with the runnerBuilder option.

Made the following changes:
* Remove reference to CoreTestRunner - AJUR is the default.
* Updated AndroidManifest to specify AJUR.
* Change core-listener argument to listener.
* Add filter argument (CoreTestRunner handled core-expectation
  automatically).
* Made TestNgRunnerBuilder public and specify it in the
  runnerBuilder argument to AJUR.

Running the test involved:
    make CtsLibcoreOjTestCases CtsLibcoreTestRunner
    cts-tradefed run cts -m CtsLibcoreOjTestCases

The tests were run as follows:
1) Without any changes, worked fine. This was to get a baseline for the
   tests that were run, of which there were 3975.
2) With the above changes except with an invalid runnerBuilder which
   caused the tests to fail. This was done to ensure that the changes
   were being made and that the runnerBuilder was being processed.
3) With this change, worked fine. Checked to make sure that the same
   number of tests were run, which they were.

Bug: 28689581
Bug: 64284431
Test: see above

(cherry picked from commit fd4d9c187fbddf1f1ede802f47d7d24cadd7865e)

Change-Id: I91c75b918a74c1c48eee7587d337992aa62d1ecf
diff --git a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
index 1465bf0..2f084b3 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
@@ -24,9 +24,9 @@
 import org.testng.annotations.Test;
 
 /**
- * A {@link RunnerBuilder} that can TestNG tests.
+ * A {@link RunnerBuilder} that can handle TestNG tests.
  */
-class TestNgRunnerBuilder extends RunnerBuilder {
+public class TestNgRunnerBuilder extends RunnerBuilder {
   // Returns a TestNG runner for this class, only if it is a class
   // annotated with testng's @Test or has any methods with @Test in it.
   @Override
diff --git a/tests/libcore/ojluni/AndroidManifest.xml b/tests/libcore/ojluni/AndroidManifest.xml
index 5f900a9..c010a32 100644
--- a/tests/libcore/ojluni/AndroidManifest.xml
+++ b/tests/libcore/ojluni/AndroidManifest.xml
@@ -18,8 +18,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="android.libcore.cts.oj">
     <uses-permission android:name="android.permission.INTERNET" />
 
-    <!-- important: instrument another package which actually contains the CTS core test runner -->
-    <instrumentation android:name="com.android.cts.core.runner.CoreTestRunner"
+    <!-- important: instrument another package which actually contains AJUR -->
+    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.runner"
                      android:label="CTS Libcore OJ test cases" />
 
diff --git a/tests/libcore/ojluni/AndroidTest.xml b/tests/libcore/ojluni/AndroidTest.xml
index 2eb644e..faaff96 100644
--- a/tests/libcore/ojluni/AndroidTest.xml
+++ b/tests/libcore/ojluni/AndroidTest.xml
@@ -28,11 +28,13 @@
         <option name="test-file-name" value="CtsLibcoreOjTestCases.apk" />
     </target_preparer>
     <test class="com.android.compatibility.testtype.LibcoreTest" >
-        <!-- override AJUR -->
-        <option name="runner" value="com.android.cts.core.runner.CoreTestRunner" />
         <option name="package" value="android.libcore.cts.oj" />
-        <option name="instrumentation-arg" key="core-listener"
+        <option name="instrumentation-arg" key="runnerBuilder"
+                value="com.android.cts.core.runner.support.TestNgRunnerBuilder"/>
+        <option name="instrumentation-arg" key="listener"
                 value="com.android.cts.runner.CtsTestRunListener"/>
+        <option name="instrumentation-arg" key="filter"
+                value="com.android.cts.core.runner.ExpectationBasedFilter" />
         <option name="core-expectation" value="/knownfailures.txt" />
         <option name="core-expectation" value="/brokentests.txt" />
         <option name="core-expectation" value="/icebox.txt" />