UidRanges: use class instead of pair<uid_t, uid_t>

Reuse the UidRange that was introduced in 7.0 (NYC) to ease transition
from CommandListener to binder which supports this as a parcelable type.

There is a small difference in behaviour: UidRange uses signed int32_t
vs. uid_t being unsigned and potentially a different size. This should
not be a problem as all of the java-side code is converting from int.

Updating to use int64_t in future would be a large effort and involve
changing the java-side UidRange class to use longs, and not fixing the
native side would cause unit tests to fail, so it shouldn't be possible
to overlook if that happens.

Committing this early with an appropriately loud warning so that it can
get soak time over the next year.

Test: runtest -x netd_integration_test.cpp
Change-Id: I6c217b347724ba5bfe2df28d6142a4343cb06353
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index fa39c89..d85bde4 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -39,6 +39,7 @@
 #include "resolv_netid.h"
 
 using android::base::WriteStringToFile;
+using android::net::UidRange;
 
 namespace {
 
@@ -775,11 +776,11 @@
     fwmark.protectedFromVpn = false;
     mask.protectedFromVpn = true;
 
-    for (const UidRanges::Range& range : uidRanges.getRanges()) {
+    for (const UidRange& range : uidRanges.getRanges()) {
         if (int ret = modifyIpRule(add ? RTM_NEWRULE : RTM_DELRULE,
                                    RULE_PRIORITY_PROHIBIT_NON_VPN, FR_ACT_PROHIBIT, RT_TABLE_UNSPEC,
                                    fwmark.intValue, mask.intValue, IIF_LOOPBACK, OIF_NONE,
-                                   range.first, range.second)) {
+                                   range.getStart(), range.getStop())) {
             return ret;
         }
     }
@@ -795,16 +796,17 @@
         return -ESRCH;
     }
 
-    for (const UidRanges::Range& range : uidRanges.getRanges()) {
-        if (int ret = modifyVpnUidRangeRule(table, range.first, range.second, secure, add)) {
+    for (const UidRange& range : uidRanges.getRanges()) {
+        if (int ret = modifyVpnUidRangeRule(table, range.getStart(), range.getStop(), secure, add))
+                {
             return ret;
         }
-        if (int ret = modifyExplicitNetworkRule(netId, table, PERMISSION_NONE, range.first,
-                                                range.second, add)) {
+        if (int ret = modifyExplicitNetworkRule(netId, table, PERMISSION_NONE, range.getStart(),
+                                                range.getStop(), add)) {
             return ret;
         }
-        if (int ret = modifyOutputInterfaceRules(interface, table, PERMISSION_NONE, range.first,
-                                                 range.second, add)) {
+        if (int ret = modifyOutputInterfaceRules(interface, table, PERMISSION_NONE,
+                                                 range.getStart(), range.getStop(), add)) {
             return ret;
         }
     }