From 66645a8d68b8d457b9d9538d0a8d60df1e98dde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Sat, 12 Aug 2023 08:26:44 +0000 Subject: [PATCH] simplify tcpTx/RxPackets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On T+ this is mainline code, and the bpf program (netd.c) does not support collecting tcp specific stats. (note: this *is* a behaviour change, as it currently just always returns 0, but UNSUPPORTED/-1 seems to make more sense) Test: TreeHugger Bug: 294604315 Signed-off-by: Maciej Żenczykowski Change-Id: Ifda15e67d9167a2be98ab6f4e3817ff7c0bb3fea --- framework-t/src/android/net/TrafficStats.java | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/framework-t/src/android/net/TrafficStats.java b/framework-t/src/android/net/TrafficStats.java index dc4ac552a4..41cf63f521 100644 --- a/framework-t/src/android/net/TrafficStats.java +++ b/framework-t/src/android/net/TrafficStats.java @@ -683,33 +683,13 @@ public class TrafficStats { /** {@hide} */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static long getMobileTcpRxPackets() { - long total = 0; - for (String iface : getMobileIfaces()) { - long stat = UNSUPPORTED; - try { - stat = getStatsService().getIfaceStats(iface, TYPE_TCP_RX_PACKETS); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - total += addIfSupported(stat); - } - return total; + return UNSUPPORTED; } /** {@hide} */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static long getMobileTcpTxPackets() { - long total = 0; - for (String iface : getMobileIfaces()) { - long stat = UNSUPPORTED; - try { - stat = getStatsService().getIfaceStats(iface, TYPE_TCP_TX_PACKETS); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } - total += addIfSupported(stat); - } - return total; + return UNSUPPORTED; } /**