Move i18n module intra core API from libcore

Bug: 141935400
Bug: 141683101
Test: m checkbuild && m update-api
Change-Id: I539cd90b7fa5269f3ec42fc5a8447429f012e92e
diff --git a/android_icu4j/Android.bp b/android_icu4j/Android.bp
index 0589a10..9fb0863 100644
--- a/android_icu4j/Android.bp
+++ b/android_icu4j/Android.bp
@@ -76,7 +76,7 @@
 
     // We use art-module-public-api-stubs-system-modules when compiling core-icu4j as ICU4J does not
     // use any internal or android specific code. If it ever did then it could depend on
-    // core-intra-stubs-system-modules (a superset) instead.
+    // art-module-intra-core-api-stubs-system-modules (a superset) instead.
     // It is important that core-icu4j is restricted to only use stable APIs from the ART module
     // since it is in a different APEX module that can be updated independently.
     sdk_version: "none",
@@ -141,6 +141,65 @@
     system_modules: "art-module-public-api-stubs-system-modules",
 }
 
+// Generates stub source files for the intra-core API of the I18N module.
+// i.e. every class/member that is either in the public API or annotated with
+// @IntraCoreApi.
+//
+// The API specification .txt files managed by this only contain the additional
+// classes/members that are in the intra-core API but which are not the public
+// API.
+droidstubs {
+    name: "i18n-module-intra-core-api-stubs-source",
+    visibility: [
+        // Needed to build core-all as using the compiled library, i.e.
+        // i18n.module.intra.core.api.stubs does not work due to limitations
+        // in javac.
+        "//libcore:__subpackages__",
+    ],
+    srcs: [
+        ":android_icu4j_src_files",
+    ],
+    sdk_version: "none",
+    libs: [
+        "art.module.intra.core.api.stubs",
+    ],
+
+    installable: false,
+    args: "--hide-annotation libcore.api.Hide " +
+        "--show-single-annotation libcore.api.IntraCoreApi " +
+        "--skip-annotation-instance-methods=false ",
+
+    api_filename: "api.txt",
+    removed_api_filename: "removed.txt",
+    previous_api: "previous.txt",
+    check_api: {
+        current: {
+            api_file: "api/intra/current-api.txt",
+            removed_api_file: "api/intra/current-removed.txt",
+        },
+        last_released: {
+            api_file: "api/intra/last-api.txt",
+            removed_api_file: "api/intra/last-removed.txt",
+        },
+    },
+}
+
+// A library containing the intra-core API stubs of the I18N module.
+//
+// Intra-core APIs are only intended for the use of other core library modules.
+java_library {
+    name: "i18n.module.intra.core.api.stubs",
+    visibility: [
+        "//libcore:__subpackages__",
+    ],
+    srcs: [
+        ":i18n-module-intra-core-api-stubs-source",
+    ],
+
+    sdk_version: "none",
+    system_modules: "art-module-intra-core-api-stubs-system-modules",
+}
+
 //==========================================================
 // build repackaged ICU tests
 //