Skip creating variants for disabled OSes

The documentation java_genrule_host states that it creates a single
variant, which would make it work with the single variant fallback
in AddDependency used by the data property, but it actually has a host
and a host-cross windows variant.  Modify osMutator to take the
OS-specific enabled properties into account to skip creating variants
that will immediately be disabled so there is a single variant.

Test: m checkbuild
Change-Id: Ic2daab29f4fa3a3797d7a08348fbfcf1036ec5dc
diff --git a/android/arch.go b/android/arch.go
index afb9c7f..a5d416c 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -757,7 +757,7 @@
 
 	for _, os := range OsTypeList {
 		for _, t := range mctx.Config().Targets[os] {
-			if base.supportsTarget(t) {
+			if base.supportsTarget(t) && base.osEnabled(os) {
 				moduleOSList = append(moduleOSList, os)
 				break
 			}
@@ -1183,6 +1183,16 @@
 		}
 		base.archProperties = append(base.archProperties, archProperties)
 		m.AddProperties(archProperties...)
+
+		// Special case the enabled property so the osMutator can skip creating variants that
+		// are disabled.
+		if properties == &base.enabledProperties {
+			if len(archProperties) != 1 {
+				panic(fmt.Errorf("expected a single arch-specific enabledProperties type, found %d",
+					len(archProperties)))
+			}
+			base.archEnabledProperties = archProperties[0].(*archPropRoot)
+		}
 	}
 
 	base.customizableProperties = m.GetProperties()