From 8f5d138277557891830871fe108a86521ecdd8f6 Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Tue, 27 Feb 2018 22:47:01 +0900 Subject: [PATCH] Minor cleanups to NetworkStats interface tracking. Currently, when a network goes into CONNECTED state, we call updateLinkProperties and then notifyIfacesChangedForNetworkStats. The latter is unnecessary, as there are exactly two cases: 1. networkAgent.linkProperties != null: updateLinkProperties will call notifyIfacesChangedForNetworkStats, because oldLp is null and networkAgent.linkProperties is not null. 2. networkAgent.linkProperties is null: there is no need to call notifyIfacesChangedForNetworkStats, because no interfaces were added or removed. When they are, updateLinkProperties will be called again. Removing the call to notifyIfacesChangedForNetworkStats avoids a stats poll, which is a minor performance improvement. Also, remove the NetworkStatsService code to do asynchronous interface updates, since it has no callers. Bug: 72107146 Test: builds, boots Test: runtest frameworks-net Change-Id: I9337ea26c0505a1c66ceda01254b68e25cd7972c --- .../java/com/android/server/net/NetworkStatsService.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index bfc150e1a9..82981275fc 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -153,8 +153,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub { static final boolean LOGV = false; private static final int MSG_PERFORM_POLL = 1; - private static final int MSG_UPDATE_IFACES = 2; - private static final int MSG_REGISTER_GLOBAL_ALERT = 3; + private static final int MSG_REGISTER_GLOBAL_ALERT = 2; /** Flags to control detail level of poll event. */ private static final int FLAG_PERSIST_NETWORK = 0x1; @@ -1533,10 +1532,6 @@ public class NetworkStatsService extends INetworkStatsService.Stub { mService.performPoll(flags); return true; } - case MSG_UPDATE_IFACES: { - mService.updateIfaces(null); - return true; - } case MSG_REGISTER_GLOBAL_ALERT: { mService.registerGlobalAlert(); return true;