Add support for -apiMapping parameter in DocLava.

This is used to output a mapping of class member signature to source
position, which in turn is used for automated addition of annotations in
frameworks code.

Metalava support does not exist (yet), and may not be needed, since the
addition of these annotations in a one-time thing. This change can be
reverted once this is complete.

See go/hidden-api-annotations for more context.

Test: m
Bug: 110868826
Change-Id: I90e409f6ea02b16eb9e03d92382f9bb46a8fdab5
diff --git a/java/droiddoc.go b/java/droiddoc.go
index dbceed8..6cb8d3c 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -226,6 +226,10 @@
 	// the generated removed Dex API filename by Doclava.
 	Removed_dex_api_filename *string
 
+	// mapping of dex signatures to source file and line number. This is a temporary property and
+	// will be deleted; you probably shouldn't be using it.
+	Dex_mapping_filename *string
+
 	// the generated exact API filename by Doclava.
 	Exact_api_filename *string
 
@@ -283,6 +287,7 @@
 	removedApiFile    android.WritablePath
 	removedDexApiFile android.WritablePath
 	exactApiFile      android.WritablePath
+	apiMappingFile    android.WritablePath
 
 	checkCurrentApiTimestamp      android.WritablePath
 	updateCurrentApiTimestamp     android.WritablePath
@@ -831,6 +836,13 @@
 		implicitOutputs = append(implicitOutputs, d.exactApiFile)
 	}
 
+	if String(d.properties.Dex_mapping_filename) != "" {
+		d.apiMappingFile = android.PathForModuleOut(ctx, String(d.properties.Dex_mapping_filename))
+		args = args + " -apiMapping " + d.apiMappingFile.String()
+		// Omitted: metalava support
+		implicitOutputs = append(implicitOutputs, d.apiMappingFile)
+	}
+
 	implicits = append(implicits, d.Javadoc.srcJars...)
 
 	implicitOutputs = append(implicitOutputs, d.Javadoc.docZip)