Remove getHasDns() and VirtualNetwork.mHasDns

getHasDns() and VirtualNetwork.mHasDns are no more useful after commit
aops/658122.

Bug: 116539103
Test: system/netd/tests/runtests.sh pass

Change-Id: Ica04984a954a9e89a5eb38a9b262775d686f8ed4
diff --git a/server/CommandListener.cpp b/server/CommandListener.cpp
index df9b7fc..0c750e0 100644
--- a/server/CommandListener.cpp
+++ b/server/CommandListener.cpp
@@ -1294,17 +1294,16 @@
     //    0      1       2         3
     // network create <netId> [permission]
     //
-    //    0      1       2     3     4        5
-    // network create <netId> vpn <hasDns> <secure>
+    //    0      1       2     3      4
+    // network create <netId> vpn <secure>
     if (!strcmp(argv[1], "create")) {
         if (argc < 3) {
             return syntaxError(client, "Missing argument");
         }
         unsigned netId = stringToNetId(argv[2]);
         if (argc == 6 && !strcmp(argv[3], "vpn")) {
-            bool hasDns = strtol(argv[4], nullptr, 2);
-            bool secure = strtol(argv[5], nullptr, 2);
-            if (int ret = gCtls->netCtrl.createVirtualNetwork(netId, hasDns, secure)) {
+            bool secure = strtol(argv[4], nullptr, 2);
+            if (int ret = gCtls->netCtrl.createVirtualNetwork(netId, secure)) {
                 return operationError(client, "createVirtualNetwork() failed", ret);
             }
         } else if (argc > 4) {
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 3331438..f9a83e4 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -349,9 +349,11 @@
     return statusFromErrcode(ret);
 }
 
-binder::Status NetdNativeService::networkCreateVpn(int32_t netId, bool hasDns, bool secure) {
+binder::Status NetdNativeService::networkCreateVpn(int32_t netId, bool secure) {
     ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
-    int ret = gCtls->netCtrl.createVirtualNetwork(netId, hasDns, secure);
+    auto entry = gLog.newEntry().prettyFunction(__PRETTY_FUNCTION__).args(netId, secure);
+    int ret = gCtls->netCtrl.createVirtualNetwork(netId, secure);
+    gLog.log(entry.returns(ret).withAutomaticDuration());
     return statusFromErrcode(ret);
 }
 
diff --git a/server/NetdNativeService.h b/server/NetdNativeService.h
index ab2fc87..c691e91 100644
--- a/server/NetdNativeService.h
+++ b/server/NetdNativeService.h
@@ -60,7 +60,7 @@
 
     // Network and routing commands.
     binder::Status networkCreatePhysical(int32_t netId, int32_t permission) override;
-    binder::Status networkCreateVpn(int32_t netId, bool hasDns, bool secure) override;
+    binder::Status networkCreateVpn(int32_t netId, bool secure) override;
     binder::Status networkDestroy(int32_t netId) override;
 
     binder::Status networkAddInterface(int32_t netId, const std::string& iface) override;
diff --git a/server/NetworkController.cpp b/server/NetworkController.cpp
index 5d64a28..575a0bc 100644
--- a/server/NetworkController.cpp
+++ b/server/NetworkController.cpp
@@ -413,7 +413,7 @@
     return ret;
 }
 
-int NetworkController::createVirtualNetwork(unsigned netId, bool hasDns, bool secure) {
+int NetworkController::createVirtualNetwork(unsigned netId, bool secure) {
     ScopedWLock lock(mRWLock);
 
     if (!(MIN_NET_ID <= netId && netId <= MAX_NET_ID)) {
@@ -429,7 +429,7 @@
     if (int ret = modifyFallthroughLocked(netId, true)) {
         return ret;
     }
-    mNetworks[netId] = new VirtualNetwork(netId, hasDns, secure);
+    mNetworks[netId] = new VirtualNetwork(netId, secure);
     return 0;
 }
 
diff --git a/server/NetworkController.h b/server/NetworkController.h
index eb7d670..984f507 100644
--- a/server/NetworkController.h
+++ b/server/NetworkController.h
@@ -105,7 +105,7 @@
 
     int createPhysicalNetwork(unsigned netId, Permission permission) WARN_UNUSED_RESULT;
     int createPhysicalOemNetwork(Permission permission, unsigned *netId) WARN_UNUSED_RESULT;
-    int createVirtualNetwork(unsigned netId, bool hasDns, bool secure) WARN_UNUSED_RESULT;
+    int createVirtualNetwork(unsigned netId, bool secure) WARN_UNUSED_RESULT;
     int destroyNetwork(unsigned netId) WARN_UNUSED_RESULT;
 
     int addInterfaceToNetwork(unsigned netId, const char* interface) WARN_UNUSED_RESULT;
diff --git a/server/VirtualNetwork.cpp b/server/VirtualNetwork.cpp
index 974f918..33791c6 100644
--- a/server/VirtualNetwork.cpp
+++ b/server/VirtualNetwork.cpp
@@ -28,16 +28,9 @@
 namespace android {
 namespace net {
 
-VirtualNetwork::VirtualNetwork(unsigned netId, bool hasDns, bool secure) :
-        Network(netId), mHasDns(hasDns), mSecure(secure) {
-}
+VirtualNetwork::VirtualNetwork(unsigned netId, bool secure) : Network(netId), mSecure(secure) {}
 
-VirtualNetwork::~VirtualNetwork() {
-}
-
-bool VirtualNetwork::getHasDns() const {
-    return mHasDns;
-}
+VirtualNetwork::~VirtualNetwork() {}
 
 bool VirtualNetwork::isSecure() const {
     return mSecure;
diff --git a/server/VirtualNetwork.h b/server/VirtualNetwork.h
index e48060b..69b14d8 100644
--- a/server/VirtualNetwork.h
+++ b/server/VirtualNetwork.h
@@ -34,10 +34,9 @@
 // permitted to skip it and pick any other network for their connections.
 class VirtualNetwork : public Network {
 public:
-    VirtualNetwork(unsigned netId, bool hasDns, bool secure);
+    VirtualNetwork(unsigned netId, bool secure);
     virtual ~VirtualNetwork();
 
-    bool getHasDns() const;
     bool isSecure() const;
     bool appliesToUser(uid_t uid) const;
 
@@ -53,7 +52,6 @@
     int maybeCloseSockets(bool add, const UidRanges& uidRanges,
                           const std::set<uid_t>& protectableUsers);
 
-    const bool mHasDns;
     const bool mSecure;
     UidRanges mUidRanges;
 };
diff --git a/server/binder/android/net/INetd.aidl b/server/binder/android/net/INetd.aidl
index 43ce797..906dcf3 100644
--- a/server/binder/android/net/INetd.aidl
+++ b/server/binder/android/net/INetd.aidl
@@ -78,13 +78,12 @@
      * Creates a VPN network.
      *
      * @param netId the network to create.
-     * @param hasDns whether the VPN has DNS servers.
      * @param secure whether unprivileged apps are allowed to bypass the VPN.
      *
      * @throws ServiceSpecificException in case of failure, with an error code corresponding to the
      *         unix errno.
      */
-    void networkCreateVpn(int netId, boolean hasDns, boolean secure);
+    void networkCreateVpn(int netId, boolean secure);
 
     /**
      * Destroys a network. Any interfaces added to the network are removed, and the network ceases