Merge "HideFromMake in `apexTransitionMutator` should respect special cases" into main
diff --git a/android/apex.go b/android/apex.go
index b19c477..29b2a9f 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -712,7 +712,7 @@
 	base.ApexProperties.InAnyApex = true
 	base.ApexProperties.DirectlyInAnyApex = inApex == directlyInApex
 
-	if platformVariation && !ctx.Host() && !module.AvailableFor(AvailableToPlatform) {
+	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