[RESTRICT AUTOMERGE]: Skip report creation with 0 modules/tests

This change prevents the tester from evading the TargetPreparer
preconditions by running retry on a failed invocation (by not recording
the run at all if no modules or tests were run).

* Add method in ResultReporter to allow report creation skipping
* Add logic in StsResultReporter to detect 0 module/test runs
* Update STS res XMLs to use StsResultReporter

Automerge is restricted because retry.xml is only used in PI.
Other desserts utilize tradefed default retry which handles this
correctly already.

Bug: 127303013
Test: `run sts-userbuild` on userdebug device does not create a result
anymore.

Change-Id: I745bc45d0f11ce137b48de0f7d962802b9e19881
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
index 220c9ac..2347577 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/ResultReporter.java
@@ -518,6 +518,15 @@
         }
     }
 
+    /**
+     * Returns whether a report creation should be skipped.
+     */
+    protected boolean shouldSkipReportCreation() {
+        // This value is always false here for backwards compatibility.
+        // Extended classes have the option to override this.
+        return false;
+    }
+
     private void finalizeResults() {
         // Add all device serials into the result to be serialized
         for (String deviceSerial : mMasterDeviceSerials) {
@@ -547,6 +556,10 @@
                 mResult.getModuleCompleteCount(), mResult.getModules().size());
 
 
+        if (shouldSkipReportCreation()) {
+            return;
+        }
+
         try {
             // Zip the full test results directory.
             copyDynamicConfigFiles();