Limit framework module api packages

Use the same whitelist of packages that the non-updatable
part of the platform uses for now. This avoids exposing some
internal classes in a follow-up CL.

Move telephony off the module-wide defaults for now, as the
telephony stubs are causing problems.

Bug: 149293194
Test: m checkapi
Change-Id: Iedc8c309cef8290ac14e1ad32b5b66656145f557
diff --git a/Android.bp b/Android.bp
index 6653bd4..be1aefc 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1275,7 +1275,22 @@
             removed_api_file: "telephony/api/system-removed.txt",
         },
     },
-    defaults: ["framework-module-stubs-defaults-systemapi"],
+    // TODO: make telephony inherit the shared stubs and remove this
+    args: "--show-annotation android.annotation.SystemApi\\(" +
+            "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
+        "\\) " +
+        "--error UnhiddenSystemApi " +
+        "--hide BroadcastBehavior " +
+        "--hide DeprecationMismatch " +
+        "--hide HiddenSuperclass " +
+        "--hide HiddenTypedefConstant " +
+        "--hide HiddenTypeParameter " +
+        "--hide MissingPermission " +
+        "--hide RequiresPermission " +
+        "--hide SdkConstant " +
+        "--hide Todo " +
+        "--hide Typo " +
+        "--hide UnavailableSymbol ",
     filter_packages: ["android.telephony"],
     sdk_version: "system_current",
 }
diff --git a/apex/Android.bp b/apex/Android.bp
index e8f6e6b..bfe355d 100644
--- a/apex/Android.bp
+++ b/apex/Android.bp
@@ -26,6 +26,20 @@
     "--hide Typo " +
     "--hide UnavailableSymbol "
 
+// TODO: modularize this so not every module has the same whitelist
+framework_packages_to_document = [
+    "android",
+    "dalvik",
+    "java",
+    "javax",
+    "junit",
+    "org.apache.http",
+    "org.json",
+    "org.w3c.dom",
+    "org.xml.sax",
+    "org.xmlpull",
+]
+
 // TODO: remove the hiding when server classes are cleaned up.
 mainline_framework_stubs_args =
     mainline_stubs_args +
@@ -54,6 +68,7 @@
     args: mainline_framework_stubs_args,
     installable: false,
     sdk_version: "current",
+    filter_packages: framework_packages_to_document,
     check_api: {
         current: {
             api_file: "api/current.txt",
@@ -72,6 +87,7 @@
     libs: ["framework-annotations-lib"],
     installable: false,
     sdk_version: "system_current",
+    filter_packages: framework_packages_to_document,
     check_api: {
         current: {
             api_file: "api/system-current.txt",
@@ -113,6 +129,7 @@
     libs: ["framework-annotations-lib"],
     installable: false,
     sdk_version: "module_current",
+    filter_packages: framework_packages_to_document,
     check_api: {
         current: {
             api_file: "api/module-lib-current.txt",
@@ -131,6 +148,7 @@
     libs: ["framework-annotations-lib"],
     installable: false,
     sdk_version: "module_current",
+    filter_packages: framework_packages_to_document,
 }
 
 stubs_defaults {