Convert android.TransitionMutator to TransitionInfo

Use the ApexInfo instead of a string as the TransitionInfo for apex
variations.  This removes the need for apexInfoMutator, which is the
last remaining top down mutator.

This has a variety of ramifications.  One is that it is no longer
possible to add a dependency onto the apex variation of a module,
as that would require constructing a matching ApexInfo.  Instead,
anything that wants to add a dependency on the apex variation has
to depend on the apex instead, and get to the module by walking
its transistive dependencies.

Another ramification is that modules in apexes can no longer
determine which apexes they are in (unless they set
UniqueApexVariations so that each variation is in exactly one
apex).  This prevents some of the existing container violation
checks from working after this CL, tracked in b/394955484.

It also requires using unique variation names for the prebuilt
and source dependencies of apexes, so the apex variations
for dependencies of prebuilts now have a prebuilt_ prefix.

Bug: 372543712
Bug: 394955484
Test: go test ./...
Change-Id: I3d08aca1ac956ab0e343ec3f235a736cd93be0e1
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index 05915be..ca63020 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -66,6 +66,7 @@
 				exported_bootclasspath_fragments: [
 					"%s",
 				],
+				prefer: false,
 			}
 		`, apex, apexFile, fragment)),
 		android.FixtureAddFile(filepath.Join(dir, apexFile), nil),
@@ -226,8 +227,8 @@
 			checkBootJarsPackageCheckRule(t, result,
 				append(
 					[]string{
-						"out/soong/.intermediates/prebuilts/apex/com.android.art/android_common_com.android.art/deapexer/javalib/core1.jar",
-						"out/soong/.intermediates/prebuilts/apex/com.android.art/android_common_com.android.art/deapexer/javalib/core2.jar",
+						"out/soong/.intermediates/prebuilts/apex/com.android.art/android_common_prebuilt_com.android.art/deapexer/javalib/core1.jar",
+						"out/soong/.intermediates/prebuilts/apex/com.android.art/android_common_prebuilt_com.android.art/deapexer/javalib/core2.jar",
 						"out/soong/.intermediates/default/java/framework/android_common/aligned/framework.jar",
 					},
 					java.ApexBootJarDexJarPaths...,
diff --git a/sdk/testing.go b/sdk/testing.go
index f5518c4..cd7bbf5 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -281,7 +281,7 @@
 
 		// Run the snapshot with the snapshot preparer and the extra preparer, which must come after as
 		// it may need to modify parts of the MockFS populated by the snapshot preparer.
-		result := android.GroupFixturePreparers(snapshotPreparer, extraPreparer, customizedPreparers).
+		result := android.GroupFixturePreparers(snapshotPreparer, customizedPreparers, extraPreparer).
 			ExtendWithErrorHandler(customization.errorHandler).
 			RunTest(t)
 
@@ -314,6 +314,11 @@
 			snapshotBpFile := filepath.Join(snapshotSubDir, "Android.bp")
 			unpreferred := string(fs[snapshotBpFile])
 			fs[snapshotBpFile] = []byte(strings.ReplaceAll(unpreferred, "prefer: false,", "prefer: true,"))
+
+			prebuiltApexBpFile := "prebuilts/apex/Android.bp"
+			if prebuiltApexBp, ok := fs[prebuiltApexBpFile]; ok {
+				fs[prebuiltApexBpFile] = []byte(strings.ReplaceAll(string(prebuiltApexBp), "prefer: false,", "prefer: true,"))
+			}
 		})
 
 		runSnapshotTestWithCheckers(t, checkSnapshotPreferredWithSource, preferPrebuilts)