Enable proguard on service-connectivity

The current proguard rules keep all classes currently in the jar, so
this does not strip any classes, but it applies optimizations on the
code.
Enabling proguard will be useful when adding service-nearby to the jar.

Bug: 189355156
Test: m service-connectivity; check list of classes in jar unchanged
Change-Id: I3be9422a431a5b5bc1478960ce332a89377bd632
diff --git a/service/Android.bp b/service/Android.bp
index d1a9004..975dcb5 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -155,6 +155,11 @@
     apex_available: [
         "com.android.tethering",
     ],
+    optimize: {
+        enabled: true,
+        shrink: true,
+        proguard_flags_files: ["proguard.flags"],
+    },
     lint: { strict_updatability_linting: true },
 }
 
diff --git a/service/proguard.flags b/service/proguard.flags
new file mode 100644
index 0000000..b572684
--- /dev/null
+++ b/service/proguard.flags
@@ -0,0 +1,5 @@
+# Make sure proguard keeps all connectivity classes
+-keep class com.android.connectivity.** { *; }
+-keep class com.android.net.** { *; }
+-keep class com.android.server.** { *; }
+