Restrict default visibility for module libs

Prevents new modules in this repo from being visible by default.
Existing modules are all meant to be generally usable, so can be public.

Test: m nothing
Change-Id: Ibaa6991ce3f5ea8a1b20df1f46a47a463f25e655
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..97f99c0
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,18 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Limit visibility of all modules in this repo by default.
+package {
+    default_visibility: [":__subpackages__"],
+}
diff --git a/build/Android.bp b/build/Android.bp
index 7ab169c..13b792a 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -14,14 +14,12 @@
 // limitations under the License.
 //
 
-// For use by modules.
 java_library {
     name: "modules-utils-build",
-    srcs: [
-        "src/**/*.java",
-    ],
+    srcs: ["src/**/*.java"],
     sdk_version: "module_current",
     min_sdk_version: "29",
+    visibility: ["//visibility:public"],
     apex_available: ["//apex_available:anyapex"],
 }
 
@@ -30,5 +28,6 @@
     min_sdk_version: "29",
     export_include_dirs: ["include"],
     static_libs: ["libbase"],
+    visibility: ["//visibility:public"],
     apex_available: ["//apex_available:anyapex"],
 }
diff --git a/os/Android.bp b/os/Android.bp
index 5c4fc31..dc5196b 100644
--- a/os/Android.bp
+++ b/os/Android.bp
@@ -15,15 +15,15 @@
 
 java_library {
     name: "modules-utils-os",
-
     srcs: [
         "java/**/*.aidl",
         "java/**/*.java",
     ],
     sdk_version: "module_current",
     min_sdk_version: "30",
+    visibility: ["//visibility:public"],
     apex_available: [
         "//apex_available:anyapex",
         "//apex_available:platform",
     ],
-}
\ No newline at end of file
+}