Convert api.xml dist rules to Soong

...from make to support dist'ing *-api.xml files in soong-only builds.

Test: m droid dist --soong-only && ls out/dist/api.xml
Bug: 395162087
Bug: 394365683
Change-Id: I98e92423a107d24b04e6f6f0f96c23c24de01fa5
diff --git a/java/androidmk.go b/java/androidmk.go
index 4305360..c9de7e6 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -120,6 +120,14 @@
 					}
 				},
 			},
+			ExtraFooters: []android.AndroidMkExtraFootersFunc{
+				func(w io.Writer, name, prefix, moduleDir string) {
+					if library.apiXmlFile != nil {
+						fmt.Fprintf(w, "$(call declare-1p-target,%s,)\n", library.apiXmlFile.String())
+						fmt.Fprintf(w, "$(eval $(call copy-one-file,%s,$(TARGET_OUT_COMMON_INTERMEDIATES)/%s))\n", library.apiXmlFile.String(), library.apiXmlFile.Base())
+					}
+				},
+			},
 		})
 	}