Make FlaggedAPI available to CtsThreadNetworkTestCases

FlaggedAPI will be ignored in udc-mainline-prod.
This makes CtsThreadNetworkTestCases build fail.
This CL updates CtsThreadNetworkTestCases to build against FlaggedAPI
and also updates framework-connectivity-jarjar-rules not to jarjar
FlaggedAPI.

Test: TH
Test: m CtsThreadNetworkTestCases
Change-Id: Ida8872b3bf61b7a59733f5fcec9e7d250efd3e58
diff --git a/framework/Android.bp b/framework/Android.bp
index 103083f..8c0bdf4 100644
--- a/framework/Android.bp
+++ b/framework/Android.bp
@@ -266,6 +266,7 @@
         ":framework-connectivity-t-pre-jarjar{.jar}",
         ":framework-connectivity.stubs.module_lib{.jar}",
         ":framework-connectivity-t.stubs.module_lib{.jar}",
+        ":framework-connectivity-flagged-apis{.jar}",
         "jarjar-excludes.txt",
     ],
     tools: [
@@ -278,6 +279,7 @@
         "--prefix android.net.connectivity " +
         "--apistubs $(location :framework-connectivity.stubs.module_lib{.jar}) " +
         "--apistubs $(location :framework-connectivity-t.stubs.module_lib{.jar}) " +
+        "--apistubs $(location :framework-connectivity-flagged-apis{.jar}) " +
         // Make a ":"-separated list. There will be an extra ":" but empty items are ignored.
         "--unsupportedapi $$(printf ':%s' $(locations :connectivity-hiddenapi-files)) " +
         "--excludes $(location jarjar-excludes.txt) " +
@@ -289,6 +291,30 @@
     ],
 }
 
+droidstubs {
+    name: "framework-connectivity-flagged-apis-droidstubs",
+    srcs: [
+        ":framework-connectivity-sources",
+        ":framework-connectivity-tiramisu-updatable-sources",
+        ":framework-nearby-java-sources",
+        ":framework-thread-sources",
+    ],
+    flags: [
+        "--show-annotation android.annotation.FlaggedApi",
+    ],
+    aidl: {
+        include_dirs: [
+            "packages/modules/Connectivity/framework/aidl-export",
+            "frameworks/native/aidl/binder", // For PersistableBundle.aidl
+        ],
+    },
+}
+
+java_library {
+    name: "framework-connectivity-flagged-apis",
+    srcs: [":framework-connectivity-flagged-apis-droidstubs"],
+}
+
 // Library providing limited APIs within the connectivity module, so that R+ components like
 // Tethering have a controlled way to depend on newer components like framework-connectivity that
 // are not loaded on R.