Add a NetworkStackCoverageTests target.

This target will include all tests that are necessary to calculate
code coverage of the network stack. It is currently the union of
NetworkStackTests and NetworkStackIntegrationTests

Also apply jarjar rules on top of NetworkStackIntegrationTests and
NetworkStackTests, to make sure that the test classes (and not the
framework classes) are used during the test. This requires the tests to
stop using external (hidden) references to classes in
com.android.internal, as the references would be broken when applying
jarjar.

Test: atest NetworkStackIntegrationTests NetworkStackTests \
          NetworkStackCoverageTests
Change-Id: Ib945cb9faa960862593a6ac2ac26058948e777a4
diff --git a/Android.bp b/Android.bp
index 13eec44..0a8b263 100644
--- a/Android.bp
+++ b/Android.bp
@@ -133,6 +133,15 @@
     manifest: "AndroidManifestBase.xml",
 }
 
+filegroup {
+    name: "NetworkStackJarJarRules",
+    srcs: ["jarjar-rules-shared.txt"],
+    visibility: [
+        "//packages/modules/NetworkStack/tests/unit",
+        "//packages/modules/NetworkStack/tests/integration",
+    ]
+}
+
 // Common defaults for compiling the actual APK, based on the NetworkStackApiXBase android libraries
 java_defaults {
     name: "NetworkStackAppDefaults",
@@ -143,7 +152,7 @@
     ],
     // Resources already included in NetworkStackBase
     resource_dirs: [],
-    jarjar_rules: "jarjar-rules-shared.txt",
+    jarjar_rules: ":NetworkStackJarJarRules",
     use_embedded_native_libs: true,
     optimize: {
         proguard_flags_files: ["proguard.flags"],
@@ -193,6 +202,7 @@
     defaults: ["NetworkStackAppDefaults", "NetworkStackReleaseApiLevel"],
     static_libs: ["NetworkStackApiStableLib"],
     manifest: "AndroidManifestBase.xml",
+    visibility: ["//frameworks/base/tests/net/integration"],
 }
 
 cc_library_shared {