Remove unused functions in TrafficController
addInterface and hasUpdateDeviceStatsPermission are not used Test: m & flush & boot Bug: 217624062 Change-Id: I8a0f84f607a4f35512bc72e732df8f689b8ed1c9
This commit is contained in:
@@ -56,7 +56,6 @@ using base::unique_fd;
|
||||
using bpf::BpfMap;
|
||||
using bpf::synchronizeKernelRCU;
|
||||
using netdutils::DumpWriter;
|
||||
using netdutils::getIfaceList;
|
||||
using netdutils::NetlinkListener;
|
||||
using netdutils::NetlinkListenerInterface;
|
||||
using netdutils::ScopedIndent;
|
||||
@@ -111,14 +110,6 @@ const std::string uidMatchTypeToString(uint32_t match) {
|
||||
return matchType;
|
||||
}
|
||||
|
||||
bool TrafficController::hasUpdateDeviceStatsPermission(uid_t uid) {
|
||||
// This implementation is the same logic as method ActivityManager#checkComponentPermission.
|
||||
// It implies that the calling uid can never be the same as PER_USER_RANGE.
|
||||
uint32_t appId = uid % PER_USER_RANGE;
|
||||
return ((appId == AID_ROOT) || (appId == AID_SYSTEM) ||
|
||||
mPrivilegedUser.find(appId) != mPrivilegedUser.end());
|
||||
}
|
||||
|
||||
const std::string UidPermissionTypeToString(int permission) {
|
||||
if (permission == INetd::PERMISSION_NONE) {
|
||||
return "PERMISSION_NONE";
|
||||
@@ -198,16 +189,6 @@ Status TrafficController::initMaps() {
|
||||
Status TrafficController::start() {
|
||||
RETURN_IF_NOT_OK(initMaps());
|
||||
|
||||
// Fetch the list of currently-existing interfaces. At this point NetlinkHandler is
|
||||
// already running, so it will call addInterface() when any new interface appears.
|
||||
// TODO: Clean-up addInterface() after interface monitoring is in
|
||||
// NetworkStatsService.
|
||||
std::map<std::string, uint32_t> ifacePairs;
|
||||
ASSIGN_OR_RETURN(ifacePairs, getIfaceList());
|
||||
for (const auto& ifacePair:ifacePairs) {
|
||||
addInterface(ifacePair.first.c_str(), ifacePair.second);
|
||||
}
|
||||
|
||||
auto result = makeSkDestroyListener();
|
||||
if (!isOk(result)) {
|
||||
ALOGE("Unable to create SkDestroyListener: %s", toString(result).c_str());
|
||||
@@ -245,22 +226,6 @@ Status TrafficController::start() {
|
||||
return netdutils::status::ok;
|
||||
}
|
||||
|
||||
int TrafficController::addInterface(const char* name, uint32_t ifaceIndex) {
|
||||
IfaceValue iface;
|
||||
if (ifaceIndex == 0) {
|
||||
ALOGE("Unknown interface %s(%d)", name, ifaceIndex);
|
||||
return -1;
|
||||
}
|
||||
|
||||
strlcpy(iface.name, name, sizeof(IfaceValue));
|
||||
Status res = mIfaceIndexNameMap.writeValue(ifaceIndex, iface, BPF_ANY);
|
||||
if (!isOk(res)) {
|
||||
ALOGE("Failed to add iface %s(%d): %s", name, ifaceIndex, strerror(res.code()));
|
||||
return -res.code();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Status TrafficController::updateOwnerMapEntry(UidOwnerMatchType match, uid_t uid, FirewallRule rule,
|
||||
FirewallType type) {
|
||||
std::lock_guard guard(mMutex);
|
||||
|
||||
Reference in New Issue
Block a user