Add @UnsupportedAppUsage annotations
For packages: android.net.wimax android.net.wifi.p2p.nsd android.net.wifi.p2p android.net.wifi.hotspot2.pps android.net.wifi.hotspot2.omadm android.net.wifi.hotspot2 android.net.wifi.aware android.net.wifi android.net.util android.net.sip android.net.rtp android.net.nsd android.net.metrics android.net.lowpan android.net.http android.net.captiveportal android.net This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I520be7a4c79e68310c12e4f55bf66acaa94145a1
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
import android.annotation.SystemService;
|
import android.annotation.SystemService;
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
@@ -66,6 +67,7 @@ public class EthernetManager {
|
|||||||
* @param iface Ethernet interface name
|
* @param iface Ethernet interface name
|
||||||
* @param isAvailable {@code true} if Ethernet port exists.
|
* @param isAvailable {@code true} if Ethernet port exists.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
void onAvailabilityChanged(String iface, boolean isAvailable);
|
void onAvailabilityChanged(String iface, boolean isAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,6 +86,7 @@ public class EthernetManager {
|
|||||||
* Get Ethernet configuration.
|
* Get Ethernet configuration.
|
||||||
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
|
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public IpConfiguration getConfiguration(String iface) {
|
public IpConfiguration getConfiguration(String iface) {
|
||||||
try {
|
try {
|
||||||
return mService.getConfiguration(iface);
|
return mService.getConfiguration(iface);
|
||||||
@@ -95,6 +98,7 @@ public class EthernetManager {
|
|||||||
/**
|
/**
|
||||||
* Set Ethernet configuration.
|
* Set Ethernet configuration.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void setConfiguration(String iface, IpConfiguration config) {
|
public void setConfiguration(String iface, IpConfiguration config) {
|
||||||
try {
|
try {
|
||||||
mService.setConfiguration(iface, config);
|
mService.setConfiguration(iface, config);
|
||||||
@@ -106,6 +110,7 @@ public class EthernetManager {
|
|||||||
/**
|
/**
|
||||||
* Indicates whether the system currently has one or more Ethernet interfaces.
|
* Indicates whether the system currently has one or more Ethernet interfaces.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean isAvailable() {
|
public boolean isAvailable() {
|
||||||
return getAvailableInterfaces().length > 0;
|
return getAvailableInterfaces().length > 0;
|
||||||
}
|
}
|
||||||
@@ -115,6 +120,7 @@ public class EthernetManager {
|
|||||||
*
|
*
|
||||||
* @param iface Ethernet interface name
|
* @param iface Ethernet interface name
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public boolean isAvailable(String iface) {
|
public boolean isAvailable(String iface) {
|
||||||
try {
|
try {
|
||||||
return mService.isAvailable(iface);
|
return mService.isAvailable(iface);
|
||||||
@@ -128,6 +134,7 @@ public class EthernetManager {
|
|||||||
* @param listener A {@link Listener} to add.
|
* @param listener A {@link Listener} to add.
|
||||||
* @throws IllegalArgumentException If the listener is null.
|
* @throws IllegalArgumentException If the listener is null.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void addListener(Listener listener) {
|
public void addListener(Listener listener) {
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
throw new IllegalArgumentException("listener must not be null");
|
throw new IllegalArgumentException("listener must not be null");
|
||||||
@@ -145,6 +152,7 @@ public class EthernetManager {
|
|||||||
/**
|
/**
|
||||||
* Returns an array of available Ethernet interface names.
|
* Returns an array of available Ethernet interface names.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public String[] getAvailableInterfaces() {
|
public String[] getAvailableInterfaces() {
|
||||||
try {
|
try {
|
||||||
return mService.getAvailableInterfaces();
|
return mService.getAvailableInterfaces();
|
||||||
@@ -158,6 +166,7 @@ public class EthernetManager {
|
|||||||
* @param listener A {@link Listener} to remove.
|
* @param listener A {@link Listener} to remove.
|
||||||
* @throws IllegalArgumentException If the listener is null.
|
* @throws IllegalArgumentException If the listener is null.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void removeListener(Listener listener) {
|
public void removeListener(Listener listener) {
|
||||||
if (listener == null) {
|
if (listener == null) {
|
||||||
throw new IllegalArgumentException("listener must not be null");
|
throw new IllegalArgumentException("listener must not be null");
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.net;
|
package android.net;
|
||||||
|
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -110,25 +111,43 @@ public class NetworkStats implements Parcelable {
|
|||||||
* generated.
|
* generated.
|
||||||
*/
|
*/
|
||||||
private long elapsedRealtime;
|
private long elapsedRealtime;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int size;
|
private int size;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int capacity;
|
private int capacity;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private String[] iface;
|
private String[] iface;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] uid;
|
private int[] uid;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] set;
|
private int[] set;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] tag;
|
private int[] tag;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] metered;
|
private int[] metered;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] roaming;
|
private int[] roaming;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private int[] defaultNetwork;
|
private int[] defaultNetwork;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private long[] rxBytes;
|
private long[] rxBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private long[] rxPackets;
|
private long[] rxPackets;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private long[] txBytes;
|
private long[] txBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private long[] txPackets;
|
private long[] txPackets;
|
||||||
|
@UnsupportedAppUsage
|
||||||
private long[] operations;
|
private long[] operations;
|
||||||
|
|
||||||
public static class Entry {
|
public static class Entry {
|
||||||
|
@UnsupportedAppUsage
|
||||||
public String iface;
|
public String iface;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int uid;
|
public int uid;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int set;
|
public int set;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int tag;
|
public int tag;
|
||||||
/**
|
/**
|
||||||
* Note that this is only populated w/ the default value when read from /proc or written
|
* Note that this is only populated w/ the default value when read from /proc or written
|
||||||
@@ -148,12 +167,17 @@ public class NetworkStats implements Parcelable {
|
|||||||
* getSummary().
|
* getSummary().
|
||||||
*/
|
*/
|
||||||
public int defaultNetwork;
|
public int defaultNetwork;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long rxBytes;
|
public long rxBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long rxPackets;
|
public long rxPackets;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long txBytes;
|
public long txBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long txPackets;
|
public long txPackets;
|
||||||
public long operations;
|
public long operations;
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry() {
|
public Entry() {
|
||||||
this(IFACE_ALL, UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L, 0L, 0L, 0L);
|
this(IFACE_ALL, UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L, 0L, 0L, 0L);
|
||||||
}
|
}
|
||||||
@@ -240,6 +264,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkStats(long elapsedRealtime, int initialSize) {
|
public NetworkStats(long elapsedRealtime, int initialSize) {
|
||||||
this.elapsedRealtime = elapsedRealtime;
|
this.elapsedRealtime = elapsedRealtime;
|
||||||
this.size = 0;
|
this.size = 0;
|
||||||
@@ -263,6 +288,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkStats(Parcel parcel) {
|
public NetworkStats(Parcel parcel) {
|
||||||
elapsedRealtime = parcel.readLong();
|
elapsedRealtime = parcel.readLong();
|
||||||
size = parcel.readInt();
|
size = parcel.readInt();
|
||||||
@@ -399,6 +425,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Return specific stats entry.
|
* Return specific stats entry.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getValues(int i, Entry recycle) {
|
public Entry getValues(int i, Entry recycle) {
|
||||||
final Entry entry = recycle != null ? recycle : new Entry();
|
final Entry entry = recycle != null ? recycle : new Entry();
|
||||||
entry.iface = iface[i];
|
entry.iface = iface[i];
|
||||||
@@ -432,6 +459,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
return SystemClock.elapsedRealtime() - elapsedRealtime;
|
return SystemClock.elapsedRealtime() - elapsedRealtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int size() {
|
public int size() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
@@ -460,6 +488,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* {@link #findIndex(String, int, int, int, int)} is unable to find match. Can
|
* {@link #findIndex(String, int, int, int, int)} is unable to find match. Can
|
||||||
* also be used to subtract values from existing rows.
|
* also be used to subtract values from existing rows.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkStats combineValues(Entry entry) {
|
public NetworkStats combineValues(Entry entry) {
|
||||||
final int i = findIndex(entry.iface, entry.uid, entry.set, entry.tag, entry.metered,
|
final int i = findIndex(entry.iface, entry.uid, entry.set, entry.tag, entry.metered,
|
||||||
entry.roaming, entry.defaultNetwork);
|
entry.roaming, entry.defaultNetwork);
|
||||||
@@ -479,6 +508,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Combine all values from another {@link NetworkStats} into this object.
|
* Combine all values from another {@link NetworkStats} into this object.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void combineAllValues(NetworkStats another) {
|
public void combineAllValues(NetworkStats another) {
|
||||||
NetworkStats.Entry entry = null;
|
NetworkStats.Entry entry = null;
|
||||||
for (int i = 0; i < another.size; i++) {
|
for (int i = 0; i < another.size; i++) {
|
||||||
@@ -564,6 +594,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Return list of unique UIDs known by this data structure.
|
* Return list of unique UIDs known by this data structure.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int[] getUniqueUids() {
|
public int[] getUniqueUids() {
|
||||||
final SparseBooleanArray uids = new SparseBooleanArray();
|
final SparseBooleanArray uids = new SparseBooleanArray();
|
||||||
for (int uid : this.uid) {
|
for (int uid : this.uid) {
|
||||||
@@ -582,6 +613,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* Return total bytes represented by this snapshot object, usually used when
|
* Return total bytes represented by this snapshot object, usually used when
|
||||||
* checking if a {@link #subtract(NetworkStats)} delta passes a threshold.
|
* checking if a {@link #subtract(NetworkStats)} delta passes a threshold.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long getTotalBytes() {
|
public long getTotalBytes() {
|
||||||
final Entry entry = getTotal(null);
|
final Entry entry = getTotal(null);
|
||||||
return entry.rxBytes + entry.txBytes;
|
return entry.rxBytes + entry.txBytes;
|
||||||
@@ -590,6 +622,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Return total of all fields represented by this snapshot object.
|
* Return total of all fields represented by this snapshot object.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getTotal(Entry recycle) {
|
public Entry getTotal(Entry recycle) {
|
||||||
return getTotal(recycle, null, UID_ALL, false);
|
return getTotal(recycle, null, UID_ALL, false);
|
||||||
}
|
}
|
||||||
@@ -598,6 +631,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
* Return total of all fields represented by this snapshot object matching
|
* Return total of all fields represented by this snapshot object matching
|
||||||
* the requested {@link #uid}.
|
* the requested {@link #uid}.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getTotal(Entry recycle, int limitUid) {
|
public Entry getTotal(Entry recycle, int limitUid) {
|
||||||
return getTotal(recycle, null, limitUid, false);
|
return getTotal(recycle, null, limitUid, false);
|
||||||
}
|
}
|
||||||
@@ -610,6 +644,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
return getTotal(recycle, limitIface, UID_ALL, false);
|
return getTotal(recycle, limitIface, UID_ALL, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getTotalIncludingTags(Entry recycle) {
|
public Entry getTotalIncludingTags(Entry recycle) {
|
||||||
return getTotal(recycle, null, UID_ALL, true);
|
return getTotal(recycle, null, UID_ALL, true);
|
||||||
}
|
}
|
||||||
@@ -1085,6 +1120,7 @@ public class NetworkStats implements Parcelable {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static final Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() {
|
public static final Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() {
|
||||||
@Override
|
@Override
|
||||||
public NetworkStats createFromParcel(Parcel in) {
|
public NetworkStats createFromParcel(Parcel in) {
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import static android.text.format.DateUtils.SECOND_IN_MILLIS;
|
|||||||
|
|
||||||
import static com.android.internal.util.ArrayUtils.total;
|
import static com.android.internal.util.ArrayUtils.total;
|
||||||
|
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.service.NetworkStatsHistoryBucketProto;
|
import android.service.NetworkStatsHistoryBucketProto;
|
||||||
@@ -89,16 +90,23 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
public static class Entry {
|
public static class Entry {
|
||||||
public static final long UNKNOWN = -1;
|
public static final long UNKNOWN = -1;
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long bucketDuration;
|
public long bucketDuration;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long bucketStart;
|
public long bucketStart;
|
||||||
public long activeTime;
|
public long activeTime;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long rxBytes;
|
public long rxBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long rxPackets;
|
public long rxPackets;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long txBytes;
|
public long txBytes;
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long txPackets;
|
public long txPackets;
|
||||||
public long operations;
|
public long operations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkStatsHistory(long bucketDuration) {
|
public NetworkStatsHistory(long bucketDuration) {
|
||||||
this(bucketDuration, 10, FIELD_ALL);
|
this(bucketDuration, 10, FIELD_ALL);
|
||||||
}
|
}
|
||||||
@@ -125,6 +133,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
recordEntireHistory(existing);
|
recordEntireHistory(existing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkStatsHistory(Parcel in) {
|
public NetworkStatsHistory(Parcel in) {
|
||||||
bucketDuration = in.readLong();
|
bucketDuration = in.readLong();
|
||||||
bucketStart = readLongArray(in);
|
bucketStart = readLongArray(in);
|
||||||
@@ -210,6 +219,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int size() {
|
public int size() {
|
||||||
return bucketCount;
|
return bucketCount;
|
||||||
}
|
}
|
||||||
@@ -218,6 +228,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
return bucketDuration;
|
return bucketDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long getStart() {
|
public long getStart() {
|
||||||
if (bucketCount > 0) {
|
if (bucketCount > 0) {
|
||||||
return bucketStart[0];
|
return bucketStart[0];
|
||||||
@@ -226,6 +237,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public long getEnd() {
|
public long getEnd() {
|
||||||
if (bucketCount > 0) {
|
if (bucketCount > 0) {
|
||||||
return bucketStart[bucketCount - 1] + bucketDuration;
|
return bucketStart[bucketCount - 1] + bucketDuration;
|
||||||
@@ -245,6 +257,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
* Return index of bucket that contains or is immediately before the
|
* Return index of bucket that contains or is immediately before the
|
||||||
* requested time.
|
* requested time.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int getIndexBefore(long time) {
|
public int getIndexBefore(long time) {
|
||||||
int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
|
int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
@@ -272,6 +285,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
/**
|
/**
|
||||||
* Return specific stats entry.
|
* Return specific stats entry.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getValues(int i, Entry recycle) {
|
public Entry getValues(int i, Entry recycle) {
|
||||||
final Entry entry = recycle != null ? recycle : new Entry();
|
final Entry entry = recycle != null ? recycle : new Entry();
|
||||||
entry.bucketStart = bucketStart[i];
|
entry.bucketStart = bucketStart[i];
|
||||||
@@ -373,6 +387,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
* Record an entire {@link NetworkStatsHistory} into this history. Usually
|
* Record an entire {@link NetworkStatsHistory} into this history. Usually
|
||||||
* for combining together stats for external reporting.
|
* for combining together stats for external reporting.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void recordEntireHistory(NetworkStatsHistory input) {
|
public void recordEntireHistory(NetworkStatsHistory input) {
|
||||||
recordHistory(input, Long.MIN_VALUE, Long.MAX_VALUE);
|
recordHistory(input, Long.MIN_VALUE, Long.MAX_VALUE);
|
||||||
}
|
}
|
||||||
@@ -509,6 +524,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
* Return interpolated data usage across the requested range. Interpolates
|
* Return interpolated data usage across the requested range. Interpolates
|
||||||
* across buckets, so values may be rounded slightly.
|
* across buckets, so values may be rounded slightly.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getValues(long start, long end, Entry recycle) {
|
public Entry getValues(long start, long end, Entry recycle) {
|
||||||
return getValues(start, end, Long.MAX_VALUE, recycle);
|
return getValues(start, end, Long.MAX_VALUE, recycle);
|
||||||
}
|
}
|
||||||
@@ -517,6 +533,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
* Return interpolated data usage across the requested range. Interpolates
|
* Return interpolated data usage across the requested range. Interpolates
|
||||||
* across buckets, so values may be rounded slightly.
|
* across buckets, so values may be rounded slightly.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public Entry getValues(long start, long end, long now, Entry recycle) {
|
public Entry getValues(long start, long end, long now, Entry recycle) {
|
||||||
final Entry entry = recycle != null ? recycle : new Entry();
|
final Entry entry = recycle != null ? recycle : new Entry();
|
||||||
entry.bucketDuration = end - start;
|
entry.bucketDuration = end - start;
|
||||||
@@ -701,6 +718,7 @@ public class NetworkStatsHistory implements Parcelable {
|
|||||||
return writer.toString();
|
return writer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static final Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() {
|
public static final Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() {
|
||||||
@Override
|
@Override
|
||||||
public NetworkStatsHistory createFromParcel(Parcel in) {
|
public NetworkStatsHistory createFromParcel(Parcel in) {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import static android.net.NetworkStats.ROAMING_NO;
|
|||||||
import static android.net.NetworkStats.ROAMING_YES;
|
import static android.net.NetworkStats.ROAMING_YES;
|
||||||
import static android.net.wifi.WifiInfo.removeDoubleQuotes;
|
import static android.net.wifi.WifiInfo.removeDoubleQuotes;
|
||||||
|
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.BackupUtils;
|
import android.util.BackupUtils;
|
||||||
@@ -96,6 +97,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
|
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
|
||||||
* the given IMSI.
|
* the given IMSI.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateMobileAll(String subscriberId) {
|
public static NetworkTemplate buildTemplateMobileAll(String subscriberId) {
|
||||||
return new NetworkTemplate(MATCH_MOBILE, subscriberId, null);
|
return new NetworkTemplate(MATCH_MOBILE, subscriberId, null);
|
||||||
}
|
}
|
||||||
@@ -104,6 +106,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks,
|
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks,
|
||||||
* regardless of IMSI.
|
* regardless of IMSI.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateMobileWildcard() {
|
public static NetworkTemplate buildTemplateMobileWildcard() {
|
||||||
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
|
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
|
||||||
}
|
}
|
||||||
@@ -112,11 +115,13 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* Template to match all {@link ConnectivityManager#TYPE_WIFI} networks,
|
* Template to match all {@link ConnectivityManager#TYPE_WIFI} networks,
|
||||||
* regardless of SSID.
|
* regardless of SSID.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateWifiWildcard() {
|
public static NetworkTemplate buildTemplateWifiWildcard() {
|
||||||
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
|
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateWifi() {
|
public static NetworkTemplate buildTemplateWifi() {
|
||||||
return buildTemplateWifiWildcard();
|
return buildTemplateWifiWildcard();
|
||||||
}
|
}
|
||||||
@@ -133,6 +138,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* Template to combine all {@link ConnectivityManager#TYPE_ETHERNET} style
|
* Template to combine all {@link ConnectivityManager#TYPE_ETHERNET} style
|
||||||
* networks together.
|
* networks together.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate buildTemplateEthernet() {
|
public static NetworkTemplate buildTemplateEthernet() {
|
||||||
return new NetworkTemplate(MATCH_ETHERNET, null, null);
|
return new NetworkTemplate(MATCH_ETHERNET, null, null);
|
||||||
}
|
}
|
||||||
@@ -173,6 +179,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
private final int mRoaming;
|
private final int mRoaming;
|
||||||
private final int mDefaultNetwork;
|
private final int mDefaultNetwork;
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
|
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
|
||||||
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
|
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
|
||||||
}
|
}
|
||||||
@@ -293,10 +300,12 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public int getMatchRule() {
|
public int getMatchRule() {
|
||||||
return mMatchRule;
|
return mMatchRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public String getSubscriberId() {
|
public String getSubscriberId() {
|
||||||
return mSubscriberId;
|
return mSubscriberId;
|
||||||
}
|
}
|
||||||
@@ -460,6 +469,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
* active merge set [A,B], we'd return a new template that primarily matches
|
* active merge set [A,B], we'd return a new template that primarily matches
|
||||||
* A, but also matches B.
|
* A, but also matches B.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
|
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
|
||||||
if (template.isMatchRuleMobile() && ArrayUtils.contains(merged, template.mSubscriberId)) {
|
if (template.isMatchRuleMobile() && ArrayUtils.contains(merged, template.mSubscriberId)) {
|
||||||
// Requested template subscriber is part of the merge group; return
|
// Requested template subscriber is part of the merge group; return
|
||||||
@@ -471,6 +481,7 @@ public class NetworkTemplate implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
|
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
|
||||||
@Override
|
@Override
|
||||||
public NetworkTemplate createFromParcel(Parcel in) {
|
public NetworkTemplate createFromParcel(Parcel in) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package android.net;
|
|||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.app.DownloadManager;
|
import android.app.DownloadManager;
|
||||||
import android.app.backup.BackupManager;
|
import android.app.backup.BackupManager;
|
||||||
import android.app.usage.NetworkStatsManager;
|
import android.app.usage.NetworkStatsManager;
|
||||||
@@ -141,6 +142,7 @@ public class TrafficStats {
|
|||||||
|
|
||||||
private static INetworkStatsService sStatsService;
|
private static INetworkStatsService sStatsService;
|
||||||
|
|
||||||
|
@UnsupportedAppUsage
|
||||||
private synchronized static INetworkStatsService getStatsService() {
|
private synchronized static INetworkStatsService getStatsService() {
|
||||||
if (sStatsService == null) {
|
if (sStatsService == null) {
|
||||||
sStatsService = INetworkStatsService.Stub.asInterface(
|
sStatsService = INetworkStatsService.Stub.asInterface(
|
||||||
@@ -536,6 +538,7 @@ public class TrafficStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static long getMobileTcpRxPackets() {
|
public static long getMobileTcpRxPackets() {
|
||||||
long total = 0;
|
long total = 0;
|
||||||
for (String iface : getMobileIfaces()) {
|
for (String iface : getMobileIfaces()) {
|
||||||
@@ -551,6 +554,7 @@ public class TrafficStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static long getMobileTcpTxPackets() {
|
public static long getMobileTcpTxPackets() {
|
||||||
long total = 0;
|
long total = 0;
|
||||||
for (String iface : getMobileIfaces()) {
|
for (String iface : getMobileIfaces()) {
|
||||||
@@ -584,6 +588,7 @@ public class TrafficStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static long getTxBytes(String iface) {
|
public static long getTxBytes(String iface) {
|
||||||
try {
|
try {
|
||||||
return getStatsService().getIfaceStats(iface, TYPE_TX_BYTES);
|
return getStatsService().getIfaceStats(iface, TYPE_TX_BYTES);
|
||||||
@@ -593,6 +598,7 @@ public class TrafficStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** {@hide} */
|
/** {@hide} */
|
||||||
|
@UnsupportedAppUsage
|
||||||
public static long getRxBytes(String iface) {
|
public static long getRxBytes(String iface) {
|
||||||
try {
|
try {
|
||||||
return getStatsService().getIfaceStats(iface, TYPE_RX_BYTES);
|
return getStatsService().getIfaceStats(iface, TYPE_RX_BYTES);
|
||||||
@@ -948,6 +954,7 @@ public class TrafficStats {
|
|||||||
* Interfaces are never removed from this list, so counters should always be
|
* Interfaces are never removed from this list, so counters should always be
|
||||||
* monotonic.
|
* monotonic.
|
||||||
*/
|
*/
|
||||||
|
@UnsupportedAppUsage
|
||||||
private static String[] getMobileIfaces() {
|
private static String[] getMobileIfaces() {
|
||||||
try {
|
try {
|
||||||
return getStatsService().getMobileIfaces();
|
return getStatsService().getMobileIfaces();
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package android.net.nsd;
|
package android.net.nsd;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.UnsupportedAppUsage;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -185,6 +186,7 @@ public final class NsdServiceInfo implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
|
@UnsupportedAppUsage
|
||||||
public void setAttribute(String key, byte[] value) {
|
public void setAttribute(String key, byte[] value) {
|
||||||
if (TextUtils.isEmpty(key)) {
|
if (TextUtils.isEmpty(key)) {
|
||||||
throw new IllegalArgumentException("Key cannot be empty");
|
throw new IllegalArgumentException("Key cannot be empty");
|
||||||
|
|||||||
Reference in New Issue
Block a user