Jarjar utils into framework-wifi and share with wifi-service

Jarjar utility classes used by both framework-wifi
and wifi-service into framework-wifi and allow
them to be referenced by wifi-service.

Create framework-wifi-util-lib which contains
utility classes that we will copy into the Wifi module.
It is statically linked into framework-wifi and
dynamically linked by wifi-service.

Create framework-wifi-pre-jarjar to allow
wifi-service to use the pre-rename symbols in
framework-wifi-util-lib.

In essence:
1. build framework-wifi-util-lib,
  framework-wifi-pre-jarjar, wifi-service-pre-jarjar
  using original symbol names.
2. rename everything afterwards at the same time.

This ensures that all symbol names are consistent at
each step in the build process.

Bug: 142886292
Test: device boots up and connects to wifi
Change-Id: I27b3519657d652787714b4b34de6cdbfef2a81e4
diff --git a/wifi/Android.bp b/wifi/Android.bp
index 286be0b..a69803a 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -52,10 +52,15 @@
     "//external/robolectric-shadows:__subpackages__",
 ]
 
+// wifi-service needs pre-jarjared version of framework-wifi so it can reference copied utility
+// classes before they are renamed.
 java_library {
-    name: "framework-wifi",
+    name: "framework-wifi-pre-jarjar",
     // TODO(b/140299412) should be core_current once we build against framework-system-stubs
     sdk_version: "core_platform",
+    static_libs: [
+        "framework-wifi-util-lib",
+    ],
     libs: [
         // TODO(b/140299412) should be framework-system-stubs once we fix all @hide dependencies
         "framework-minus-apex",
@@ -64,6 +69,23 @@
     srcs: [
         ":framework-wifi-updatable-sources",
     ],
+    installable: false,
+    visibility: [
+        "//frameworks/opt/net/wifi/service",
+        "//frameworks/opt/net/wifi/tests/wifitests",
+    ],
+}
+
+// post-jarjar version of framework-wifi
+java_library {
+    name: "framework-wifi",
+    // TODO(b/140299412) should be core_current once we build against framework-system-stubs
+    sdk_version: "core_platform",
+    static_libs: [
+        "framework-wifi-pre-jarjar",
+    ],
+    jarjar_rules: ":wifi-jarjar-rules",
+
     installable: true,
     optimize: {
         enabled: false
@@ -122,3 +144,8 @@
     ],
     visibility: test_access_hidden_api_whitelist,
 }
+
+filegroup {
+    name: "wifi-jarjar-rules",
+    srcs: ["jarjar-rules.txt"],
+}