Add non-updatable-api tracking

This adds stub generation for the non-updatable part of the platform.

This is a partial cherry pick of
I255486112c03f237aa342cfb93f3b473a2f50470

Test: m (checkapi)
Merged-In: I255486112c03f237aa342cfb93f3b473a2f50470
Change-Id: I914c416e171253dacfa3c6d44ae4ef1ea6530a46
diff --git a/StubLibraries.bp b/StubLibraries.bp
index 5c5dae6..bb13eaa 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -129,6 +129,19 @@
     jdiff_enabled: true,
 }
 
+droidstubs {
+    name: "api-stubs-docs-non-updatable",
+    defaults: ["metalava-non-updatable-api-stubs-default"],
+    arg_files: ["core/res/AndroidManifest.xml"],
+    args: metalava_framework_docs_args,
+    check_api: {
+        current: {
+            api_file: "non-updatable-api/current.txt",
+            removed_api_file: "non-updatable-api/removed.txt",
+        },
+    },
+}
+
 priv_apps = " " +
     "--show-annotation android.annotation.SystemApi\\(" +
         "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
@@ -172,6 +185,19 @@
 }
 
 droidstubs {
+    name: "system-api-stubs-docs-non-updatable",
+    defaults: ["metalava-non-updatable-api-stubs-default"],
+    arg_files: ["core/res/AndroidManifest.xml"],
+    args: metalava_framework_docs_args + priv_apps,
+    check_api: {
+        current: {
+            api_file: "non-updatable-api/system-current.txt",
+            removed_api_file: "non-updatable-api/system-removed.txt",
+        },
+    },
+}
+
+droidstubs {
     name: "test-api-stubs-docs",
     defaults: ["metalava-full-api-stubs-default"],
     arg_files: [
@@ -238,6 +264,18 @@
     },
 }
 
+droidstubs {
+    name: "module-lib-api-stubs-docs-non-updatable",
+    defaults: ["metalava-non-updatable-api-stubs-default"],
+    arg_files: ["core/res/AndroidManifest.xml"],
+    args: metalava_framework_docs_args + module_libs,
+    check_api: {
+        current: {
+            api_file: "non-updatable-api/module-lib-current.txt",
+            removed_api_file: "non-updatable-api/module-lib-removed.txt",
+        },
+    },
+}
 
 // The following droidstub module generates source files for the API stub library for
 // modules. Note that it not only includes its own APIs but also other APIs that have
@@ -300,6 +338,20 @@
     libs: ["sdk_system_29_android"],
 }
 
+java_library_static {
+    name: "android_non_updatable_stubs_current",
+    srcs: [":api-stubs-docs-non-updatable"],
+    defaults: ["android_defaults_stubs_current"],
+    libs: ["sdk_system_29_android"],
+}
+
+java_library_static {
+    name: "android_system_non_updatable_stubs_current",
+    srcs: [":system-api-stubs-docs-non-updatable"],
+    defaults: ["android_defaults_stubs_current"],
+    libs: ["sdk_system_29_android"],
+}
+
 /////////////////////////////////////////////////////////////////////
 // hwbinder.stubs provides APIs required for building HIDL Java
 // libraries.