Simplify arch target handling

Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: I92f2e2dac53617d595a35cc285d2bd348baa0fbd
diff --git a/android/config.go b/android/config.go
index ee95d2e..5024bce 100644
--- a/android/config.go
+++ b/android/config.go
@@ -54,8 +54,8 @@
 	ConfigFileName           string
 	ProductVariablesFileName string
 
-	DeviceArches []Arch
-	HostArches   map[HostType][]Arch
+	Targets        map[OsClass][]Target
+	BuildOsVariant string
 
 	srcDir   string // the path of the root source directory
 	buildDir string // the path of the build output directory
@@ -175,20 +175,21 @@
 		config.inMake = true
 	}
 
-	hostArches, deviceArches, err := decodeArchProductVariables(config.ProductVariables)
+	targets, err := decodeTargetProductVariables(config)
 	if err != nil {
 		return Config{}, err
 	}
 
 	if Bool(config.Mega_device) {
-		deviceArches, err = decodeMegaDevice()
+		deviceTargets, err := decodeMegaDevice()
 		if err != nil {
 			return Config{}, err
 		}
+		targets[Device] = deviceTargets
 	}
 
-	config.HostArches = hostArches
-	config.DeviceArches = deviceArches
+	config.Targets = targets
+	config.BuildOsVariant = targets[Host][0].String()
 
 	return config, nil
 }
@@ -325,3 +326,13 @@
 	}
 	return *c.ProductVariables.SanitizeDevice
 }
+
+func (c *config) Android64() bool {
+	for _, t := range c.Targets[Device] {
+		if t.Arch.ArchType.Multilib == "lib64" {
+			return true
+		}
+	}
+
+	return false
+}