Add nearby to tethering apex

Nearby will be merged together with the tethering/connectivity APEX, so
that module maintenance efforts can be reduced, and the two codebases
can evolve the interfaces that they expose to each other over time.

Bug: 189355156
Test: m
Ignore-AOSP-First: Nearby is not yet in AOSP. This introduces minimal
                   unavoidable merge conflicts until it is merged there.
Change-Id: If4b40689a257d2806f895cd2dded97fc699adc5f
diff --git a/service/Android.bp b/service/Android.bp
index 975dcb5..7d5d7b3 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -150,6 +150,7 @@
     static_libs: [
         "service-connectivity-pre-jarjar",
         "service-connectivity-tiramisu-pre-jarjar",
+        "service-nearby",
     ],
     jarjar_rules: "jarjar-rules.txt",
     apex_available: [
diff --git a/service/proguard.flags b/service/proguard.flags
index b572684..57086c7 100644
--- a/service/proguard.flags
+++ b/service/proguard.flags
@@ -3,3 +3,15 @@
 -keep class com.android.net.** { *; }
 -keep class com.android.server.** { *; }
 
+# Prevent proguard from stripping out any nearby-service.
+# TODO: This could be optimized in the future to only keep the critical
+# entry points and then let proguard strip out any unused code within
+# the service.
+-keep class com.android.server.nearby.** { *; }
+
+# The lite proto runtime uses reflection to access fields based on the names in
+# the schema, keep all the fields.
+# This replicates the base proguard rule used by the build by default
+# (proguard_basic_keeps.flags), but needs to be specified here because the
+# com.google.protobuf package is jarjared to the below package.
+-keepclassmembers class * extends com.android.connectivity.com.google.protobuf.MessageLite { <fields>; }