Remove unused lastStats parameter

This change removes an unused parameter that is always null in
getNetworkStatsUidDetail

Bug: 113122541
Bug: 134244752
Test: FrameworksNetTest passing
Merged-In: I995b108ef30e1fbd6190131ed4db40a3d9327eb5
Change-Id: I575a7e4fa145f2c93537f33a2bfe952aeafd0e69
(cherry picked from commit 5823e8d3c69b10ad2a458e491c146631457ca86d)
This commit is contained in:
Benedict Wong
2019-06-11 18:21:30 -07:00
parent 2cca1ef390
commit a3da62f5a1

View File

@@ -16,6 +16,7 @@
package com.android.server.net; package com.android.server.net;
import static android.net.NetworkStats.INTERFACES_ALL;
import static android.net.NetworkStats.SET_ALL; import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.TAG_ALL; import static android.net.NetworkStats.TAG_ALL;
import static android.net.NetworkStats.TAG_NONE; import static android.net.NetworkStats.TAG_NONE;
@@ -264,13 +265,21 @@ public class NetworkStatsFactory {
} }
public NetworkStats readNetworkStatsDetail() throws IOException { public NetworkStats readNetworkStatsDetail() throws IOException {
return readNetworkStatsDetail(UID_ALL, null, TAG_ALL, null); return readNetworkStatsDetail(UID_ALL, INTERFACES_ALL, TAG_ALL);
} }
public NetworkStats readNetworkStatsDetail(int limitUid, String[] limitIfaces, int limitTag, /**
NetworkStats lastStats) throws IOException { * Reads the detailed UID stats based on the provided parameters
final NetworkStats stats = *
readNetworkStatsDetailInternal(limitUid, limitIfaces, limitTag, lastStats); * @param limitUid the UID to limit this query to
* @param limitIfaces the interfaces to limit this query to. Use {@link
* NetworkStats.INTERFACES_ALL} to select all interfaces
* @param limitTag the tags to limit this query to
* @return the NetworkStats instance containing network statistics at the present time.
*/
public NetworkStats readNetworkStatsDetail(
int limitUid, @Nullable String[] limitIfaces, int limitTag) throws IOException {
final NetworkStats stats = readNetworkStatsDetailInternal(limitUid, limitIfaces, limitTag);
// No locking here: apply464xlatAdjustments behaves fine with an add-only ConcurrentHashMap. // No locking here: apply464xlatAdjustments behaves fine with an add-only ConcurrentHashMap.
// TODO: remove this and only apply adjustments in NetworkStatsService. // TODO: remove this and only apply adjustments in NetworkStatsService.
@@ -292,17 +301,11 @@ public class NetworkStatsFactory {
} }
} }
// TODO: delete the lastStats parameter private NetworkStats readNetworkStatsDetailInternal(
private NetworkStats readNetworkStatsDetailInternal(int limitUid, String[] limitIfaces, int limitUid, String[] limitIfaces, int limitTag) throws IOException {
int limitTag, NetworkStats lastStats) throws IOException {
if (USE_NATIVE_PARSING) { if (USE_NATIVE_PARSING) {
final NetworkStats stats; final NetworkStats stats =
if (lastStats != null) { new NetworkStats(SystemClock.elapsedRealtime(), 0 /* initialSize */);
stats = lastStats;
stats.setElapsedRealtime(SystemClock.elapsedRealtime());
} else {
stats = new NetworkStats(SystemClock.elapsedRealtime(), -1);
}
if (mUseBpfStats) { if (mUseBpfStats) {
synchronized (mPersistSnapshot) { synchronized (mPersistSnapshot) {
try { try {