Add testing option to disable synthetic input collection

Bug: b/484870212
Change-Id: I0ce527e09b06e2ca8147ca67e53fe575eee7b042
diff --git a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
index dbb58cc..533d001 100644
--- a/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
+++ b/src/main/java/com/android/tools/r8/synthesis/SyntheticItems.java
@@ -338,6 +338,11 @@
       return;
     }
 
+    if (!appView.options().getTestingOptions().collectSyntheticInputs) {
+      appView.appInfo().classes().forEach(DexProgramClass::stripSyntheticInputMarker);
+      return;
+    }
+
     // Collecting synthetic items must be the very first task after application build.
     SyntheticItems synthetics = appView.getSyntheticItems();
     assert synthetics.committed.isEmpty();
diff --git a/src/main/java/com/android/tools/r8/utils/InternalOptions.java b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
index b2b3c91..a98e819 100644
--- a/src/main/java/com/android/tools/r8/utils/InternalOptions.java
+++ b/src/main/java/com/android/tools/r8/utils/InternalOptions.java
@@ -2442,6 +2442,13 @@
     public boolean applyIfRulesToLibrary =
         SystemPropertyUtils.parseSystemPropertyOrDefault(
             "com.android.tools.r8.applyIfRulesToLibrary", false);
+    // When disabled, input synthetics will be treated as non-synthetic classes.
+    // The primary use case of this is to make blast radius computation more robust in the presence
+    // of input synthetics (e.g., avoid that blast radius cannot be computed due to errors such as
+    // "Attempt at compiling intermediate artifact without its context").
+    public boolean collectSyntheticInputs =
+        SystemPropertyUtils.parseSystemPropertyOrDefault(
+            "com.android.tools.r8.collectSyntheticInputs", true);
     // TODO(b/374715251): Look into enabling this.
     public boolean enableUseLastLocalRegisterAsMoveExceptionRegister = false;
     public boolean enableKeepInfoCanonicalizer = true;