Add DomainsUtils class to encode/decode domain names.

Both encode and deocde methods support message compression which is
described in RFC1035 section 4.1.4. We can leverage both methods in
a follow-up CL to parse DHCPv4 option 119 and DNSSL RA option.

This cl also adds maxLabelCount argument for DnsRecordParser#parseName
to prevent the potential recursion from overflowing the stack.

Bug: 189865016
Test: atest NetworkStaticLibTests
Change-Id: I624649c224f141848a475ac85c56012d138c5224
diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp
index ff65228..e1b5601 100644
--- a/staticlibs/Android.bp
+++ b/staticlibs/Android.bp
@@ -35,6 +35,7 @@
   name: "net-utils-device-common",
   srcs: [
       "device/com/android/net/module/util/DeviceConfigUtils.java",
+      "device/com/android/net/module/util/DomainUtils.java",
       "device/com/android/net/module/util/FdEventsReader.java",
       "device/com/android/net/module/util/NetworkMonitorUtils.java",
       "device/com/android/net/module/util/PacketReader.java",