Remove unnecessary usages of core-all and restrict its visibility

The core-all library is not required for generating the
core-intra-stubs or for compiling them so this change removes the
reference to them from the build modules and also switches
core.intra.stubs from system_modules: "core-all-system-modules" to
system_modules: "none".

All other accesses to core-all is done via the core-all-system-modules
which means that core-all can use the package default visibility of
private. The core_all_visibility variable (along with its comment) was
inlined into the only module that references it.

Test: m checkbuild
Change-Id: I4703239567acf34354dae8b11b001d49b6672b66
diff --git a/JavaLibrary.bp b/JavaLibrary.bp
index 3dc4363..dc31d85 100644
--- a/JavaLibrary.bp
+++ b/JavaLibrary.bp
@@ -169,24 +169,11 @@
 // Build for the target (device).
 //
 
-// Visibility of core-all* build modules; we restrict visibility of core-all deliberately to
-// a small set of build modules that the core library team control. See core-all-system-modules
-// for more details.
-core_all_visibility = [
-    "//external/apache-harmony:__subpackages__",
-    "//external/apache-xml",
-    "//external/bouncycastle",
-    "//external/conscrypt",
-    "//external/icu/android_icu4j",
-    "//external/okhttp",
-    "//libcore:__subpackages__",
-]
-
 // A target used to bootstrap compilation for the core library.
+//
 // See core-all-system-modules for more details.
 java_library {
     name: "core-all",
-    visibility: core_all_visibility,
     defaults: ["libcore_java_defaults"],
 
     srcs: [
@@ -227,7 +214,19 @@
 // bouncycastle, etc.
 java_system_modules {
     name: "core-all-system-modules",
-    visibility: core_all_visibility,
+
+    // Visibility is deliberately restricted to a small set of build modules that
+    // the core library team control.
+    visibility: [
+        "//external/apache-harmony:__subpackages__",
+        "//external/apache-xml",
+        "//external/bouncycastle",
+        "//external/conscrypt",
+        "//external/icu/android_icu4j",
+        "//external/okhttp",
+        "//libcore:__subpackages__",
+    ],
+
     libs: ["core-all"],
 }
 
diff --git a/mmodules/intracoreapi/Android.bp b/mmodules/intracoreapi/Android.bp
index cb40d94..3b295d9 100644
--- a/mmodules/intracoreapi/Android.bp
+++ b/mmodules/intracoreapi/Android.bp
@@ -22,7 +22,6 @@
     name: "core-intra-stubs",
     srcs: [":core_api_files"],
     sdk_version: "none",
-    libs: ["core-all"],
 
     installable: false,
     args: "--hide-annotation libcore.api.Hide " +
@@ -52,8 +51,7 @@
     srcs: [":core-intra-stubs"],
 
     sdk_version: "none",
-    libs: ["core-all"],
-    system_modules: "core-all-system-modules",
+    system_modules: "none",
     openjdk9: {
         javacflags: ["--patch-module=java.base=."],
     },