Remove setCounterSet and deleteTagData support from FwmarkServer

Removing all references to setCounterSet and deleteTagData from
FwmarkServer and FwmarkClient.

The symbols cannot be removed from NetdClient as some older VNDK
versions might still rely on them (they use dlsym, and do not reference
the symbol directly, so TH may not catch this).

Test: builds and boots
Change-Id: Ic2c971d066c6579e5cebc61ae33b369e1f54310e
diff --git a/client/FwmarkClient.cpp b/client/FwmarkClient.cpp
index 592fe31..c56e767 100644
--- a/client/FwmarkClient.cpp
+++ b/client/FwmarkClient.cpp
@@ -37,9 +37,7 @@
 const sockaddr_un FWMARK_SERVER_PATH = {AF_UNIX, "/dev/socket/fwmarkd"};
 
 bool commandHasFd(int cmdId) {
-    return (cmdId != FwmarkCommand::QUERY_USER_ACCESS) &&
-        (cmdId != FwmarkCommand::SET_COUNTERSET) &&
-        (cmdId != FwmarkCommand::DELETE_TAGDATA);
+    return (cmdId != FwmarkCommand::QUERY_USER_ACCESS);
 }
 
 }  // namespace
diff --git a/client/NetdClient.cpp b/client/NetdClient.cpp
index 0105a04..2a09a44 100644
--- a/client/NetdClient.cpp
+++ b/client/NetdClient.cpp
@@ -516,14 +516,12 @@
     return FwmarkClient().send(&command, socketFd, nullptr);
 }
 
-extern "C" int setCounterSet(uint32_t counterSet, uid_t uid) {
-    FwmarkCommand command = {FwmarkCommand::SET_COUNTERSET, 0, uid, counterSet};
-    return FwmarkClient().send(&command, -1, nullptr);
+extern "C" int setCounterSet(uint32_t, uid_t) {
+    return -ENOTSUP;
 }
 
-extern "C" int deleteTagData(uint32_t tag, uid_t uid) {
-    FwmarkCommand command = {FwmarkCommand::DELETE_TAGDATA, 0, uid, tag};
-    return FwmarkClient().send(&command, -1, nullptr);
+extern "C" int deleteTagData(uint32_t, uid_t) {
+    return -ENOTSUP;
 }
 
 extern "C" int resNetworkQuery(unsigned netId, const char* dname, int ns_class, int ns_type,
diff --git a/include/FwmarkCommand.h b/include/FwmarkCommand.h
index 83e62d3..c215ed4 100644
--- a/include/FwmarkCommand.h
+++ b/include/FwmarkCommand.h
@@ -64,11 +64,8 @@
         ON_CONNECT_COMPLETE,
         TAG_SOCKET,
         UNTAG_SOCKET,
-        // TODO: use binder to pass the following two request in future after we
-        // completely get rid of qtaguid module, since these are privileged
-        // command.
-        SET_COUNTERSET,
-        DELETE_TAGDATA,
+        _UNUSED_SET_COUNTERSET,  // unsupported, do not use this command
+        _UNUSED_DELETE_TAGDATA,  // unsupported, do not use this command
         ON_SENDMMSG,
         ON_SENDMSG,
         ON_SENDTO,
diff --git a/include/NetdClient.h b/include/NetdClient.h
index cc835ed..9e722f4 100644
--- a/include/NetdClient.h
+++ b/include/NetdClient.h
@@ -46,10 +46,6 @@
 
 int untagSocket(int socketFd);
 
-int setCounterSet(uint32_t counterSet, uid_t uid);
-
-int deleteTagData(uint32_t tag, uid_t uid);
-
 int resNetworkQuery(unsigned netId, const char* dname, int ns_class, int ns_type, uint32_t flags);
 
 int resNetworkResult(int query_fd, int* rcode, uint8_t* answer, size_t anslen);
diff --git a/server/FwmarkServer.cpp b/server/FwmarkServer.cpp
index 53dd3e3..652a358 100644
--- a/server/FwmarkServer.cpp
+++ b/server/FwmarkServer.cpp
@@ -32,7 +32,6 @@
 #include "FwmarkCommand.h"
 #include "NetdConstants.h"
 #include "NetworkController.h"
-#include "TrafficController.h"
 
 #include "NetdUpdatablePublic.h"
 
@@ -64,12 +63,10 @@
     return ret;
 }
 
-FwmarkServer::FwmarkServer(NetworkController* networkController, EventReporter* eventReporter,
-                           TrafficController* trafficCtrl)
+FwmarkServer::FwmarkServer(NetworkController* networkController, EventReporter* eventReporter)
     : SocketListener(SOCKET_NAME, true),
       mNetworkController(networkController),
       mEventReporter(eventReporter),
-      mTrafficCtrl(trafficCtrl),
       mRedirectSocketCalls(
               android::base::GetBoolProperty("ro.vendor.redirect_socket_calls", false)) {}
 
@@ -136,14 +133,6 @@
         return mNetworkController->checkUserNetworkAccess(command.uid, command.netId);
     }
 
-    if (command.cmdId == FwmarkCommand::SET_COUNTERSET) {
-        return mTrafficCtrl->setCounterSet(command.trafficCtrlInfo, command.uid, client->getUid());
-    }
-
-    if (command.cmdId == FwmarkCommand::DELETE_TAGDATA) {
-        return mTrafficCtrl->deleteTagData(command.trafficCtrlInfo, command.uid, client->getUid());
-    }
-
     if (received_fds.size() != 1) {
         LOG(ERROR) << "FwmarkServer received " << received_fds.size() << " fds from client?";
         return -EBADF;
diff --git a/server/FwmarkServer.h b/server/FwmarkServer.h
index 32d5791..b013582 100644
--- a/server/FwmarkServer.h
+++ b/server/FwmarkServer.h
@@ -24,12 +24,10 @@
 namespace net {
 
 class NetworkController;
-class TrafficController;
 
 class FwmarkServer : public SocketListener {
 public:
-  explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter,
-                        TrafficController* trafficCtrl);
+  explicit FwmarkServer(NetworkController* networkController, EventReporter* eventReporter);
 
   static constexpr const char* SOCKET_NAME = "fwmarkd";
 
@@ -42,7 +40,6 @@
 
     NetworkController* const mNetworkController;
     EventReporter* mEventReporter;
-    TrafficController* mTrafficCtrl;
     bool mRedirectSocketCalls;
 };
 
diff --git a/server/main.cpp b/server/main.cpp
index f287665..fd1544c 100644
--- a/server/main.cpp
+++ b/server/main.cpp
@@ -183,7 +183,7 @@
         exit(1);
     }
 
-    FwmarkServer fwmarkServer(&gCtls->netCtrl, &gCtls->eventReporter, &gCtls->trafficCtrl);
+    FwmarkServer fwmarkServer(&gCtls->netCtrl, &gCtls->eventReporter);
     if (fwmarkServer.startListener()) {
         ALOGE("Unable to start FwmarkServer (%s)", strerror(errno));
         exit(1);