Use Targets[Android] instead of DeviceArch funcs.

NDK prebuit script doesn't set device arch product variables, and so
causes SupportedAbis to panic.

Fixes: 158673325
Test: app_test.go, apex_test.go
Test: build-ndk-prebuilts.sh
Change-Id: I8331ef5bca12301318510ec9712770fd8d3a26a9
diff --git a/java/app.go b/java/app.go
index 9f02441..ba05657 100755
--- a/java/app.go
+++ b/java/app.go
@@ -112,17 +112,17 @@
 }
 
 func SupportedAbis(ctx android.ModuleContext) []string {
-	abiName := func(archVar string, deviceArch string) string {
+	abiName := func(targetIdx int, deviceArch string) string {
 		if abi, found := TargetCpuAbi[deviceArch]; found {
 			return abi
 		}
-		ctx.ModuleErrorf("Invalid %s: %s", archVar, deviceArch)
+		ctx.ModuleErrorf("Target %d has invalid Arch: %s", targetIdx, deviceArch)
 		return "BAD_ABI"
 	}
 
-	result := []string{abiName("TARGET_ARCH", ctx.DeviceConfig().DeviceArch())}
-	if s := ctx.DeviceConfig().DeviceSecondaryArch(); s != "" {
-		result = append(result, abiName("TARGET_2ND_ARCH", s))
+	var result []string
+	for i, target := range ctx.Config().Targets[android.Android] {
+		result = append(result, abiName(i, target.Arch.ArchType.String()))
 	}
 	return result
 }