Use alias for test_per_src apex dependencies

AddFarVariationDependencies was broken, which allowed apex to add
dependencies on tests by requesting an empty test_per_src variation
even though some test dependencies did not have a test_per_src
variation.  Add an alias from the pre-test_per_src variation
variant to the empty test_per_src variation, and drop the
test_per_src variation when requesting the depencency.

Test: TestApexWithTests
Change-Id: I2ed7bdd761027956141e25d4d81f9074afe628b6
diff --git a/apex/apex.go b/apex/apex.go
index 8c85555..8e35e07 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1450,8 +1450,6 @@
 	binVariations := target.Variations()
 	libVariations := append(target.Variations(),
 		blueprint.Variation{Mutator: "link", Variation: "shared"})
-	testVariations := append(target.Variations(),
-		blueprint.Variation{Mutator: "test_per_src", Variation: ""}) // "" is the all-tests variant
 
 	if ctx.Device() {
 		binVariations = append(binVariations,
@@ -1459,8 +1457,6 @@
 		libVariations = append(libVariations,
 			blueprint.Variation{Mutator: "image", Variation: imageVariation},
 			blueprint.Variation{Mutator: "version", Variation: ""}) // "" is the non-stub variant
-		testVariations = append(testVariations,
-			blueprint.Variation{Mutator: "image", Variation: imageVariation})
 	}
 
 	ctx.AddFarVariationDependencies(libVariations, sharedLibTag, nativeModules.Native_shared_libs...)
@@ -1469,7 +1465,7 @@
 
 	ctx.AddFarVariationDependencies(binVariations, executableTag, nativeModules.Binaries...)
 
-	ctx.AddFarVariationDependencies(testVariations, testTag, nativeModules.Tests...)
+	ctx.AddFarVariationDependencies(binVariations, testTag, nativeModules.Tests...)
 }
 
 func (a *apexBundle) combineProperties(ctx android.BottomUpMutatorContext) {