Always allow system uid to update device stats
The system uid always have permission UPDATE_DEVICE_STATS but it cannot
be properly recognized by permissionMonitor since it is not a installed
package. Instead, netd should always allow the system uid to do the
action.
Fix: 128638982
Bug: 124004517
Test: NetworkUsageStatsTest
"dumpsys netd trafficcontroller" show entries in counterSet map
Change-Id: I7214d7d9acd95bf514c4b6dad9f6d0659be6d571
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index 677f32c..9e9e257 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -93,7 +93,8 @@
}
bool TrafficController::hasUpdateDeviceStatsPermission(uid_t uid) {
- return ((uid == AID_ROOT) || mPrivilegedUser.find(uid) != mPrivilegedUser.end());
+ return ((uid == AID_ROOT) || (uid == AID_SYSTEM) ||
+ mPrivilegedUser.find(uid) != mPrivilegedUser.end());
}
const std::string UidPermissionTypeToString(uint8_t permission) {