Always allow root uid to update device stats
root uid should always have android.permission.UPDATE_DEVICE_STATS, so
we skip the permission check if the calling uid is 0. The request from
root uid will not get blocked even if the framework doesn't pass down
the correct permission.
Bug: 111560570
Test: netd_integration_test
Change-Id: Idb535f02faadc3e0cb3c14b18e82742aa8976fac
diff --git a/server/TrafficController.cpp b/server/TrafficController.cpp
index 12cec42..e3b950c 100644
--- a/server/TrafficController.cpp
+++ b/server/TrafficController.cpp
@@ -93,7 +93,7 @@
}
bool TrafficController::hasUpdateDeviceStatsPermission(uid_t uid) {
- return mPrivilegedUser.find(uid) != mPrivilegedUser.end();
+ return ((uid == AID_ROOT) || mPrivilegedUser.find(uid) != mPrivilegedUser.end());
}
const std::string UidPermissionTypeToString(uint8_t permission) {