Move MutateApexTransition shortcut later

Returning from MutateApexTransition too early is allowing invalid
apex_available values to be ignored for modules that have no apex
variations.  Move the exit later so that apex_available checks
happen and platform variants are hidden consistently.

Bug: 394664568
Test: builds
Change-Id: I324de8090a9f1a874b5b22f20b8d62bf22c7d79c
diff --git a/android/apex.go b/android/apex.go
index c2f73a9..a5ccd52 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -616,25 +616,26 @@
 		apexInfos = allApexInfos.ApexInfos
 	}
 
-	// Shortcut
-	if len(apexInfos) == 0 {
-		return
-	}
-
-	// Do some validity checks.
-	// TODO(jiyong): is this the right place?
-	base.checkApexAvailableProperty(ctx)
-
-	if !module.UniqueApexVariations() && !base.ApexProperties.UniqueApexVariationsForDeps {
-		apexInfos, _ = mergeApexVariations(apexInfos)
-	}
-
 	if platformVariation && !ctx.Host() && !module.AvailableFor(AvailableToPlatform) && module.NotAvailableForPlatform() {
 		// Do not install the module for platform, but still allow it to output
 		// uninstallable AndroidMk entries in certain cases when they have side
 		// effects.  TODO(jiyong): move this routine to somewhere else
 		module.MakeUninstallable()
 	}
+
+	// Do some validity checks.
+	// TODO(jiyong): is this the right place?
+	base.checkApexAvailableProperty(ctx)
+
+	// Shortcut
+	if len(apexInfos) == 0 {
+		return
+	}
+
+	if !module.UniqueApexVariations() && !base.ApexProperties.UniqueApexVariationsForDeps {
+		apexInfos, _ = mergeApexVariations(apexInfos)
+	}
+
 	if !platformVariation {
 		var thisApexInfo ApexInfo