Add support for android_test modules

android_test module are APKs that can be run as tests, either
as standalone unit tests or as instrumentation tests for another
APK.

Test: m checkbuild
Change-Id: I16661701637e4048fd99442029c3e195ebf373a4
diff --git a/java/androidmk.go b/java/androidmk.go
index 88dc6ef..bc9544a 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -228,6 +228,19 @@
 	}
 }
 
+func (a *AndroidTest) AndroidMk() android.AndroidMkData {
+	data := a.AndroidApp.AndroidMk()
+	data.Extra = append(data.Extra, func(w io.Writer, outputFile android.Path) {
+		fmt.Fprintln(w, "LOCAL_MODULE_TAGS := tests")
+		if len(a.testProperties.Test_suites) > 0 {
+			fmt.Fprintln(w, "LOCAL_COMPATIBILITY_SUITE :=",
+				strings.Join(a.testProperties.Test_suites, " "))
+		}
+	})
+
+	return data
+}
+
 func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
 	data := a.Library.AndroidMk()