Add java_genrule to replace handcrafted api fingerprint generation

Test: m and TH

Bug: 268337234
Change-Id: Ib58f736ce43d877d0c08cdd9b154e93a1766105b
diff --git a/api/Android.bp b/api/Android.bp
index 6e82f1c..73dbd28 100644
--- a/api/Android.bp
+++ b/api/Android.bp
@@ -263,3 +263,15 @@
     out: ["combined-removed-dex.txt"],
     cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)",
 }
+
+java_genrule {
+    name: "api_fingerprint",
+    srcs: [
+        ":frameworks-base-api-current.txt",
+        ":frameworks-base-api-system-current.txt",
+        ":frameworks-base-api-module-lib-current.txt",
+        ":frameworks-base-api-system-server-current.txt",
+    ],
+    out: ["api_fingerprint.txt"],
+    cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)",
+}