Stop frameworks/base from accessing annotation source files

Adds an art.module.api.annotations that frameworks/base can use
instead of the unsupportedappusage_annotation_files filegroup.

Also, does some internal cleanup.
* Moves the definition of the filegroup(s) into
  non_openjdk_java_files.bp alongside the rest.
* Stops duplicating paths to the various files.
* Renames the internal target to make it clearer what it contains.

Bug: 142113521
Test: m java
Change-Id: I059652d4bb3085da0b975fa8cbd05dd16e16654f
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 7425695..ccee7b1 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -790,7 +790,7 @@
         // Ensure that core libraries that depend on the public API can access
         // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
         // annotations.
-        "libcore-unsupportedappusage-annotation",
+        "art.module.api.annotations.for.system.modules",
     ],
 }
 
@@ -882,12 +882,15 @@
     ],
 }
 
-// A library that contains annotations not retented in runtime and inline-able constants
-// that should not introduce any runtime dependency for compiling core libraries, e.g. core-icu4j,
+// A library that contains annotations that define API surfaces (core
+// platform, intra core and the hidden API) along with some supporting
+// constants. The annotations are source only and do not introduce any runtime
+// dependencies. Specially built for use in system modules definitions to
+// avoid introducing compile time cycles.
 java_library {
-    name: "libcore-unsupportedappusage-annotation",
+    name: "art.module.api.annotations.for.system.modules",
     srcs: [
-        ":unsupportedappusage_annotation_files",
+        ":api_surface_annotation_files",
     ],
 
     installable: false,
@@ -896,16 +899,16 @@
     patch_module: "java.base",
 }
 
-// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
-filegroup {
-    name: "unsupportedappusage_annotation_files",
+// Create a library containing the api surface annotations, built against
+// core_current for use by the annotation processor in frameworks/base.
+java_library {
+    name: "art.module.api.annotations",
     visibility: [
         "//frameworks/base",
     ],
+    host_supported: true,
     srcs: [
-        "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
-        "dalvik/src/main/java/dalvik/system/VersionCodes.java",
-        "luni/src/main/java/libcore/api/CorePlatformApi.java",
-        "luni/src/main/java/libcore/api/IntraCoreApi.java",
+        ":api_surface_annotation_files",
     ],
+    sdk_version: "core_current",
 }