Copying the 2nd-to-last API into a convenient place to pass to Metalava

so we can temporarily ask Metalava to use API 28 as a baseline for
downgrading @Nullable/@NonNull to @RecentlyNullable/@RecentlyNonNull .

This should provide more time to migrate calling code.

This is mostly a combination of

  aosp/699347 - Add genrule to find API file Metalava used to generate annotations

and

  aosp/880079 - 123197896: The last-released API file is the wrong one

Test: m api-stubs-docs # and unzip out/target/common/docs/api-stubs-docs-stubs.srcjar \
      and notice that @Nullable/@NonNull are replaced by @RecentlyNullable/@RecentlyNonNull

Bug: 140127380
Change-Id: I96b4196292d878892c8cca5aade2ed4034939f4c
diff --git a/Android.bp b/Android.bp
index 614307a..7ef0904 100644
--- a/Android.bp
+++ b/Android.bp
@@ -71,6 +71,17 @@
     ],
 }
 
+genrule {
+    name: "last-released-public-api-for-metalava-annotations",
+    srcs: [
+        "*/public/api/android.txt",
+    ],
+    cmd: "cp -f $$(echo $(in) | tr \" \" \"\\n\" | sort -t/ -k3 -n | tail -2 | head -1) $(genDir)/last-released-api-for-metalava-annotations.txt",
+    out: [
+        "last-released-api-for-metalava-annotations.txt",
+    ],
+}
+
 prebuilt_apis {
     name: "sdk",
     api_dirs: [