Add the new split interface to CTS

Allow CTS to try the new sharding interface in some cases.
Current use cases won't exercise the interface.

Test: local runs
Bug: 37211399
Change-Id: Iba0bba227ad759bc208f099a7d03edf1d9303661
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
index fc329af..180d316 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
@@ -273,6 +273,7 @@
     // variables used for local sharding scenario
     private static CountDownLatch sPreparedLatch;
     private boolean mIsLocalSharding = false;
+    private boolean mIsSharded = false;
 
     /**
      * Create a new {@link CompatibilityTest} that will run the default list of
@@ -753,6 +754,24 @@
      * {@inheritDoc}
      */
     @Override
+    public Collection<IRemoteTest> split(int shardCount) {
+        if (shardCount <= 1 || mIsSharded) {
+            return null;
+        }
+        mIsSharded = true;
+        List<IRemoteTest> shardQueue = new LinkedList<>();
+        for (int i = 0; i < shardCount; i++) {
+            CompatibilityTest test = (CompatibilityTest) getTestShard(shardCount, i);
+            shardQueue.add(test);
+            test.mIsSharded = true;
+        }
+        return shardQueue;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public IRemoteTest getTestShard(int shardCount, int shardIndex) {
         CompatibilityTest test = new CompatibilityTest(shardCount, mModuleRepo, shardIndex);
         OptionCopier.copyOptionsNoThrow(this, test);