Allow optionally to backfill jar with Tradefed ones

For test mapping aosp, we might be missing google-tradefed, this
logic will allow us to test out the backfill.

Test: presubmit
Bug: 281690698
Change-Id: Ic7543d66f66ee82e3a17c3224101d22ab0444f4e
diff --git a/test_observatory/com/android/tradefed/observatory/TestDiscoveryInvoker.java b/test_observatory/com/android/tradefed/observatory/TestDiscoveryInvoker.java
index f7b58b4..02c361a 100644
--- a/test_observatory/com/android/tradefed/observatory/TestDiscoveryInvoker.java
+++ b/test_observatory/com/android/tradefed/observatory/TestDiscoveryInvoker.java
@@ -61,6 +61,7 @@
     private final File mRootDir;
     private final IRunUtil mRunUtil = new RunUtil();
     private final boolean mHasConfigFallback;
+    private final boolean mUseCurrentTradefed;
     private File mTestDir;
     public static final String TRADEFED_OBSERVATORY_ENTRY_PATH =
             TestDiscoveryExecutor.class.getName();
@@ -100,7 +101,7 @@
      * default config name and root directory.
      */
     public TestDiscoveryInvoker(IConfiguration config, String defaultConfigName, File rootDir) {
-        this(config, defaultConfigName, rootDir, false);
+        this(config, defaultConfigName, rootDir, false, false);
     }
 
     /**
@@ -111,12 +112,14 @@
             IConfiguration config,
             String defaultConfigName,
             File rootDir,
-            boolean hasConfigFallback) {
+            boolean hasConfigFallback,
+            boolean useCurrentTradefed) {
         mConfiguration = config;
         mDefaultConfigName = defaultConfigName;
         mRootDir = rootDir;
         mTestDir = null;
         mHasConfigFallback = hasConfigFallback;
+        mUseCurrentTradefed = useCurrentTradefed;
     }
 
     /**
@@ -333,7 +336,7 @@
      * @throws IOException
      */
     private String buildTestMappingClasspath(File workingDir) throws IOException {
-        List<File> classpathList = new ArrayList<>();
+        List<String> classpathList = new ArrayList<>();
 
         if (!workingDir.exists()) {
             throw new FileNotFoundException("Couldn't find the build directory");
@@ -346,14 +349,21 @@
         }
         for (File toolsFile : workingDir.listFiles()) {
             if (toolsFile.getName().endsWith(".jar")) {
-                classpathList.add(toolsFile);
+                classpathList.add(toolsFile.getAbsolutePath());
             }
         }
         Collections.sort(classpathList);
+        if (mUseCurrentTradefed) {
+            classpathList.add(getCurrentClassPath());
+        }
 
         return Joiner.on(":").join(classpathList);
     }
 
+    private String getCurrentClassPath() {
+        return System.getProperty("java.class.path");
+    }
+
     /**
      * Build the classpath string based on jars in the XTS test root directory's tools folder.
      *