Add a net-utils-telephony-common library for NetworkFactory.

A separate target is necessary for telephony as it needs to jarjar
included classes.

Test: atest FrameworksNetTests FrameworksWifiTests \
          FrameworksTelephonyTests
Bug: 138306002
Change-Id: I4b7f79fc43fe5820c94226662bee0216b61fc599
Merged-In: I4b7f79fc43fe5820c94226662bee0216b61fc599
(clean cherry-pick from internal branch)
diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp
index 5c851fd..713a0d6 100644
--- a/staticlibs/Android.bp
+++ b/staticlibs/Android.bp
@@ -17,6 +17,11 @@
 //    library directly.
 // 2. The "net-utils-services-common" library is for use by modules and frameworks/base/services.
 //    It does not need to be jarjared because it is not placed on the bootclasspath.
+// 3. The "net-utils-telephony-common-srcs" filegroup is for use specifically by telephony, which
+//    places many of its classes, even non-API service classes, on the boot classpath. Any file that
+//    is added to this filegroup *must* have a corresponding jarjar rule in the telephony jarjar
+//    rules file. Otherwise, it will end up on the boot classpath and other modules will not be able
+//    to provide their own copy.
 
 filegroup {
     name: "net-utils-framework-common-srcs",
@@ -26,7 +31,7 @@
 
 java_library {
     name: "net-utils-framework-common",
-    srcs: [":net-utils-framework-common-srcs" ],
+    srcs: [":net-utils-framework-common-srcs"],
     jarjar_rules: "jarjar-rules-shared.txt",
     visibility: [
         "//frameworks/base/packages/Tethering",
@@ -50,3 +55,16 @@
         "//packages/modules/CaptivePortalLogin",
     ],
 }
+
+// Use a filegroup and not a library for telephony sources, as framework-annotations cannot be
+// included either (some annotations would be duplicated on the bootclasspath).
+filegroup {
+    name: "net-utils-telephony-common-srcs",
+    srcs: [
+        // Any class here *must* have a corresponding jarjar rule in the telephony build rules.
+        "src_servicescommon/android/net/NetworkFactory.java",
+    ],
+    visibility: [
+        "//frameworks/opt/telephony",
+    ],
+}