summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author junyulai <junyulai@google.com> 2018-11-08 22:33:09 +0800
committer junyulai <junyulai@google.com> 2018-11-13 17:44:41 +0800
commitf5bc6f61b41f62d572bbe5a66797b1f5a8103676 (patch)
tree4bc958abf38c92866a60b892b4617621587a33a0
parenteda8aa1f46d3bccb089fb5e8feea07d7fe6867a0 (diff)
Change types of fields of network stats reported to framework.
Currently, NetworkStats use int to handle uid, set and tag, while native side using unsigned int mixing with signed int with that. This commit make necessary changes in JNI part while libnetdbpf unifying the types of fields. Bug: 112226716 Bug: 119193941 Test: 1. manually reconnect vpn 2. update apps from playstore 3. atest libnetdbpf_test 4. runtest frameworks-net 5. cts-tradefed run cts -m CtsUsageStatsTestCases -t \ android.app.usage.cts.NetworkUsageStatsTest Change-Id: I6c27124db8292e2825fba51b8994f013897cb566 Merged-In: I6c27124db8292e2825fba51b8994f013897cb566 (cherry picked from commit bf7803eed8283d5a1caa2efe90aa449590ddb94f)
-rw-r--r--core/jni/com_android_internal_net_NetworkStatsFactory.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/jni/com_android_internal_net_NetworkStatsFactory.cpp b/core/jni/com_android_internal_net_NetworkStatsFactory.cpp
index c15b7ee4fe04..de3a78a61a7e 100644
--- a/core/jni/com_android_internal_net_NetworkStatsFactory.cpp
+++ b/core/jni/com_android_internal_net_NetworkStatsFactory.cpp
@@ -175,7 +175,7 @@ static int legacyReadNetworkStatsDetail(std::vector<stats_line>* lines,
}
}
s.tag = rawTag >> 32;
- if (limitTag != -1 && s.tag != limitTag) {
+ if (limitTag != -1 && s.tag != static_cast<uint32_t>(limitTag)) {
//ALOGI("skipping due to tag: %s", buffer);
continue;
}
@@ -188,7 +188,7 @@ static int legacyReadNetworkStatsDetail(std::vector<stats_line>* lines,
if (sscanf(pos, "%u %u %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64,
&s.uid, &s.set, &s.rxBytes, &s.rxPackets,
&s.txBytes, &s.txPackets) == 6) {
- if (limitUid != -1 && limitUid != s.uid) {
+ if (limitUid != -1 && static_cast<uint32_t>(limitUid) != s.uid) {
//ALOGI("skipping due to uid: %s", buffer);
continue;
}