Switch ART public stubs generation to use java_sdk_library

The NullFromTypeParam class needed to be marked @hide to prevent it
being used to annotate type parameters in api/public/current.txt. The
reason why that is necessary for this but not for
frameworks/base/api/current.txt is because they are generated slightly
differently.

The api/public/current.txt file is generated directly from the source
which contains @NullFromTypeParam usages.

The frameworks/base/api/current.txt file is generated from stubs which
do not contain @NullFromTypeParam usages.

Bug: 168301990
Test: Built offline-sdk-docs with and without the change and
      diffed them. There were some changes other than the timestamp.js
      file. With these changes classes that implemented the
      Object.equals(Object) method had some extra documentation that
      explained that the parameter could be null. The reason for this
      change is that the stubs generated with this change includes
      android.annotation.Nullable whereas previously they included
      androidx.annotation.Nullable. The change is a very minor
      improvement over what is currently uploaded to
      developer.android.com/reference so not worth backporting.
      Diffed api/public/current.txt against
      frameworks/base/api/current.txt and made sure that the latter was
      a superset of the former and there were no differences in the area
      that overlapped.
Change-Id: I1bebc40e4de78eccf92b055ee24beff76511a25a
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index d111b51..3d36425 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -782,7 +782,7 @@
     system_modules: "none",
 }
 
-// A special set of system modules needed to build art.module.public.api.stubs
+// A special set of system modules needed to build art.module.public.api
 // that contain nullability annotations when targeting java language level 1.9
 // and above.
 java_system_modules {
@@ -811,12 +811,9 @@
     // replacement (with $1, $2 backreferences to the regex groups)
     "'$$1https://docs.oracle.com/javase/8/docs/$$2\">' "
 
-// Generates stubs for the parts of the public SDK API provided by the ART module.
-//
-// Only for use by art.module.public.api.stubs target below and the building of the
-// public API.
-droidstubs {
-    name: "art-module-public-api-stubs-source",
+// Define the public SDK API provided by the ART module.
+java_sdk_library {
+    name: "art.module.public.api",
     visibility: [
         "//frameworks/base",
     ],
@@ -824,10 +821,6 @@
         ":core_oj_api_files",
         ":core_libart_api_files",
     ],
-    java_version: "1.9",
-    installable: false,
-    sdk_version: "none",
-    system_modules: "java-current-stubs-system-modules",
     libs: [
         // Provide access to I18N constants that are used to initialize
         // constants in the public API. i.e. to allow the value of the
@@ -835,23 +828,25 @@
         // android.icu.text.CollationElementIterator.NULLORDER.
         "i18n.module.intra.core.api.stubs",
     ],
+    java_version: "1.9",
 
-    args: rewrite_openjdk_doc_args,
+    public: {
+        enabled: true,
+    },
 
-    create_doc_stubs: true,
+    api_only: true,
+    droiddoc_options: [
+        rewrite_openjdk_doc_args,
+    ],
 
     // Emit nullability annotations from the source to the stub files.
     annotations_enabled: true,
 
     merge_annotations_dirs: [
+        "metalava-manual",
         "ojluni-annotated-sdk-stubs",
     ],
-}
 
-// A stubs target containing the parts of the public SDK API provided by the ART module.
-java_library {
-    name: "art.module.public.api.stubs",
-    srcs: [":art-module-public-api-stubs-source"],
     errorprone: {
         javacflags: [
             "-Xep:MissingOverride:OFF",