Dedupe build rules for non-updatable sdk libs

Reuse the defaults in packages/modules/common that are for
non-updatable (to be updatable), but extend them to be suitable for
modules that have no intention of becoming updatable.

Baseline issues that were not enabled previously.

Bug: 306806877
Test: presubmit
Merged-In: I5b596821ce9c20d2504728bf01f4fdd69da9a94e
Change-Id: I5b596821ce9c20d2504728bf01f4fdd69da9a94e
diff --git a/Android.bp b/Android.bp
index 9c2b471..ed56fd8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -735,90 +735,36 @@
 // non_updatable_modules list in frameworks/base/api/api.go
 java_defaults {
     name: "framework-non-updatable-unbundled-defaults",
-    defaults: ["framework-non-updatable-lint-defaults"],
-
-    sdk_version: "core_platform",
-
-    // Api scope settings
+    defaults: [
+        "framework-non-updatable-lint-defaults",
+        "non-updatable-framework-module-defaults",
+    ],
     public: {
-        enabled: true,
-        sdk_version: "module_current",
         libs: ["android_module_lib_stubs_current"],
     },
     system: {
-        enabled: true,
-        sdk_version: "module_current",
         libs: ["android_module_lib_stubs_current"],
     },
     module_lib: {
-        enabled: true,
-        sdk_version: "module_current",
         libs: ["android_module_lib_stubs_current"],
     },
     test: {
-        enabled: true,
-        sdk_version: "test_frameworks_core_current",
         libs: ["android_test_frameworks_core_stubs_current"],
     },
-
-    stub_only_libs: [
-        "framework-protos",
-    ],
-    impl_only_libs: [
-        "framework-minus-apex-headers", // full access to framework-minus-apex including hidden API
-        "framework-annotations-lib",
-    ],
-    visibility: ["//visibility:public"],
-    stubs_library_visibility: ["//visibility:public"],
-    stubs_source_visibility: ["//visibility:private"],
-    impl_library_visibility: [
-        ":__pkg__",
-        "//frameworks/base",
-        "//frameworks/base/api", // For framework-all
-    ],
-    defaults_visibility: [
-        "//frameworks/base/location",
-    ],
-    plugins: [
-        "error_prone_android_framework",
-    ],
+    sdk_version: "core_platform",
+    stub_only_libs: ["framework-protos"],
+    impl_only_libs: ["framework-minus-apex-headers"], // the framework, including hidden API
+    impl_library_visibility: ["//frameworks/base"],
+    defaults_visibility: ["//frameworks/base/location"],
+    plugins: ["error_prone_android_framework"],
     errorprone: {
         javacflags: [
             "-Xep:AndroidFrameworkCompatChange:ERROR",
             "-Xep:AndroidFrameworkUid:ERROR",
         ],
     },
-
     // Include manual annotations in API txt files
     merge_annotations_dirs: ["metalava-manual"],
-
-    // Use the source of annotations that affect metalava doc generation, since
-    // the relevant generation instructions are themselves in javadoc, which is
-    // not present in class files.
-    api_srcs: [":framework-metalava-annotations"],
-
-    // Framework modules are not generally shared libraries, i.e. they are not
-    // intended, and must not be allowed, to be used in a <uses-library> manifest
-    // entry.
-    shared_library: false,
-
-    // Prevent dependencies that do not specify an sdk_version from accessing the
-    // implementation library by default and force them to use stubs instead.
-    default_to_stubs: true,
-
-    // Subdirectory for the artifacts that are copied to the dist directory
-    dist_group: "android",
-
-    droiddoc_options: [
-        "--error UnhiddenSystemApi " +
-            "--hide CallbackInterface " +
-            "--hide HiddenTypedefConstant " +
-            "--hide RequiresPermission " +
-            "--enhance-documentation " +
-            "--hide-package com.android.server ",
-    ],
-
-    annotations_enabled: true,
 }
 
 build = [