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
This commit is contained in:
@@ -104,24 +104,6 @@ package android.net {
|
|||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkStateSnapshot> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkStateSnapshot> CREATOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class NetworkStats implements java.lang.Iterable<android.net.NetworkStats.Entry> android.os.Parcelable {
|
|
||||||
method @NonNull public java.util.Iterator<android.net.NetworkStats.Entry> 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 {
|
public class NetworkStatsCollection {
|
||||||
method @NonNull public java.util.Map<android.net.NetworkStatsCollection.Key,android.net.NetworkStatsHistory> getEntries();
|
method @NonNull public java.util.Map<android.net.NetworkStatsCollection.Key,android.net.NetworkStatsHistory> getEntries();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ package android.net {
|
|||||||
method @NonNull public android.net.NetworkStats add(@NonNull android.net.NetworkStats);
|
method @NonNull public android.net.NetworkStats add(@NonNull android.net.NetworkStats);
|
||||||
method @NonNull public android.net.NetworkStats addEntry(@NonNull android.net.NetworkStats.Entry);
|
method @NonNull public android.net.NetworkStats addEntry(@NonNull android.net.NetworkStats.Entry);
|
||||||
method public int describeContents();
|
method public int describeContents();
|
||||||
|
method @NonNull public java.util.Iterator<android.net.NetworkStats.Entry> iterator();
|
||||||
method @NonNull public android.net.NetworkStats subtract(@NonNull android.net.NetworkStats);
|
method @NonNull public android.net.NetworkStats subtract(@NonNull android.net.NetworkStats);
|
||||||
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkStats> CREATOR;
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.NetworkStats> CREATOR;
|
||||||
@@ -94,6 +95,17 @@ package android.net {
|
|||||||
|
|
||||||
public static class NetworkStats.Entry {
|
public static class NetworkStats.Entry {
|
||||||
ctor public NetworkStats.Entry(@Nullable String, int, int, int, int, int, int, long, long, long, long, long);
|
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 {
|
public class TrafficStats {
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
import static android.annotation.SystemApi.Client.MODULE_LIBRARIES;
|
|
||||||
|
|
||||||
import static com.android.net.module.util.NetworkStatsUtils.multiplySafeByRational;
|
import static com.android.net.module.util.NetworkStatsUtils.multiplySafeByRational;
|
||||||
|
|
||||||
import android.annotation.IntDef;
|
import android.annotation.IntDef;
|
||||||
@@ -391,102 +389,80 @@ public final class NetworkStats implements Parcelable, Iterable<NetworkStats.Ent
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the uid of this entry.
|
* @return the uid of this entry.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
return uid;
|
return uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the set state of this entry.
|
* @return the set state of this entry.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
@State public int getSet() {
|
@State public int getSet() {
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the tag value of this entry.
|
* @return the tag value of this entry.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public int getTag() {
|
public int getTag() {
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the metered state.
|
* @return the metered state.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@Meteredness
|
@Meteredness
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public int getMetered() {
|
public int getMetered() {
|
||||||
return metered;
|
return metered;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the roaming state.
|
* @return the roaming state.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@Roaming
|
@Roaming
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public int getRoaming() {
|
public int getRoaming() {
|
||||||
return roaming;
|
return roaming;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the default network state.
|
* @return the default network state.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@DefaultNetwork
|
@DefaultNetwork
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public int getDefaultNetwork() {
|
public int getDefaultNetwork() {
|
||||||
return defaultNetwork;
|
return defaultNetwork;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of received bytes.
|
* @return the number of received bytes.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public long getRxBytes() {
|
public long getRxBytes() {
|
||||||
return rxBytes;
|
return rxBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of received packets.
|
* @return the number of received packets.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public long getRxPackets() {
|
public long getRxPackets() {
|
||||||
return rxPackets;
|
return rxPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of transmitted bytes.
|
* @return the number of transmitted bytes.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public long getTxBytes() {
|
public long getTxBytes() {
|
||||||
return txBytes;
|
return txBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the number of transmitted packets.
|
* @return the number of transmitted packets.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public long getTxPackets() {
|
public long getTxPackets() {
|
||||||
return txPackets;
|
return txPackets;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the count of network operations performed for this entry.
|
* @return the count of network operations performed for this entry.
|
||||||
* @hide
|
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
|
||||||
public long getOperations() {
|
public long getOperations() {
|
||||||
return operations;
|
return operations;
|
||||||
}
|
}
|
||||||
@@ -708,7 +684,7 @@ public final class NetworkStats implements Parcelable, Iterable<NetworkStats.Ent
|
|||||||
* The remove() method is not implemented and will throw UnsupportedOperationException.
|
* The remove() method is not implemented and will throw UnsupportedOperationException.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@SystemApi(client = MODULE_LIBRARIES)
|
@SystemApi
|
||||||
@NonNull public Iterator<Entry> iterator() {
|
@NonNull public Iterator<Entry> iterator() {
|
||||||
return new Iterator<Entry>() {
|
return new Iterator<Entry>() {
|
||||||
int mIndex = 0;
|
int mIndex = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user