Remove unused variables
From aosp/537809, variables that used to fetch realtime stats are defined in NetworkStatsService. These varialbles are filled by JNI in boot up stage in order to keep definitions sync with native layer. However, there is still a copy in TrafficStats.java, and this copy cannot be filled in boot-up stage since it is in app process. Besides, making a binder call to fetch these constants from service is considered an overkill. Thus, since there is no caller to these variables and callers should use definitions in TrafficStats, remove these variables. Test: atest FrameworksNetTests Bug: 16229221 Change-Id: I6a48d4dbb1b824cfc6c4a47395b2a76aa28cf5c9
This commit is contained in:
@@ -215,21 +215,6 @@ static const JNINativeMethod gMethods[] = {
|
||||
};
|
||||
|
||||
int register_android_server_net_NetworkStatsService(JNIEnv* env) {
|
||||
jclass netStatsService = env->FindClass("com/android/server/net/NetworkStatsService");
|
||||
jfieldID rxBytesId = env->GetStaticFieldID(netStatsService, "TYPE_RX_BYTES", "I");
|
||||
jfieldID rxPacketsId = env->GetStaticFieldID(netStatsService, "TYPE_RX_PACKETS", "I");
|
||||
jfieldID txBytesId = env->GetStaticFieldID(netStatsService, "TYPE_TX_BYTES", "I");
|
||||
jfieldID txPacketsId = env->GetStaticFieldID(netStatsService, "TYPE_TX_PACKETS", "I");
|
||||
jfieldID tcpRxPacketsId = env->GetStaticFieldID(netStatsService, "TYPE_TCP_RX_PACKETS", "I");
|
||||
jfieldID tcpTxPacketsId = env->GetStaticFieldID(netStatsService, "TYPE_TCP_TX_PACKETS", "I");
|
||||
|
||||
env->SetStaticIntField(netStatsService, rxBytesId, RX_BYTES);
|
||||
env->SetStaticIntField(netStatsService, rxPacketsId, RX_PACKETS);
|
||||
env->SetStaticIntField(netStatsService, txBytesId, TX_BYTES);
|
||||
env->SetStaticIntField(netStatsService, txPacketsId, TX_PACKETS);
|
||||
env->SetStaticIntField(netStatsService, tcpRxPacketsId, TCP_RX_PACKETS);
|
||||
env->SetStaticIntField(netStatsService, tcpTxPacketsId, TCP_TX_PACKETS);
|
||||
|
||||
return jniRegisterNativeMethods(env, "com/android/server/net/NetworkStatsService", gMethods,
|
||||
NELEM(gMethods));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user