From 0f54d64db2d98701597b1961f23dd2e6c0919564 Mon Sep 17 00:00:00 2001 From: junyulai Date: Mon, 28 Mar 2022 15:39:12 +0800 Subject: [PATCH] Make some NetworkStats APIs system-current Move iterator and NetworkStats.Entry getters to system-current according to API council feedback. This reverts parts of ag/17117903. Test: TH Fix: 225168182 (cherry-picked from ag/17397294) Change-Id: Ia7fdf8d31a96a26b0bf1682f462292b051560477 Merged-In: Ia7fdf8d31a96a26b0bf1682f462292b051560477 --- framework-t/api/module-lib-current.txt | 18 ------------- framework-t/api/system-current.txt | 12 +++++++++ framework-t/src/android/net/NetworkStats.java | 26 +------------------ 3 files changed, 13 insertions(+), 43 deletions(-) diff --git a/framework-t/api/module-lib-current.txt b/framework-t/api/module-lib-current.txt index 8eef552ba1..c1f7b39f55 100644 --- a/framework-t/api/module-lib-current.txt +++ b/framework-t/api/module-lib-current.txt @@ -104,24 +104,6 @@ package android.net { field @NonNull public static final android.os.Parcelable.Creator CREATOR; } - public final class NetworkStats implements java.lang.Iterable android.os.Parcelable { - method @NonNull public java.util.Iterator iterator(); - } - - public static class NetworkStats.Entry { - method public int getDefaultNetwork(); - method public int getMetered(); - method public long getOperations(); - method public int getRoaming(); - method public long getRxBytes(); - method public long getRxPackets(); - method public int getSet(); - method public int getTag(); - method public long getTxBytes(); - method public long getTxPackets(); - method public int getUid(); - } - public class NetworkStatsCollection { method @NonNull public java.util.Map getEntries(); } diff --git a/framework-t/api/system-current.txt b/framework-t/api/system-current.txt index b8ede599a9..6460fed5b6 100644 --- a/framework-t/api/system-current.txt +++ b/framework-t/api/system-current.txt @@ -71,6 +71,7 @@ package android.net { method @NonNull public android.net.NetworkStats add(@NonNull android.net.NetworkStats); method @NonNull public android.net.NetworkStats addEntry(@NonNull android.net.NetworkStats.Entry); method public int describeContents(); + method @NonNull public java.util.Iterator iterator(); method @NonNull public android.net.NetworkStats subtract(@NonNull android.net.NetworkStats); method public void writeToParcel(@NonNull android.os.Parcel, int); field @NonNull public static final android.os.Parcelable.Creator CREATOR; @@ -94,6 +95,17 @@ package android.net { public static class NetworkStats.Entry { ctor public NetworkStats.Entry(@Nullable String, int, int, int, int, int, int, long, long, long, long, long); + method public int getDefaultNetwork(); + method public int getMetered(); + method public long getOperations(); + method public int getRoaming(); + method public long getRxBytes(); + method public long getRxPackets(); + method public int getSet(); + method public int getTag(); + method public long getTxBytes(); + method public long getTxPackets(); + method public int getUid(); } public class TrafficStats { diff --git a/framework-t/src/android/net/NetworkStats.java b/framework-t/src/android/net/NetworkStats.java index bcfeab9608..51ff5ec7ad 100644 --- a/framework-t/src/android/net/NetworkStats.java +++ b/framework-t/src/android/net/NetworkStats.java @@ -16,8 +16,6 @@ package android.net; -import static android.annotation.SystemApi.Client.MODULE_LIBRARIES; - import static com.android.net.module.util.NetworkStatsUtils.multiplySafeByRational; import android.annotation.IntDef; @@ -391,102 +389,80 @@ public final class NetworkStats implements Parcelable, Iterable iterator() { return new Iterator() { int mIndex = 0;