bpf is required - remove checkBpfStatsEnable()
Test: git grep 'nativeGetTotalStat|nativeGetIfaceStat|nativeGetUidStat'
- shows all locations have been updated
git grep 'checkBpfStatsEnable'
- find nothings relevant (just services/art-profile)
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib584ea57c39d5ab0605787b05133097fd2c82a39
diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java
index 097b071..e7b768d 100644
--- a/services/core/java/com/android/server/net/NetworkStatsService.java
+++ b/services/core/java/com/android/server/net/NetworkStatsService.java
@@ -1084,13 +1084,13 @@
if (callingUid != android.os.Process.SYSTEM_UID && callingUid != uid) {
return UNSUPPORTED;
}
- return nativeGetUidStat(uid, type, checkBpfStatsEnable());
+ return nativeGetUidStat(uid, type);
}
@Override
public long getIfaceStats(@NonNull String iface, int type) {
Objects.requireNonNull(iface);
- long nativeIfaceStats = nativeGetIfaceStat(iface, type, checkBpfStatsEnable());
+ long nativeIfaceStats = nativeGetIfaceStat(iface, type);
if (nativeIfaceStats == -1) {
return nativeIfaceStats;
} else {
@@ -1104,7 +1104,7 @@
@Override
public long getTotalStats(int type) {
- long nativeTotalStats = nativeGetTotalStat(type, checkBpfStatsEnable());
+ long nativeTotalStats = nativeGetTotalStat(type);
if (nativeTotalStats == -1) {
return nativeTotalStats;
} else {
@@ -1137,10 +1137,6 @@
}
}
- private boolean checkBpfStatsEnable() {
- return mUseBpfTrafficStats;
- }
-
/**
* Update {@link NetworkStatsRecorder} and {@link #mGlobalAlertBytes} to
* reflect current {@link #mPersistThreshold} value. Always defers to
@@ -2249,7 +2245,7 @@
}
}
- private static native long nativeGetTotalStat(int type, boolean useBpfStats);
- private static native long nativeGetIfaceStat(String iface, int type, boolean useBpfStats);
- private static native long nativeGetUidStat(int uid, int type, boolean useBpfStats);
+ private static native long nativeGetTotalStat(int type);
+ private static native long nativeGetIfaceStat(String iface, int type);
+ private static native long nativeGetUidStat(int uid, int type);
}
diff --git a/services/core/jni/com_android_server_net_NetworkStatsService.cpp b/services/core/jni/com_android_server_net_NetworkStatsService.cpp
index 6a355e5..5178132 100644
--- a/services/core/jni/com_android_server_net_NetworkStatsService.cpp
+++ b/services/core/jni/com_android_server_net_NetworkStatsService.cpp
@@ -69,7 +69,7 @@
}
}
-static jlong getTotalStat(JNIEnv* env, jclass clazz, jint type, jboolean useBpfStats) {
+static jlong getTotalStat(JNIEnv* env, jclass clazz, jint type) {
Stats stats = {};
if (bpfGetIfaceStats(NULL, &stats) == 0) {
@@ -79,8 +79,7 @@
}
}
-static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type,
- jboolean useBpfStats) {
+static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type) {
ScopedUtfChars iface8(env, iface);
if (iface8.c_str() == NULL) {
return UNKNOWN;
@@ -95,7 +94,7 @@
}
}
-static jlong getUidStat(JNIEnv* env, jclass clazz, jint uid, jint type, jboolean useBpfStats) {
+static jlong getUidStat(JNIEnv* env, jclass clazz, jint uid, jint type) {
Stats stats = {};
if (bpfGetUidStats(uid, &stats) == 0) {
@@ -106,9 +105,9 @@
}
static const JNINativeMethod gMethods[] = {
- {"nativeGetTotalStat", "(IZ)J", (void*) getTotalStat},
- {"nativeGetIfaceStat", "(Ljava/lang/String;IZ)J", (void*) getIfaceStat},
- {"nativeGetUidStat", "(IIZ)J", (void*) getUidStat},
+ {"nativeGetTotalStat", "(I)J", (void*)getTotalStat},
+ {"nativeGetIfaceStat", "(Ljava/lang/String;I)J", (void*)getIfaceStat},
+ {"nativeGetUidStat", "(II)J", (void*)getUidStat},
};
int register_android_server_net_NetworkStatsService(JNIEnv* env) {