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: Ie25423113ee1a8071cd5039382c00de6ce0af7fd
Merged-In: I520be7a4c79e68310c12e4f55bf66acaa94145a1
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 104134a..fb916d3 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -22,6 +22,7 @@
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.SystemService;
+import android.annotation.UnsupportedAppUsage;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -311,6 +312,7 @@
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ @UnsupportedAppUsage
public static final String INET_CONDITION_ACTION =
"android.net.conn.INET_CONDITION_ACTION";
@@ -325,6 +327,7 @@
* @hide
*/
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ @UnsupportedAppUsage
public static final String ACTION_TETHER_STATE_CHANGED =
"android.net.conn.TETHER_STATE_CHANGED";
@@ -333,6 +336,7 @@
* gives a String[] listing all the interfaces configured for
* tethering and currently available for tethering.
*/
+ @UnsupportedAppUsage
public static final String EXTRA_AVAILABLE_TETHER = "availableArray";
/**
@@ -347,6 +351,7 @@
* gives a String[] listing all the interfaces currently tethered
* (ie, has DHCPv4 support and packets potentially forwarded/NATed)
*/
+ @UnsupportedAppUsage
public static final String EXTRA_ACTIVE_TETHER = "tetherArray";
/**
@@ -355,6 +360,7 @@
* failed. Use {@link #getLastTetherError} to find the error code
* for any interfaces listed here.
*/
+ @UnsupportedAppUsage
public static final String EXTRA_ERRORED_TETHER = "erroredArray";
/**
@@ -459,6 +465,7 @@
* The absence of a connection type.
* @hide
*/
+ @UnsupportedAppUsage
public static final int TYPE_NONE = -1;
/**
@@ -575,6 +582,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_MOBILE_FOTA = 10;
/**
@@ -583,6 +591,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_MOBILE_IMS = 11;
/**
@@ -591,6 +600,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_MOBILE_CBS = 12;
/**
@@ -600,6 +610,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_WIFI_P2P = 13;
/**
@@ -608,6 +619,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_MOBILE_IA = 14;
/**
@@ -617,6 +629,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_MOBILE_EMERGENCY = 15;
/**
@@ -625,6 +638,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static final int TYPE_PROXY = 16;
/**
@@ -707,6 +721,7 @@
*/
public static final String PRIVATE_DNS_DEFAULT_MODE_FALLBACK = PRIVATE_DNS_MODE_OPPORTUNISTIC;
+ @UnsupportedAppUsage
private final IConnectivityManager mService;
/**
* A kludge to facilitate static access where a Context pointer isn't available, like in the
@@ -743,6 +758,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static String getNetworkTypeName(int type) {
switch (type) {
case TYPE_NONE:
@@ -797,6 +813,7 @@
* {@hide}
*/
@Deprecated
+ @UnsupportedAppUsage
public static boolean isNetworkTypeMobile(int networkType) {
switch (networkType) {
case TYPE_MOBILE:
@@ -1010,6 +1027,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
+ @UnsupportedAppUsage
public NetworkInfo getActiveNetworkInfoForUid(int uid) {
return getActiveNetworkInfoForUid(uid, false);
}
@@ -1107,6 +1125,7 @@
*/
@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public Network getNetworkForType(int networkType) {
try {
return mService.getNetworkForType(networkType);
@@ -1135,6 +1154,7 @@
* the Networks that applications run by the given user will use by default.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities[] getDefaultNetworkCapabilitiesForUser(int userId) {
try {
return mService.getDefaultNetworkCapabilitiesForUser(userId);
@@ -1153,6 +1173,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public LinkProperties getActiveLinkProperties() {
try {
return mService.getActiveLinkProperties();
@@ -1177,6 +1198,7 @@
*/
@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public LinkProperties getLinkProperties(int networkType) {
try {
return mService.getLinkPropertiesForType(networkType);
@@ -1332,6 +1354,7 @@
return 1;
}
+ @UnsupportedAppUsage
private NetworkCapabilities networkCapabilitiesForFeature(int networkType, String feature) {
if (networkType == TYPE_MOBILE) {
switch (feature) {
@@ -1495,6 +1518,7 @@
};
}
+ @UnsupportedAppUsage
private static final HashMap<NetworkCapabilities, LegacyRequest> sLegacyRequests =
new HashMap<>();
@@ -1523,6 +1547,7 @@
Log.d(TAG, "expireRequest with " + ourSeqNum + ", " + sequenceNum);
}
+ @UnsupportedAppUsage
private NetworkRequest requestNetworkForFeatureLocked(NetworkCapabilities netCap) {
int delay = -1;
int type = legacyTypeForNetworkCapabilities(netCap);
@@ -1552,6 +1577,7 @@
}
}
+ @UnsupportedAppUsage
private boolean removeRequestForFeature(NetworkCapabilities netCap) {
final LegacyRequest l;
synchronized (sLegacyRequests) {
@@ -1619,10 +1645,13 @@
/** @hide */
public static class PacketKeepaliveCallback {
/** The requested keepalive was successfully started. */
+ @UnsupportedAppUsage
public void onStarted() {}
/** The keepalive was successfully stopped. */
+ @UnsupportedAppUsage
public void onStopped() {}
/** An error occurred. */
+ @UnsupportedAppUsage
public void onError(int error) {}
}
@@ -1689,6 +1718,7 @@
mLooper.quit();
}
+ @UnsupportedAppUsage
public void stop() {
try {
mService.stopKeepalive(mNetwork, mSlot);
@@ -1744,6 +1774,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public PacketKeepalive startNattKeepalive(
Network network, int intervalSeconds, PacketKeepaliveCallback callback,
InetAddress srcAddr, int srcPort, InetAddress dstAddr) {
@@ -1805,6 +1836,7 @@
* {@link #bindProcessToNetwork} API.
*/
@Deprecated
+ @UnsupportedAppUsage
public boolean requestRouteToHostAddress(int networkType, InetAddress hostAddress) {
checkLegacyRoutingApiAccess();
try {
@@ -1848,12 +1880,14 @@
* @hide
*/
@Deprecated
+ @UnsupportedAppUsage
public void setBackgroundDataSetting(boolean allowBackgroundData) {
// ignored
}
/** {@hide} */
@Deprecated
+ @UnsupportedAppUsage
public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
try {
return mService.getActiveNetworkQuotaInfo();
@@ -1867,6 +1901,7 @@
* @deprecated Talk to TelephonyManager directly
*/
@Deprecated
+ @UnsupportedAppUsage
public boolean getMobileDataEnabled() {
IBinder b = ServiceManager.getService(Context.TELEPHONY_SERVICE);
if (b != null) {
@@ -1986,6 +2021,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public static ConnectivityManager from(Context context) {
return (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
}
@@ -2036,6 +2072,7 @@
* @hide
*/
@Deprecated
+ @UnsupportedAppUsage
private static ConnectivityManager getInstance() {
if (getInstanceOrNull() == null) {
throw new IllegalStateException("No ConnectivityManager yet constructed");
@@ -2052,6 +2089,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetherableIfaces() {
try {
return mService.getTetherableIfaces();
@@ -2068,6 +2106,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetheredIfaces() {
try {
return mService.getTetheredIfaces();
@@ -2090,6 +2129,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetheringErroredIfaces() {
try {
return mService.getTetheringErroredIfaces();
@@ -2136,6 +2176,7 @@
*
* {@hide}
*/
+ @UnsupportedAppUsage
public int tether(String iface) {
try {
String pkgName = mContext.getOpPackageName();
@@ -2164,6 +2205,7 @@
*
* {@hide}
*/
+ @UnsupportedAppUsage
public int untether(String iface) {
try {
String pkgName = mContext.getOpPackageName();
@@ -2317,6 +2359,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetherableUsbRegexs() {
try {
return mService.getTetherableUsbRegexs();
@@ -2336,6 +2379,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetherableWifiRegexs() {
try {
return mService.getTetherableWifiRegexs();
@@ -2355,6 +2399,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public String[] getTetherableBluetoothRegexs() {
try {
return mService.getTetherableBluetoothRegexs();
@@ -2380,6 +2425,7 @@
*
* {@hide}
*/
+ @UnsupportedAppUsage
public int setUsbTethering(boolean enable) {
try {
String pkgName = mContext.getOpPackageName();
@@ -2426,6 +2472,7 @@
* {@hide}
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public int getLastTetherError(String iface) {
try {
return mService.getLastTetherError(iface);
@@ -2579,6 +2626,7 @@
*/
@Deprecated
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
+ @UnsupportedAppUsage
public boolean isNetworkSupported(int networkType) {
try {
return mService.isNetworkSupported(networkType);
@@ -2680,6 +2728,7 @@
* @hide
*/
@RequiresPermission(android.Manifest.permission.CONNECTIVITY_INTERNAL)
+ @UnsupportedAppUsage
public void setAirplaneMode(boolean enable) {
try {
mService.setAirplaneMode(enable);
@@ -2689,6 +2738,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public void registerNetworkFactory(Messenger messenger, String name) {
try {
mService.registerNetworkFactory(messenger, name);
@@ -2698,6 +2748,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public void unregisterNetworkFactory(Messenger messenger) {
try {
mService.unregisterNetworkFactory(messenger);
@@ -3786,6 +3837,7 @@
* @deprecated This is strictly for legacy usage to support {@link #startUsingNetworkFeature}.
*/
@Deprecated
+ @UnsupportedAppUsage
public static boolean setProcessDefaultNetworkForHostResolution(Network network) {
return NetworkUtils.bindProcessToNetworkForHostResolution(
network == null ? NETID_UNSET : network.netId);
diff --git a/core/java/android/net/DhcpResults.java b/core/java/android/net/DhcpResults.java
index 8c5f603..b5d8226 100644
--- a/core/java/android/net/DhcpResults.java
+++ b/core/java/android/net/DhcpResults.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.net.NetworkUtils;
import android.os.Parcel;
import android.text.TextUtils;
@@ -33,25 +34,32 @@
public class DhcpResults extends StaticIpConfiguration {
private static final String TAG = "DhcpResults";
+ @UnsupportedAppUsage
public Inet4Address serverAddress;
/** Vendor specific information (from RFC 2132). */
+ @UnsupportedAppUsage
public String vendorInfo;
+ @UnsupportedAppUsage
public int leaseDuration;
/** Link MTU option. 0 means unset. */
+ @UnsupportedAppUsage
public int mtu;
+ @UnsupportedAppUsage
public DhcpResults() {
super();
}
+ @UnsupportedAppUsage
public DhcpResults(StaticIpConfiguration source) {
super(source);
}
/** copy constructor */
+ @UnsupportedAppUsage
public DhcpResults(DhcpResults source) {
super(source);
diff --git a/core/java/android/net/EthernetManager.java b/core/java/android/net/EthernetManager.java
index ecccda5..7256502 100644
--- a/core/java/android/net/EthernetManager.java
+++ b/core/java/android/net/EthernetManager.java
@@ -17,6 +17,7 @@
package android.net;
import android.annotation.SystemService;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
@@ -66,6 +67,7 @@
* @param iface Ethernet interface name
* @param isAvailable {@code true} if Ethernet port exists.
*/
+ @UnsupportedAppUsage
void onAvailabilityChanged(String iface, boolean isAvailable);
}
@@ -84,6 +86,7 @@
* Get Ethernet configuration.
* @return the Ethernet Configuration, contained in {@link IpConfiguration}.
*/
+ @UnsupportedAppUsage
public IpConfiguration getConfiguration(String iface) {
try {
return mService.getConfiguration(iface);
@@ -95,6 +98,7 @@
/**
* Set Ethernet configuration.
*/
+ @UnsupportedAppUsage
public void setConfiguration(String iface, IpConfiguration config) {
try {
mService.setConfiguration(iface, config);
@@ -106,6 +110,7 @@
/**
* Indicates whether the system currently has one or more Ethernet interfaces.
*/
+ @UnsupportedAppUsage
public boolean isAvailable() {
return getAvailableInterfaces().length > 0;
}
@@ -115,6 +120,7 @@
*
* @param iface Ethernet interface name
*/
+ @UnsupportedAppUsage
public boolean isAvailable(String iface) {
try {
return mService.isAvailable(iface);
@@ -128,6 +134,7 @@
* @param listener A {@link Listener} to add.
* @throws IllegalArgumentException If the listener is null.
*/
+ @UnsupportedAppUsage
public void addListener(Listener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
@@ -145,6 +152,7 @@
/**
* Returns an array of available Ethernet interface names.
*/
+ @UnsupportedAppUsage
public String[] getAvailableInterfaces() {
try {
return mService.getAvailableInterfaces();
@@ -158,6 +166,7 @@
* @param listener A {@link Listener} to remove.
* @throws IllegalArgumentException If the listener is null.
*/
+ @UnsupportedAppUsage
public void removeListener(Listener listener) {
if (listener == null) {
throw new IllegalArgumentException("listener must not be null");
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index 34cde08..b274155 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -45,6 +46,7 @@
return builder.toString();
}
+ @UnsupportedAppUsage
public Iterable<String> getFlags() {
return mFlags;
}
@@ -54,11 +56,13 @@
return mFlags.contains(flag);
}
+ @UnsupportedAppUsage
public void clearFlag(String flag) {
validateFlag(flag);
mFlags.remove(flag);
}
+ @UnsupportedAppUsage
public void setFlag(String flag) {
validateFlag(flag);
mFlags.add(flag);
@@ -67,6 +71,7 @@
/**
* Set flags to mark interface as up.
*/
+ @UnsupportedAppUsage
public void setInterfaceUp() {
mFlags.remove(FLAG_DOWN);
mFlags.add(FLAG_UP);
@@ -75,6 +80,7 @@
/**
* Set flags to mark interface as down.
*/
+ @UnsupportedAppUsage
public void setInterfaceDown() {
mFlags.remove(FLAG_UP);
mFlags.add(FLAG_DOWN);
@@ -92,6 +98,7 @@
return mAddr;
}
+ @UnsupportedAppUsage
public void setLinkAddress(LinkAddress addr) {
mAddr = addr;
}
diff --git a/core/java/android/net/IpConfiguration.java b/core/java/android/net/IpConfiguration.java
index fe69f296..7543920 100644
--- a/core/java/android/net/IpConfiguration.java
+++ b/core/java/android/net/IpConfiguration.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.net.StaticIpConfiguration;
import android.os.Parcel;
import android.os.Parcelable;
@@ -32,6 +33,7 @@
public enum IpAssignment {
/* Use statically configured IP settings. Configuration can be accessed
* with staticIpConfiguration */
+ @UnsupportedAppUsage
STATIC,
/* Use dynamically configured IP settigns */
DHCP,
@@ -47,6 +49,7 @@
public enum ProxySettings {
/* No proxy is to be used. Any existing proxy settings
* should be cleared. */
+ @UnsupportedAppUsage
NONE,
/* Use statically configured proxy. Configuration can be accessed
* with httpProxy. */
@@ -61,6 +64,7 @@
public ProxySettings proxySettings;
+ @UnsupportedAppUsage
public ProxyInfo httpProxy;
private void init(IpAssignment ipAssignment,
@@ -79,6 +83,7 @@
init(IpAssignment.UNASSIGNED, ProxySettings.UNASSIGNED, null, null);
}
+ @UnsupportedAppUsage
public IpConfiguration(IpAssignment ipAssignment,
ProxySettings proxySettings,
StaticIpConfiguration staticIpConfiguration,
diff --git a/core/java/android/net/LinkAddress.java b/core/java/android/net/LinkAddress.java
index bcfe938..1bc0d32 100644
--- a/core/java/android/net/LinkAddress.java
+++ b/core/java/android/net/LinkAddress.java
@@ -25,6 +25,7 @@
import static android.system.OsConstants.RT_SCOPE_SITE;
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Pair;
@@ -54,11 +55,13 @@
/**
* IPv4 or IPv6 address.
*/
+ @UnsupportedAppUsage
private InetAddress address;
/**
* Prefix length.
*/
+ @UnsupportedAppUsage
private int prefixLength;
/**
@@ -112,6 +115,7 @@
* @return true if the address is IPv6.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIPv6() {
return address instanceof Inet6Address;
}
@@ -163,6 +167,7 @@
* @param prefixLength The prefix length.
* @hide
*/
+ @UnsupportedAppUsage
public LinkAddress(InetAddress address, int prefixLength) {
this(address, prefixLength, 0, 0);
this.scope = scopeForUnicastAddress(address);
@@ -185,6 +190,7 @@
* @param string The string to parse.
* @hide
*/
+ @UnsupportedAppUsage
public LinkAddress(String address) {
this(address, 0, 0);
this.scope = scopeForUnicastAddress(this.address);
@@ -255,6 +261,7 @@
* otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isSameAddressAs(LinkAddress other) {
return address.equals(other.address) && prefixLength == other.prefixLength;
}
@@ -278,6 +285,7 @@
* TODO: Delete all callers and remove in favour of getPrefixLength().
* @hide
*/
+ @UnsupportedAppUsage
public int getNetworkPrefixLength() {
return getPrefixLength();
}
diff --git a/core/java/android/net/LinkProperties.java b/core/java/android/net/LinkProperties.java
index bd2db92..1b9a66c 100644
--- a/core/java/android/net/LinkProperties.java
+++ b/core/java/android/net/LinkProperties.java
@@ -18,6 +18,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -48,6 +49,7 @@
*/
public final class LinkProperties implements Parcelable {
// The interface described by the network link.
+ @UnsupportedAppUsage
private String mIfaceName;
private ArrayList<LinkAddress> mLinkAddresses = new ArrayList<>();
private ArrayList<InetAddress> mDnses = new ArrayList<>();
@@ -103,9 +105,13 @@
* @hide
*/
public enum ProvisioningChange {
+ @UnsupportedAppUsage
STILL_NOT_PROVISIONED,
+ @UnsupportedAppUsage
LOST_PROVISIONING,
+ @UnsupportedAppUsage
GAINED_PROVISIONING,
+ @UnsupportedAppUsage
STILL_PROVISIONED,
}
@@ -114,6 +120,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public static ProvisioningChange compareProvisioning(
LinkProperties before, LinkProperties after) {
if (before.isProvisioned() && after.isProvisioned()) {
@@ -154,12 +161,14 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public LinkProperties() {
}
/**
* @hide
*/
+ @UnsupportedAppUsage
public LinkProperties(LinkProperties source) {
if (source != null) {
mIfaceName = source.mIfaceName;
@@ -186,6 +195,7 @@
* @param iface The name of the network interface used for this link.
* @hide
*/
+ @UnsupportedAppUsage
public void setInterfaceName(String iface) {
mIfaceName = iface;
ArrayList<RouteInfo> newRoutes = new ArrayList<>(mRoutes.size());
@@ -207,6 +217,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public List<String> getAllInterfaceNames() {
List<String> interfaceNames = new ArrayList<>(mStackedLinks.size() + 1);
if (mIfaceName != null) interfaceNames.add(mIfaceName);
@@ -226,6 +237,7 @@
* @return An unmodifiable {@link List} of {@link InetAddress} for this link.
* @hide
*/
+ @UnsupportedAppUsage
public List<InetAddress> getAddresses() {
List<InetAddress> addresses = new ArrayList<>();
for (LinkAddress linkAddress : mLinkAddresses) {
@@ -238,6 +250,7 @@
* Returns all the addresses on this link and all the links stacked above it.
* @hide
*/
+ @UnsupportedAppUsage
public List<InetAddress> getAllAddresses() {
List<InetAddress> addresses = new ArrayList<>();
for (LinkAddress linkAddress : mLinkAddresses) {
@@ -265,6 +278,7 @@
* @return true if {@code address} was added or updated, false otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean addLinkAddress(LinkAddress address) {
if (address == null) {
return false;
@@ -315,6 +329,7 @@
* Returns all the addresses on this link and all the links stacked above it.
* @hide
*/
+ @UnsupportedAppUsage
public List<LinkAddress> getAllLinkAddresses() {
List<LinkAddress> addresses = new ArrayList<>(mLinkAddresses);
for (LinkProperties stacked: mStackedLinks.values()) {
@@ -331,6 +346,7 @@
* object.
* @hide
*/
+ @UnsupportedAppUsage
public void setLinkAddresses(Collection<LinkAddress> addresses) {
mLinkAddresses.clear();
for (LinkAddress address: addresses) {
@@ -345,6 +361,7 @@
* @return true if the DNS server was added, false if it was already present.
* @hide
*/
+ @UnsupportedAppUsage
public boolean addDnsServer(InetAddress dnsServer) {
if (dnsServer != null && !mDnses.contains(dnsServer)) {
mDnses.add(dnsServer);
@@ -360,6 +377,7 @@
* @return true if the DNS server was removed, false if it did not exist.
* @hide
*/
+ @UnsupportedAppUsage
public boolean removeDnsServer(InetAddress dnsServer) {
if (dnsServer != null) {
return mDnses.remove(dnsServer);
@@ -374,6 +392,7 @@
* @param dnsServers The {@link Collection} of DNS servers to set in this object.
* @hide
*/
+ @UnsupportedAppUsage
public void setDnsServers(Collection<InetAddress> dnsServers) {
mDnses.clear();
for (InetAddress dnsServer: dnsServers) {
@@ -510,6 +529,7 @@
* domains to search when resolving host names on this link.
* @hide
*/
+ @UnsupportedAppUsage
public void setDomains(String domains) {
mDomains = domains;
}
@@ -532,6 +552,7 @@
* @param mtu The MTU to use for this link.
* @hide
*/
+ @UnsupportedAppUsage
public void setMtu(int mtu) {
mMtu = mtu;
}
@@ -543,6 +564,7 @@
* @return The mtu value set for this link.
* @hide
*/
+ @UnsupportedAppUsage
public int getMtu() {
return mMtu;
}
@@ -555,6 +577,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public void setTcpBufferSizes(String tcpBufferSizes) {
mTcpBufferSizes = tcpBufferSizes;
}
@@ -566,6 +589,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public String getTcpBufferSizes() {
return mTcpBufferSizes;
}
@@ -589,6 +613,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public boolean addRoute(RouteInfo route) {
if (route != null) {
String routeIface = route.getInterface();
@@ -615,6 +640,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public boolean removeRoute(RouteInfo route) {
return route != null &&
Objects.equals(mIfaceName, route.getInterface()) &&
@@ -645,6 +671,7 @@
* Returns all the routes on this link and all the links stacked above it.
* @hide
*/
+ @UnsupportedAppUsage
public List<RouteInfo> getAllRoutes() {
List<RouteInfo> routes = new ArrayList<>(mRoutes);
for (LinkProperties stacked: mStackedLinks.values()) {
@@ -661,6 +688,7 @@
* @param proxy A {@link ProxyInfo} defining the HTTP Proxy to use on this link.
* @hide
*/
+ @UnsupportedAppUsage
public void setHttpProxy(ProxyInfo proxy) {
mHttpProxy = proxy;
}
@@ -685,6 +713,7 @@
* @return true if the link was stacked, false otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean addStackedLink(LinkProperties link) {
if (link != null && link.getInterfaceName() != null) {
mStackedLinks.put(link.getInterfaceName(), link);
@@ -715,6 +744,7 @@
* Returns all the links stacked on top of this link.
* @hide
*/
+ @UnsupportedAppUsage
public @NonNull List<LinkProperties> getStackedLinks() {
if (mStackedLinks.isEmpty()) {
return Collections.emptyList();
@@ -730,6 +760,7 @@
* Clears this object to its initial state.
* @hide
*/
+ @UnsupportedAppUsage
public void clear() {
mIfaceName = null;
mLinkAddresses.clear();
@@ -831,6 +862,7 @@
* @return {@code true} if there is an IPv4 address, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasIPv4Address() {
for (LinkAddress address : mLinkAddresses) {
if (address.getAddress() instanceof Inet4Address) {
@@ -858,6 +890,7 @@
* @return {@code true} if there is a global preferred IPv6 address, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasGlobalIPv6Address() {
for (LinkAddress address : mLinkAddresses) {
if (address.getAddress() instanceof Inet6Address && address.isGlobalPreferred()) {
@@ -873,6 +906,7 @@
* @return {@code true} if there is an IPv4 default route, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasIPv4DefaultRoute() {
for (RouteInfo r : mRoutes) {
if (r.isIPv4Default()) {
@@ -888,6 +922,7 @@
* @return {@code true} if there is an IPv6 default route, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasIPv6DefaultRoute() {
for (RouteInfo r : mRoutes) {
if (r.isIPv6Default()) {
@@ -903,6 +938,7 @@
* @return {@code true} if there is an IPv4 DNS server, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasIPv4DnsServer() {
for (InetAddress ia : mDnses) {
if (ia instanceof Inet4Address) {
@@ -918,6 +954,7 @@
* @return {@code true} if there is an IPv6 DNS server, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasIPv6DnsServer() {
for (InetAddress ia : mDnses) {
if (ia instanceof Inet6Address) {
@@ -947,6 +984,7 @@
* @return {@code true} if the link is provisioned, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIPv6Provisioned() {
return (hasGlobalIPv6Address() &&
hasIPv6DefaultRoute() &&
@@ -960,6 +998,7 @@
* @return {@code true} if the link is provisioned, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isProvisioned() {
return (isIPv4Provisioned() || isIPv6Provisioned());
}
@@ -971,6 +1010,7 @@
* {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isReachable(InetAddress ip) {
final List<RouteInfo> allRoutes = getAllRoutes();
// If we don't have a route to this IP address, it's not reachable.
@@ -1008,6 +1048,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalInterfaceName(LinkProperties target) {
return TextUtils.equals(getInterfaceName(), target.getInterfaceName());
}
@@ -1019,6 +1060,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalAddresses(LinkProperties target) {
Collection<InetAddress> targetAddresses = target.getAddresses();
Collection<InetAddress> sourceAddresses = getAddresses();
@@ -1033,6 +1075,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalDnses(LinkProperties target) {
Collection<InetAddress> targetDnses = target.getDnsServers();
String targetDomains = target.getDomains();
@@ -1080,6 +1123,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalRoutes(LinkProperties target) {
Collection<RouteInfo> targetRoutes = target.getRoutes();
return (mRoutes.size() == targetRoutes.size()) ?
@@ -1093,6 +1137,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalHttpProxy(LinkProperties target) {
return getHttpProxy() == null ? target.getHttpProxy() == null :
getHttpProxy().equals(target.getHttpProxy());
@@ -1105,6 +1150,7 @@
* @return {@code true} if both are identical, {@code false} otherwise.
* @hide
*/
+ @UnsupportedAppUsage
public boolean isIdenticalStackedLinks(LinkProperties target) {
if (!mStackedLinks.keySet().equals(target.mStackedLinks.keySet())) {
return false;
diff --git a/core/java/android/net/LinkQualityInfo.java b/core/java/android/net/LinkQualityInfo.java
index 9c8e61d..b6f8825 100644
--- a/core/java/android/net/LinkQualityInfo.java
+++ b/core/java/android/net/LinkQualityInfo.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -189,6 +190,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setPacketCount(long packetCount) {
mPacketCount = packetCount;
}
@@ -204,6 +206,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setPacketErrorCount(long packetErrorCount) {
mPacketErrorCount = packetErrorCount;
}
@@ -265,6 +268,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLastDataSampleTime(long lastDataSampleTime) {
mLastDataSampleTime = lastDataSampleTime;
}
@@ -280,6 +284,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setDataSampleDuration(int dataSampleDuration) {
mDataSampleDuration = dataSampleDuration;
}
diff --git a/core/java/android/net/LocalSocket.java b/core/java/android/net/LocalSocket.java
index 8afa1ed..6a2031b 100644
--- a/core/java/android/net/LocalSocket.java
+++ b/core/java/android/net/LocalSocket.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import java.io.Closeable;
import java.io.FileDescriptor;
import java.io.IOException;
@@ -30,6 +31,7 @@
*/
public class LocalSocket implements Closeable {
+ @UnsupportedAppUsage
private final LocalSocketImpl impl;
/** false if impl.create() needs to be called */
private volatile boolean implCreated;
diff --git a/core/java/android/net/LocalSocketImpl.java b/core/java/android/net/LocalSocketImpl.java
index 6e4a231..fe7632c 100644
--- a/core/java/android/net/LocalSocketImpl.java
+++ b/core/java/android/net/LocalSocketImpl.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.system.ErrnoException;
import android.system.Int32Ref;
import android.system.Os;
@@ -47,8 +48,10 @@
// These fields are accessed by native code;
/** file descriptor array received during a previous read */
+ @UnsupportedAppUsage
FileDescriptor[] inboundFileDescriptors;
/** file descriptor array that should be written during next write */
+ @UnsupportedAppUsage
FileDescriptor[] outboundFileDescriptors;
/**
@@ -207,6 +210,7 @@
/**
* Create a new instance.
*/
+ @UnsupportedAppUsage
/*package*/ LocalSocketImpl()
{
}
diff --git a/core/java/android/net/MacAddress.java b/core/java/android/net/MacAddress.java
index 74d6470..98f3567 100644
--- a/core/java/android/net/MacAddress.java
+++ b/core/java/android/net/MacAddress.java
@@ -18,6 +18,7 @@
import android.annotation.IntDef;
import android.annotation.NonNull;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -50,6 +51,7 @@
* The MacAddress zero MAC address.
* @hide
*/
+ @UnsupportedAppUsage
public static final MacAddress ALL_ZEROS_ADDRESS = new MacAddress(0);
/** @hide */
diff --git a/core/java/android/net/MobileLinkQualityInfo.java b/core/java/android/net/MobileLinkQualityInfo.java
index a01fc80..06c739d 100644
--- a/core/java/android/net/MobileLinkQualityInfo.java
+++ b/core/java/android/net/MobileLinkQualityInfo.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
/**
@@ -93,6 +94,7 @@
* returns mobile network type as defined by {@link android.telephony.TelephonyManager}
* @return network type or {@link android.net.LinkQualityInfo#UNKNOWN_INT}
*/
+ @UnsupportedAppUsage
public int getMobileNetworkType() {
return mMobileNetworkType;
}
@@ -100,6 +102,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setMobileNetworkType(int mobileNetworkType) {
mMobileNetworkType = mobileNetworkType;
}
@@ -115,6 +118,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setRssi(int Rssi) {
mRssi = Rssi;
}
@@ -130,6 +134,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setGsmErrorRate(int gsmErrorRate) {
mGsmErrorRate = gsmErrorRate;
}
@@ -145,6 +150,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setCdmaDbm(int cdmaDbm) {
mCdmaDbm = cdmaDbm;
}
@@ -160,6 +166,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setCdmaEcio(int cdmaEcio) {
mCdmaEcio = cdmaEcio;
}
@@ -175,6 +182,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setEvdoDbm(int evdoDbm) {
mEvdoDbm = evdoDbm;
}
@@ -190,6 +198,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setEvdoEcio(int evdoEcio) {
mEvdoEcio = evdoEcio;
}
@@ -205,6 +214,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setEvdoSnr(int evdoSnr) {
mEvdoSnr = evdoSnr;
}
@@ -220,6 +230,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLteSignalStrength(int lteSignalStrength) {
mLteSignalStrength = lteSignalStrength;
}
@@ -235,6 +246,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLteRsrp(int lteRsrp) {
mLteRsrp = lteRsrp;
}
@@ -250,6 +262,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLteRsrq(int lteRsrq) {
mLteRsrq = lteRsrq;
}
@@ -265,6 +278,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLteRssnr(int lteRssnr) {
mLteRssnr = lteRssnr;
}
@@ -280,6 +294,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setLteCqi(int lteCqi) {
mLteCqi = lteCqi;
}
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java
index 512e35e..142023d 100644
--- a/core/java/android/net/Network.java
+++ b/core/java/android/net/Network.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.system.ErrnoException;
@@ -59,6 +60,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public final int netId;
// Objects used to perform per-network operations such as getSocketFactory
@@ -103,6 +105,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public Network(int netId) {
this.netId = netId;
}
diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java
index e6b3fa8..114b423 100644
--- a/core/java/android/net/NetworkAgent.java
+++ b/core/java/android/net/NetworkAgent.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.net.ConnectivityManager.PacketKeepalive;
import android.os.Bundle;
@@ -351,6 +352,7 @@
/**
* Called by the bearer code when it has new NetworkInfo data.
*/
+ @UnsupportedAppUsage
public void sendNetworkInfo(NetworkInfo networkInfo) {
queueOrSendMessage(EVENT_NETWORK_INFO_CHANGED, new NetworkInfo(networkInfo));
}
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 72b4bfd..fd1e5f2 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -19,6 +19,7 @@
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import android.annotation.UnsupportedAppUsage;
import android.net.ConnectivityManager.NetworkCallback;
import android.os.Parcel;
import android.os.Parcelable;
@@ -56,6 +57,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities() {
clearAll();
mNetworkCapabilities = DEFAULT_CAPABILITIES;
@@ -103,6 +105,7 @@
* Represents the network's capabilities. If any are specified they will be satisfied
* by any Network that matches all of them.
*/
+ @UnsupportedAppUsage
private long mNetworkCapabilities;
/**
@@ -371,6 +374,7 @@
* @return This NetworkCapabilities instance, to facilitate chaining.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities addCapability(@NetCapability int capability) {
checkValidCapability(capability);
mNetworkCapabilities |= 1 << capability;
@@ -407,6 +411,7 @@
* @return This NetworkCapabilities instance, to facilitate chaining.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities removeCapability(@NetCapability int capability) {
checkValidCapability(capability);
final long mask = ~(1 << capability);
@@ -659,6 +664,7 @@
* @return This NetworkCapabilities instance, to facilitate chaining.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities addTransportType(@Transport int transportType) {
checkValidTransportType(transportType);
mTransportTypes |= 1 << transportType;
@@ -898,6 +904,7 @@
* specifier. See {@link #setNetworkSpecifier}.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkSpecifier getNetworkSpecifier() {
return mNetworkSpecifier;
}
@@ -930,6 +937,7 @@
* Signal strength. This is a signed integer, and higher values indicate better signal.
* The exact units are bearer-dependent. For example, Wi-Fi uses RSSI.
*/
+ @UnsupportedAppUsage
private int mSignalStrength = SIGNAL_STRENGTH_UNSPECIFIED;
/**
@@ -945,6 +953,7 @@
* @param signalStrength the bearer-specific signal strength.
* @hide
*/
+ @UnsupportedAppUsage
public NetworkCapabilities setSignalStrength(int signalStrength) {
mSignalStrength = signalStrength;
return this;
@@ -955,6 +964,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasSignalStrength() {
return mSignalStrength > SIGNAL_STRENGTH_UNSPECIFIED;
}
@@ -965,6 +975,7 @@
* @return The bearer-specific signal strength.
* @hide
*/
+ @UnsupportedAppUsage
public int getSignalStrength() {
return mSignalStrength;
}
@@ -1544,6 +1555,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public static String transportNamesOf(@Transport int[] types) {
StringJoiner joiner = new StringJoiner("|");
if (types != null) {
diff --git a/core/java/android/net/NetworkFactory.java b/core/java/android/net/NetworkFactory.java
index e2f8d1a..010d72f 100644
--- a/core/java/android/net/NetworkFactory.java
+++ b/core/java/android/net/NetworkFactory.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
@@ -106,6 +107,7 @@
private int mRefCount = 0;
private Messenger mMessenger = null;
+ @UnsupportedAppUsage
public NetworkFactory(Looper looper, Context context, String logTag,
NetworkCapabilities filter) {
super(looper);
@@ -287,6 +289,7 @@
sendMessage(obtainMessage(CMD_CANCEL_REQUEST, networkRequest));
}
+ @UnsupportedAppUsage
public void setScoreFilter(int score) {
sendMessage(obtainMessage(CMD_SET_SCORE, score, 0));
}
@@ -304,6 +307,7 @@
Log.d(LOG_TAG, s);
}
+ @UnsupportedAppUsage
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
pw.println(toString());
diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java
index 999771a..d912dd10 100644
--- a/core/java/android/net/NetworkInfo.java
+++ b/core/java/android/net/NetworkInfo.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -129,6 +130,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public NetworkInfo(int type, int subtype, String typeName, String subtypeName) {
if (!ConnectivityManager.isNetworkTypeValid(type)
&& type != ConnectivityManager.TYPE_NONE) {
@@ -143,6 +145,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public NetworkInfo(NetworkInfo source) {
if (source != null) {
synchronized (source) {
@@ -209,6 +212,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public void setSubtype(int subtype, String subtypeName) {
synchronized (this) {
mSubtype = subtype;
@@ -317,6 +321,7 @@
* @hide
*/
@Deprecated
+ @UnsupportedAppUsage
public void setIsAvailable(boolean isAvailable) {
synchronized (this) {
mIsAvailable = isAvailable;
@@ -347,6 +352,7 @@
* @hide
*/
@Deprecated
+ @UnsupportedAppUsage
public void setFailover(boolean isFailover) {
synchronized (this) {
mIsFailover = isFailover;
@@ -377,6 +383,7 @@
*/
@VisibleForTesting
@Deprecated
+ @UnsupportedAppUsage
public void setRoaming(boolean isRoaming) {
synchronized (this) {
mIsRoaming = isRoaming;
@@ -422,6 +429,7 @@
* @hide
*/
@Deprecated
+ @UnsupportedAppUsage
public void setDetailedState(DetailedState detailedState, String reason, String extraInfo) {
synchronized (this) {
this.mDetailedState = detailedState;
diff --git a/core/java/android/net/NetworkPolicy.java b/core/java/android/net/NetworkPolicy.java
index e84c85e..f8973eb 100644
--- a/core/java/android/net/NetworkPolicy.java
+++ b/core/java/android/net/NetworkPolicy.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.BackupUtils;
@@ -49,14 +50,19 @@
public static final long LIMIT_DISABLED = -1;
public static final long SNOOZE_NEVER = -1;
+ @UnsupportedAppUsage
public NetworkTemplate template;
public RecurrenceRule cycleRule;
+ @UnsupportedAppUsage
public long warningBytes = WARNING_DISABLED;
+ @UnsupportedAppUsage
public long limitBytes = LIMIT_DISABLED;
public long lastWarningSnooze = SNOOZE_NEVER;
public long lastLimitSnooze = SNOOZE_NEVER;
public long lastRapidSnooze = SNOOZE_NEVER;
+ @UnsupportedAppUsage
@Deprecated public boolean metered = true;
+ @UnsupportedAppUsage
public boolean inferred = false;
private static final long DEFAULT_MTU = 1500;
@@ -77,6 +83,7 @@
}
@Deprecated
+ @UnsupportedAppUsage
public NetworkPolicy(NetworkTemplate template, int cycleDay, String cycleTimezone,
long warningBytes, long limitBytes, long lastWarningSnooze, long lastLimitSnooze,
boolean metered, boolean inferred) {
@@ -143,6 +150,7 @@
/**
* Test if given measurement is over {@link #warningBytes}.
*/
+ @UnsupportedAppUsage
public boolean isOverWarning(long totalBytes) {
return warningBytes != WARNING_DISABLED && totalBytes >= warningBytes;
}
@@ -151,6 +159,7 @@
* Test if given measurement is near enough to {@link #limitBytes} to be
* considered over-limit.
*/
+ @UnsupportedAppUsage
public boolean isOverLimit(long totalBytes) {
// over-estimate, since kernel will trigger limit once first packet
// trips over limit.
@@ -161,6 +170,7 @@
/**
* Clear any existing snooze values, setting to {@link #SNOOZE_NEVER}.
*/
+ @UnsupportedAppUsage
public void clearSnooze() {
lastWarningSnooze = SNOOZE_NEVER;
lastLimitSnooze = SNOOZE_NEVER;
@@ -175,6 +185,7 @@
}
@Override
+ @UnsupportedAppUsage
public int compareTo(NetworkPolicy another) {
if (another == null || another.limitBytes == LIMIT_DISABLED) {
// other value is missing or disabled; we win
@@ -225,6 +236,7 @@
.append("}").toString();
}
+ @UnsupportedAppUsage
public static final Creator<NetworkPolicy> CREATOR = new Creator<NetworkPolicy>() {
@Override
public NetworkPolicy createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkPolicyManager.java b/core/java/android/net/NetworkPolicyManager.java
index 75fd77e..d5fb2e7 100644
--- a/core/java/android/net/NetworkPolicyManager.java
+++ b/core/java/android/net/NetworkPolicyManager.java
@@ -19,6 +19,7 @@
import static android.content.pm.PackageManager.GET_SIGNATURES;
import android.annotation.SystemService;
+import android.annotation.UnsupportedAppUsage;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
@@ -121,6 +122,7 @@
public static final int OVERRIDE_CONGESTED = 1 << 1;
private final Context mContext;
+ @UnsupportedAppUsage
private INetworkPolicyManager mService;
public NetworkPolicyManager(Context context, INetworkPolicyManager service) {
@@ -131,6 +133,7 @@
mService = service;
}
+ @UnsupportedAppUsage
public static NetworkPolicyManager from(Context context) {
return (NetworkPolicyManager) context.getSystemService(Context.NETWORK_POLICY_SERVICE);
}
@@ -141,6 +144,7 @@
* @param policy should be {@link #POLICY_NONE} or any combination of {@code POLICY_} flags,
* although it is not validated.
*/
+ @UnsupportedAppUsage
public void setUidPolicy(int uid, int policy) {
try {
mService.setUidPolicy(uid, policy);
@@ -181,6 +185,7 @@
}
}
+ @UnsupportedAppUsage
public int getUidPolicy(int uid) {
try {
return mService.getUidPolicy(uid);
@@ -189,6 +194,7 @@
}
}
+ @UnsupportedAppUsage
public int[] getUidsWithPolicy(int policy) {
try {
return mService.getUidsWithPolicy(policy);
@@ -197,6 +203,7 @@
}
}
+ @UnsupportedAppUsage
public void registerListener(INetworkPolicyListener listener) {
try {
mService.registerListener(listener);
@@ -205,6 +212,7 @@
}
}
+ @UnsupportedAppUsage
public void unregisterListener(INetworkPolicyListener listener) {
try {
mService.unregisterListener(listener);
@@ -221,6 +229,7 @@
}
}
+ @UnsupportedAppUsage
public NetworkPolicy[] getNetworkPolicies() {
try {
return mService.getNetworkPolicies(mContext.getOpPackageName());
@@ -229,6 +238,7 @@
}
}
+ @UnsupportedAppUsage
public void setRestrictBackground(boolean restrictBackground) {
try {
mService.setRestrictBackground(restrictBackground);
@@ -237,6 +247,7 @@
}
}
+ @UnsupportedAppUsage
public boolean getRestrictBackground() {
try {
return mService.getRestrictBackground();
diff --git a/core/java/android/net/NetworkQuotaInfo.java b/core/java/android/net/NetworkQuotaInfo.java
index b95f1d9..e7182f7 100644
--- a/core/java/android/net/NetworkQuotaInfo.java
+++ b/core/java/android/net/NetworkQuotaInfo.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -36,14 +37,17 @@
public NetworkQuotaInfo(Parcel in) {
}
+ @UnsupportedAppUsage
public long getEstimatedBytes() {
return 0;
}
+ @UnsupportedAppUsage
public long getSoftLimitBytes() {
return NO_LIMIT;
}
+ @UnsupportedAppUsage
public long getHardLimitBytes() {
return NO_LIMIT;
}
@@ -57,6 +61,7 @@
public void writeToParcel(Parcel out, int flags) {
}
+ @UnsupportedAppUsage
public static final Creator<NetworkQuotaInfo> CREATOR = new Creator<NetworkQuotaInfo>() {
@Override
public NetworkQuotaInfo createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkRequest.java b/core/java/android/net/NetworkRequest.java
index 16c2342..04b6b44 100644
--- a/core/java/android/net/NetworkRequest.java
+++ b/core/java/android/net/NetworkRequest.java
@@ -17,6 +17,7 @@
package android.net;
import android.annotation.NonNull;
+import android.annotation.UnsupportedAppUsage;
import android.net.NetworkCapabilities.NetCapability;
import android.net.NetworkCapabilities.Transport;
import android.os.Parcel;
@@ -38,6 +39,7 @@
* The {@link NetworkCapabilities} that define this request.
* @hide
*/
+ @UnsupportedAppUsage
public final @NonNull NetworkCapabilities networkCapabilities;
/**
@@ -46,6 +48,7 @@
* the request.
* @hide
*/
+ @UnsupportedAppUsage
public final int requestId;
/**
@@ -53,6 +56,7 @@
* Causes CONNECTIVITY_ACTION broadcasts to be sent.
* @hide
*/
+ @UnsupportedAppUsage
public final int legacyType;
/**
@@ -241,6 +245,7 @@
* @return The builder to facilitate chaining.
* @hide
*/
+ @UnsupportedAppUsage
public Builder clearCapabilities() {
mNetworkCapabilities.clearAll();
return this;
@@ -339,6 +344,7 @@
* @param signalStrength the bearer-specific signal strength.
* @hide
*/
+ @UnsupportedAppUsage
public Builder setSignalStrength(int signalStrength) {
mNetworkCapabilities.setSignalStrength(signalStrength);
return this;
diff --git a/core/java/android/net/NetworkState.java b/core/java/android/net/NetworkState.java
index 321f971..c545ee2 100644
--- a/core/java/android/net/NetworkState.java
+++ b/core/java/android/net/NetworkState.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.Slog;
@@ -33,6 +34,7 @@
public final NetworkInfo networkInfo;
public final LinkProperties linkProperties;
public final NetworkCapabilities networkCapabilities;
+ @UnsupportedAppUsage
public final Network network;
public final String subscriberId;
public final String networkId;
@@ -58,6 +60,7 @@
}
}
+ @UnsupportedAppUsage
public NetworkState(Parcel in) {
networkInfo = in.readParcelable(null);
linkProperties = in.readParcelable(null);
@@ -82,6 +85,7 @@
out.writeString(networkId);
}
+ @UnsupportedAppUsage
public static final Creator<NetworkState> CREATOR = new Creator<NetworkState>() {
@Override
public NetworkState createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkStats.java b/core/java/android/net/NetworkStats.java
index edf9bc1..e270fc2 100644
--- a/core/java/android/net/NetworkStats.java
+++ b/core/java/android/net/NetworkStats.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
@@ -110,25 +111,43 @@
* generated.
*/
private long elapsedRealtime;
+ @UnsupportedAppUsage
private int size;
+ @UnsupportedAppUsage
private int capacity;
+ @UnsupportedAppUsage
private String[] iface;
+ @UnsupportedAppUsage
private int[] uid;
+ @UnsupportedAppUsage
private int[] set;
+ @UnsupportedAppUsage
private int[] tag;
+ @UnsupportedAppUsage
private int[] metered;
+ @UnsupportedAppUsage
private int[] roaming;
+ @UnsupportedAppUsage
private int[] defaultNetwork;
+ @UnsupportedAppUsage
private long[] rxBytes;
+ @UnsupportedAppUsage
private long[] rxPackets;
+ @UnsupportedAppUsage
private long[] txBytes;
+ @UnsupportedAppUsage
private long[] txPackets;
+ @UnsupportedAppUsage
private long[] operations;
public static class Entry {
+ @UnsupportedAppUsage
public String iface;
+ @UnsupportedAppUsage
public int uid;
+ @UnsupportedAppUsage
public int set;
+ @UnsupportedAppUsage
public int tag;
/**
* Note that this is only populated w/ the default value when read from /proc or written
@@ -148,12 +167,17 @@
* getSummary().
*/
public int defaultNetwork;
+ @UnsupportedAppUsage
public long rxBytes;
+ @UnsupportedAppUsage
public long rxPackets;
+ @UnsupportedAppUsage
public long txBytes;
+ @UnsupportedAppUsage
public long txPackets;
public long operations;
+ @UnsupportedAppUsage
public Entry() {
this(IFACE_ALL, UID_ALL, SET_DEFAULT, TAG_NONE, 0L, 0L, 0L, 0L, 0L);
}
@@ -240,6 +264,7 @@
}
}
+ @UnsupportedAppUsage
public NetworkStats(long elapsedRealtime, int initialSize) {
this.elapsedRealtime = elapsedRealtime;
this.size = 0;
@@ -263,6 +288,7 @@
}
}
+ @UnsupportedAppUsage
public NetworkStats(Parcel parcel) {
elapsedRealtime = parcel.readLong();
size = parcel.readInt();
@@ -399,6 +425,7 @@
/**
* Return specific stats entry.
*/
+ @UnsupportedAppUsage
public Entry getValues(int i, Entry recycle) {
final Entry entry = recycle != null ? recycle : new Entry();
entry.iface = iface[i];
@@ -432,6 +459,7 @@
return SystemClock.elapsedRealtime() - elapsedRealtime;
}
+ @UnsupportedAppUsage
public int size() {
return size;
}
@@ -460,6 +488,7 @@
* {@link #findIndex(String, int, int, int, int)} is unable to find match. Can
* also be used to subtract values from existing rows.
*/
+ @UnsupportedAppUsage
public NetworkStats combineValues(Entry entry) {
final int i = findIndex(entry.iface, entry.uid, entry.set, entry.tag, entry.metered,
entry.roaming, entry.defaultNetwork);
@@ -479,6 +508,7 @@
/**
* Combine all values from another {@link NetworkStats} into this object.
*/
+ @UnsupportedAppUsage
public void combineAllValues(NetworkStats another) {
NetworkStats.Entry entry = null;
for (int i = 0; i < another.size; i++) {
@@ -564,6 +594,7 @@
/**
* Return list of unique UIDs known by this data structure.
*/
+ @UnsupportedAppUsage
public int[] getUniqueUids() {
final SparseBooleanArray uids = new SparseBooleanArray();
for (int uid : this.uid) {
@@ -582,6 +613,7 @@
* Return total bytes represented by this snapshot object, usually used when
* checking if a {@link #subtract(NetworkStats)} delta passes a threshold.
*/
+ @UnsupportedAppUsage
public long getTotalBytes() {
final Entry entry = getTotal(null);
return entry.rxBytes + entry.txBytes;
@@ -590,6 +622,7 @@
/**
* Return total of all fields represented by this snapshot object.
*/
+ @UnsupportedAppUsage
public Entry getTotal(Entry recycle) {
return getTotal(recycle, null, UID_ALL, false);
}
@@ -598,6 +631,7 @@
* Return total of all fields represented by this snapshot object matching
* the requested {@link #uid}.
*/
+ @UnsupportedAppUsage
public Entry getTotal(Entry recycle, int limitUid) {
return getTotal(recycle, null, limitUid, false);
}
@@ -610,6 +644,7 @@
return getTotal(recycle, limitIface, UID_ALL, false);
}
+ @UnsupportedAppUsage
public Entry getTotalIncludingTags(Entry recycle) {
return getTotal(recycle, null, UID_ALL, true);
}
@@ -1085,6 +1120,7 @@
return 0;
}
+ @UnsupportedAppUsage
public static final Creator<NetworkStats> CREATOR = new Creator<NetworkStats>() {
@Override
public NetworkStats createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkStatsHistory.java b/core/java/android/net/NetworkStatsHistory.java
index a13ad65..d53e032 100644
--- a/core/java/android/net/NetworkStatsHistory.java
+++ b/core/java/android/net/NetworkStatsHistory.java
@@ -30,6 +30,7 @@
import static com.android.internal.util.ArrayUtils.total;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.service.NetworkStatsHistoryBucketProto;
@@ -89,16 +90,23 @@
public static class Entry {
public static final long UNKNOWN = -1;
+ @UnsupportedAppUsage
public long bucketDuration;
+ @UnsupportedAppUsage
public long bucketStart;
public long activeTime;
+ @UnsupportedAppUsage
public long rxBytes;
+ @UnsupportedAppUsage
public long rxPackets;
+ @UnsupportedAppUsage
public long txBytes;
+ @UnsupportedAppUsage
public long txPackets;
public long operations;
}
+ @UnsupportedAppUsage
public NetworkStatsHistory(long bucketDuration) {
this(bucketDuration, 10, FIELD_ALL);
}
@@ -125,6 +133,7 @@
recordEntireHistory(existing);
}
+ @UnsupportedAppUsage
public NetworkStatsHistory(Parcel in) {
bucketDuration = in.readLong();
bucketStart = readLongArray(in);
@@ -210,6 +219,7 @@
return 0;
}
+ @UnsupportedAppUsage
public int size() {
return bucketCount;
}
@@ -218,6 +228,7 @@
return bucketDuration;
}
+ @UnsupportedAppUsage
public long getStart() {
if (bucketCount > 0) {
return bucketStart[0];
@@ -226,6 +237,7 @@
}
}
+ @UnsupportedAppUsage
public long getEnd() {
if (bucketCount > 0) {
return bucketStart[bucketCount - 1] + bucketDuration;
@@ -245,6 +257,7 @@
* Return index of bucket that contains or is immediately before the
* requested time.
*/
+ @UnsupportedAppUsage
public int getIndexBefore(long time) {
int index = Arrays.binarySearch(bucketStart, 0, bucketCount, time);
if (index < 0) {
@@ -272,6 +285,7 @@
/**
* Return specific stats entry.
*/
+ @UnsupportedAppUsage
public Entry getValues(int i, Entry recycle) {
final Entry entry = recycle != null ? recycle : new Entry();
entry.bucketStart = bucketStart[i];
@@ -373,6 +387,7 @@
* Record an entire {@link NetworkStatsHistory} into this history. Usually
* for combining together stats for external reporting.
*/
+ @UnsupportedAppUsage
public void recordEntireHistory(NetworkStatsHistory input) {
recordHistory(input, Long.MIN_VALUE, Long.MAX_VALUE);
}
@@ -509,6 +524,7 @@
* Return interpolated data usage across the requested range. Interpolates
* across buckets, so values may be rounded slightly.
*/
+ @UnsupportedAppUsage
public Entry getValues(long start, long end, Entry recycle) {
return getValues(start, end, Long.MAX_VALUE, recycle);
}
@@ -517,6 +533,7 @@
* Return interpolated data usage across the requested range. Interpolates
* across buckets, so values may be rounded slightly.
*/
+ @UnsupportedAppUsage
public Entry getValues(long start, long end, long now, Entry recycle) {
final Entry entry = recycle != null ? recycle : new Entry();
entry.bucketDuration = end - start;
@@ -701,6 +718,7 @@
return writer.toString();
}
+ @UnsupportedAppUsage
public static final Creator<NetworkStatsHistory> CREATOR = new Creator<NetworkStatsHistory>() {
@Override
public NetworkStatsHistory createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java
index 74233fd..bb75c63 100644
--- a/core/java/android/net/NetworkTemplate.java
+++ b/core/java/android/net/NetworkTemplate.java
@@ -34,6 +34,7 @@
import static android.net.NetworkStats.ROAMING_YES;
import static android.net.wifi.WifiInfo.removeDoubleQuotes;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.BackupUtils;
@@ -96,6 +97,7 @@
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks with
* the given IMSI.
*/
+ @UnsupportedAppUsage
public static NetworkTemplate buildTemplateMobileAll(String subscriberId) {
return new NetworkTemplate(MATCH_MOBILE, subscriberId, null);
}
@@ -104,6 +106,7 @@
* Template to match {@link ConnectivityManager#TYPE_MOBILE} networks,
* regardless of IMSI.
*/
+ @UnsupportedAppUsage
public static NetworkTemplate buildTemplateMobileWildcard() {
return new NetworkTemplate(MATCH_MOBILE_WILDCARD, null, null);
}
@@ -112,11 +115,13 @@
* Template to match all {@link ConnectivityManager#TYPE_WIFI} networks,
* regardless of SSID.
*/
+ @UnsupportedAppUsage
public static NetworkTemplate buildTemplateWifiWildcard() {
return new NetworkTemplate(MATCH_WIFI_WILDCARD, null, null);
}
@Deprecated
+ @UnsupportedAppUsage
public static NetworkTemplate buildTemplateWifi() {
return buildTemplateWifiWildcard();
}
@@ -133,6 +138,7 @@
* Template to combine all {@link ConnectivityManager#TYPE_ETHERNET} style
* networks together.
*/
+ @UnsupportedAppUsage
public static NetworkTemplate buildTemplateEthernet() {
return new NetworkTemplate(MATCH_ETHERNET, null, null);
}
@@ -173,6 +179,7 @@
private final int mRoaming;
private final int mDefaultNetwork;
+ @UnsupportedAppUsage
public NetworkTemplate(int matchRule, String subscriberId, String networkId) {
this(matchRule, subscriberId, new String[] { subscriberId }, networkId);
}
@@ -293,10 +300,12 @@
}
}
+ @UnsupportedAppUsage
public int getMatchRule() {
return mMatchRule;
}
+ @UnsupportedAppUsage
public String getSubscriberId() {
return mSubscriberId;
}
@@ -460,6 +469,7 @@
* active merge set [A,B], we'd return a new template that primarily matches
* A, but also matches B.
*/
+ @UnsupportedAppUsage
public static NetworkTemplate normalize(NetworkTemplate template, String[] merged) {
if (template.isMatchRuleMobile() && ArrayUtils.contains(merged, template.mSubscriberId)) {
// Requested template subscriber is part of the merge group; return
@@ -471,6 +481,7 @@
}
}
+ @UnsupportedAppUsage
public static final Creator<NetworkTemplate> CREATOR = new Creator<NetworkTemplate>() {
@Override
public NetworkTemplate createFromParcel(Parcel in) {
diff --git a/core/java/android/net/NetworkUtils.java b/core/java/android/net/NetworkUtils.java
index dc1f805..599ccb2 100644
--- a/core/java/android/net/NetworkUtils.java
+++ b/core/java/android/net/NetworkUtils.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.util.Log;
import android.util.Pair;
@@ -43,6 +44,7 @@
/**
* Attaches a socket filter that accepts DHCP packets to the given socket.
*/
+ @UnsupportedAppUsage
public native static void attachDhcpFilter(FileDescriptor fd) throws SocketException;
/**
@@ -50,6 +52,7 @@
* @param fd the socket's {@link FileDescriptor}.
* @param packetType the hardware address type, one of ARPHRD_*.
*/
+ @UnsupportedAppUsage
public native static void attachRaFilter(FileDescriptor fd, int packetType) throws SocketException;
/**
@@ -60,6 +63,7 @@
* @param fd the socket's {@link FileDescriptor}.
* @param packetType the hardware address type, one of ARPHRD_*.
*/
+ @UnsupportedAppUsage
public native static void attachControlPacketFilter(FileDescriptor fd, int packetType)
throws SocketException;
@@ -108,6 +112,7 @@
* this socket will go directly to the underlying network, so its traffic will not be
* forwarded through the VPN.
*/
+ @UnsupportedAppUsage
public static boolean protectFromVpn(FileDescriptor fd) {
return protectFromVpn(fd.getInt$());
}
@@ -131,6 +136,7 @@
* or {@link #intToInet4AddressHTL(int)}
*/
@Deprecated
+ @UnsupportedAppUsage
public static InetAddress intToInetAddress(int hostAddress) {
return intToInet4AddressHTL(hostAddress);
}
@@ -209,6 +215,7 @@
* or {@link #prefixLengthToV4NetmaskIntHTL(int)}
*/
@Deprecated
+ @UnsupportedAppUsage
public static int prefixLengthToNetmaskInt(int prefixLength)
throws IllegalArgumentException {
return prefixLengthToV4NetmaskIntHTL(prefixLength);
@@ -255,6 +262,7 @@
* @throws IllegalArgumentException the specified netmask was not contiguous.
* @hide
*/
+ @UnsupportedAppUsage
public static int netmaskToPrefixLength(Inet4Address netmask) {
// inetAddressToInt returns an int in *network* byte order.
int i = Integer.reverseBytes(inetAddressToInt(netmask));
@@ -275,6 +283,7 @@
* @return the InetAddress
* @hide
*/
+ @UnsupportedAppUsage
public static InetAddress numericToInetAddress(String addrString)
throws IllegalArgumentException {
return InetAddress.parseNumericAddress(addrString);
@@ -349,6 +358,7 @@
/**
* Returns the implicit netmask of an IPv4 address, as was the custom before 1993.
*/
+ @UnsupportedAppUsage
public static int getImplicitNetmask(Inet4Address address) {
int firstByte = address.getAddress()[0] & 0xff; // Convert to an unsigned value.
if (firstByte < 128) {
@@ -439,6 +449,7 @@
* @param addr a string representing an ip addr
* @return a string propertly trimmed
*/
+ @UnsupportedAppUsage
public static String trimV4AddrZeros(String addr) {
if (addr == null) return null;
String[] octets = addr.split("\\.");
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java
index e3551b0..4600942 100644
--- a/core/java/android/net/Proxy.java
+++ b/core/java/android/net/Proxy.java
@@ -18,6 +18,7 @@
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
@@ -106,6 +107,7 @@
* A null value means that no host is to be used.
* {@hide}
*/
+ @UnsupportedAppUsage
public static final java.net.Proxy getProxy(Context ctx, String url) {
String host = "";
if ((url != null) && !isLocalHost(host)) {
@@ -239,6 +241,7 @@
}
/** @hide */
+ @UnsupportedAppUsage
public static final void setHttpProxySystemProperty(ProxyInfo p) {
String host = null;
String port = null;
diff --git a/core/java/android/net/ProxyInfo.java b/core/java/android/net/ProxyInfo.java
index 5f5e623..e926fda 100644
--- a/core/java/android/net/ProxyInfo.java
+++ b/core/java/android/net/ProxyInfo.java
@@ -17,6 +17,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -91,6 +92,7 @@
* Create a ProxyProperties that points at a HTTP Proxy.
* @hide
*/
+ @UnsupportedAppUsage
public ProxyInfo(String host, int port, String exclList) {
mHost = host;
mPort = port;
diff --git a/core/java/android/net/RouteInfo.java b/core/java/android/net/RouteInfo.java
index 90a2460..3e73d3d 100644
--- a/core/java/android/net/RouteInfo.java
+++ b/core/java/android/net/RouteInfo.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -55,6 +56,7 @@
/**
* The gateway address for this route.
*/
+ @UnsupportedAppUsage
private final InetAddress mGateway;
/**
@@ -79,6 +81,7 @@
// Derived data members.
// TODO: remove these.
+ @UnsupportedAppUsage
private final boolean mIsHost;
private final boolean mHasGateway;
@@ -160,6 +163,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public RouteInfo(IpPrefix destination, InetAddress gateway, String iface) {
this(destination, gateway, iface, RTN_UNICAST);
}
@@ -167,6 +171,7 @@
/**
* @hide
*/
+ @UnsupportedAppUsage
public RouteInfo(LinkAddress destination, InetAddress gateway, String iface) {
this(destination == null ? null :
new IpPrefix(destination.getAddress(), destination.getPrefixLength()),
@@ -197,6 +202,7 @@
*
* TODO: Remove this.
*/
+ @UnsupportedAppUsage
public RouteInfo(LinkAddress destination, InetAddress gateway) {
this(destination, gateway, null);
}
@@ -208,6 +214,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public RouteInfo(InetAddress gateway) {
this((IpPrefix) null, gateway, null);
}
@@ -258,6 +265,7 @@
}
}
+ @UnsupportedAppUsage
private boolean isHost() {
return (mDestination.getAddress() instanceof Inet4Address &&
mDestination.getPrefixLength() == 32) ||
@@ -355,6 +363,7 @@
* @return {@code true} if a gateway is specified
* @hide
*/
+ @UnsupportedAppUsage
public boolean hasGateway() {
return mHasGateway;
}
@@ -379,6 +388,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public static RouteInfo selectBestRoute(Collection<RouteInfo> routes, InetAddress dest) {
if ((routes == null) || (dest == null)) return null;
diff --git a/core/java/android/net/SSLCertificateSocketFactory.java b/core/java/android/net/SSLCertificateSocketFactory.java
index d7eb477..31494d9 100644
--- a/core/java/android/net/SSLCertificateSocketFactory.java
+++ b/core/java/android/net/SSLCertificateSocketFactory.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.SystemProperties;
import android.util.Log;
@@ -86,8 +87,10 @@
* requires root access.
*/
public class SSLCertificateSocketFactory extends SSLSocketFactory {
+ @UnsupportedAppUsage
private static final String TAG = "SSLCertificateSocketFactory";
+ @UnsupportedAppUsage
private static final TrustManager[] INSECURE_TRUST_MANAGER = new TrustManager[] {
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() { return null; }
@@ -96,16 +99,26 @@
}
};
+ @UnsupportedAppUsage
private SSLSocketFactory mInsecureFactory = null;
+ @UnsupportedAppUsage
private SSLSocketFactory mSecureFactory = null;
+ @UnsupportedAppUsage
private TrustManager[] mTrustManagers = null;
+ @UnsupportedAppUsage
private KeyManager[] mKeyManagers = null;
+ @UnsupportedAppUsage
private byte[] mNpnProtocols = null;
+ @UnsupportedAppUsage
private byte[] mAlpnProtocols = null;
+ @UnsupportedAppUsage
private PrivateKey mChannelIdPrivateKey = null;
+ @UnsupportedAppUsage
private final int mHandshakeTimeoutMillis;
+ @UnsupportedAppUsage
private final SSLClientSessionCache mSessionCache;
+ @UnsupportedAppUsage
private final boolean mSecure;
/** @deprecated Use {@link #getDefault(int)} instead. */
@@ -114,6 +127,7 @@
this(handshakeTimeoutMillis, null, true);
}
+ @UnsupportedAppUsage
private SSLCertificateSocketFactory(
int handshakeTimeoutMillis, SSLSessionCache cache, boolean secure) {
mHandshakeTimeoutMillis = handshakeTimeoutMillis;
@@ -201,6 +215,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public static void verifyHostname(Socket socket, String hostname) throws IOException {
if (!(socket instanceof SSLSocket)) {
throw new IllegalArgumentException("Attempt to verify non-SSL socket");
@@ -222,6 +237,7 @@
}
}
+ @UnsupportedAppUsage
private SSLSocketFactory makeSocketFactory(
KeyManager[] keyManagers, TrustManager[] trustManagers) {
try {
@@ -235,11 +251,13 @@
}
}
+ @UnsupportedAppUsage
private static boolean isSslCheckRelaxed() {
return RoSystemProperties.DEBUGGABLE &&
SystemProperties.getBoolean("socket.relaxsslcheck", false);
}
+ @UnsupportedAppUsage
private synchronized SSLSocketFactory getDelegate() {
// Relax the SSL check if instructed (for this factory, or systemwide)
if (!mSecure || isSslCheckRelaxed()) {
@@ -311,6 +329,7 @@
* must be non-empty and of length less than 256.
* @hide
*/
+ @UnsupportedAppUsage
public void setAlpnProtocols(byte[][] protocols) {
this.mAlpnProtocols = toLengthPrefixedList(protocols);
}
@@ -365,6 +384,7 @@
* @throws IllegalArgumentException if the socket was not created by this factory.
* @hide
*/
+ @UnsupportedAppUsage
public byte[] getAlpnSelectedProtocol(Socket socket) {
return castToOpenSSLSocket(socket).getAlpnSelectedProtocol();
}
@@ -390,6 +410,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public void setChannelIdPrivateKey(PrivateKey privateKey) {
mChannelIdPrivateKey = privateKey;
}
@@ -429,11 +450,13 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public void setSoWriteTimeout(Socket socket, int writeTimeoutMilliseconds)
throws SocketException {
castToOpenSSLSocket(socket).setSoWriteTimeout(writeTimeoutMilliseconds);
}
+ @UnsupportedAppUsage
private static OpenSSLSocketImpl castToOpenSSLSocket(Socket socket) {
if (!(socket instanceof OpenSSLSocketImpl)) {
throw new IllegalArgumentException("Socket not created by this factory: "
diff --git a/core/java/android/net/SSLSessionCache.java b/core/java/android/net/SSLSessionCache.java
index 65db2c3..9667e82 100644
--- a/core/java/android/net/SSLSessionCache.java
+++ b/core/java/android/net/SSLSessionCache.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.util.Log;
@@ -39,6 +40,7 @@
*/
public final class SSLSessionCache {
private static final String TAG = "SSLSessionCache";
+ @UnsupportedAppUsage
/* package */ final SSLClientSessionCache mSessionCache;
/**
diff --git a/core/java/android/net/SntpClient.java b/core/java/android/net/SntpClient.java
index ddf63ca..10c0ce2 100644
--- a/core/java/android/net/SntpClient.java
+++ b/core/java/android/net/SntpClient.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.SystemClock;
import android.util.Log;
@@ -175,6 +176,7 @@
}
@Deprecated
+ @UnsupportedAppUsage
public boolean requestTime(String host, int timeout) {
Log.w(TAG, "Shame on you for calling the hidden API requestTime()!");
return false;
@@ -185,6 +187,7 @@
*
* @return time value computed from NTP server response.
*/
+ @UnsupportedAppUsage
public long getNtpTime() {
return mNtpTime;
}
@@ -195,6 +198,7 @@
*
* @return reference clock corresponding to the NTP time.
*/
+ @UnsupportedAppUsage
public long getNtpTimeReference() {
return mNtpTimeReference;
}
@@ -204,6 +208,7 @@
*
* @return round trip time in milliseconds.
*/
+ @UnsupportedAppUsage
public long getRoundTripTime() {
return mRoundTripTime;
}
diff --git a/core/java/android/net/StaticIpConfiguration.java b/core/java/android/net/StaticIpConfiguration.java
index 58b1b88..3aa56b9 100644
--- a/core/java/android/net/StaticIpConfiguration.java
+++ b/core/java/android/net/StaticIpConfiguration.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.net.LinkAddress;
import android.os.Parcelable;
import android.os.Parcel;
@@ -46,11 +47,16 @@
* @hide
*/
public class StaticIpConfiguration implements Parcelable {
+ @UnsupportedAppUsage
public LinkAddress ipAddress;
+ @UnsupportedAppUsage
public InetAddress gateway;
+ @UnsupportedAppUsage
public final ArrayList<InetAddress> dnsServers;
+ @UnsupportedAppUsage
public String domains;
+ @UnsupportedAppUsage
public StaticIpConfiguration() {
dnsServers = new ArrayList<InetAddress>();
}
@@ -80,6 +86,7 @@
* route to the gateway as well. This configuration is arguably invalid, but it used to work
* in K and earlier, and other OSes appear to accept it.
*/
+ @UnsupportedAppUsage
public List<RouteInfo> getRoutes(String iface) {
List<RouteInfo> routes = new ArrayList<RouteInfo>(3);
if (ipAddress != null) {
diff --git a/core/java/android/net/StringNetworkSpecifier.java b/core/java/android/net/StringNetworkSpecifier.java
index cb7f6bf..b5d12f9 100644
--- a/core/java/android/net/StringNetworkSpecifier.java
+++ b/core/java/android/net/StringNetworkSpecifier.java
@@ -16,6 +16,7 @@
package android.net;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -29,6 +30,7 @@
/**
* Arbitrary string used to pass (additional) information to the network factory.
*/
+ @UnsupportedAppUsage
public final String specifier;
public StringNetworkSpecifier(String specifier) {
diff --git a/core/java/android/net/TrafficStats.java b/core/java/android/net/TrafficStats.java
index 40d53b7..44f7e48 100644
--- a/core/java/android/net/TrafficStats.java
+++ b/core/java/android/net/TrafficStats.java
@@ -19,6 +19,7 @@
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.TestApi;
+import android.annotation.UnsupportedAppUsage;
import android.app.DownloadManager;
import android.app.backup.BackupManager;
import android.app.usage.NetworkStatsManager;
@@ -141,6 +142,7 @@
private static INetworkStatsService sStatsService;
+ @UnsupportedAppUsage
private synchronized static INetworkStatsService getStatsService() {
if (sStatsService == null) {
sStatsService = INetworkStatsService.Stub.asInterface(
@@ -528,6 +530,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public static long getMobileTcpRxPackets() {
long total = 0;
for (String iface : getMobileIfaces()) {
@@ -543,6 +546,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public static long getMobileTcpTxPackets() {
long total = 0;
for (String iface : getMobileIfaces()) {
@@ -576,6 +580,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public static long getTxBytes(String iface) {
try {
return getStatsService().getIfaceStats(iface, TYPE_TX_BYTES);
@@ -585,6 +590,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public static long getRxBytes(String iface) {
try {
return getStatsService().getIfaceStats(iface, TYPE_RX_BYTES);
@@ -940,6 +946,7 @@
* Interfaces are never removed from this list, so counters should always be
* monotonic.
*/
+ @UnsupportedAppUsage
private static String[] getMobileIfaces() {
try {
return getStatsService().getMobileIfaces();
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index b7f5cdf..9bcc600 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -17,6 +17,7 @@
package android.net;
import android.annotation.Nullable;
+import android.annotation.UnsupportedAppUsage;
import android.content.Intent;
import android.os.Environment;
import android.os.Parcel;
@@ -133,6 +134,7 @@
/**
* Prevents external subclassing.
*/
+ @UnsupportedAppUsage
private Uri() {}
/**
@@ -376,6 +378,7 @@
* to logs and other places where PII should be avoided.
* @hide
*/
+ @UnsupportedAppUsage
public String toSafeString() {
String scheme = getScheme();
String ssp = getSchemeSpecificPart();
@@ -2331,6 +2334,7 @@
*
* @hide
*/
+ @UnsupportedAppUsage
public Uri getCanonicalUri() {
if ("file".equals(getScheme())) {
final String canonicalPath;
diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java
index 712576f..f0c0462 100644
--- a/core/java/android/net/VpnService.java
+++ b/core/java/android/net/VpnService.java
@@ -21,6 +21,7 @@
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
+import android.annotation.UnsupportedAppUsage;
import android.app.Activity;
import android.app.PendingIntent;
import android.app.Service;
@@ -440,7 +441,9 @@
public class Builder {
private final VpnConfig mConfig = new VpnConfig();
+ @UnsupportedAppUsage
private final List<LinkAddress> mAddresses = new ArrayList<LinkAddress>();
+ @UnsupportedAppUsage
private final List<RouteInfo> mRoutes = new ArrayList<RouteInfo>();
public Builder() {
diff --git a/core/java/android/net/WebAddress.java b/core/java/android/net/WebAddress.java
index 24d4eb8..8026d76 100644
--- a/core/java/android/net/WebAddress.java
+++ b/core/java/android/net/WebAddress.java
@@ -19,6 +19,7 @@
import static android.util.Patterns.GOOD_IRI_CHAR;
import android.annotation.SystemApi;
+import android.annotation.UnsupportedAppUsage;
import java.util.Locale;
import java.util.regex.Matcher;
@@ -45,9 +46,13 @@
@SystemApi
public class WebAddress {
+ @UnsupportedAppUsage
private String mScheme;
+ @UnsupportedAppUsage
private String mHost;
+ @UnsupportedAppUsage
private int mPort;
+ @UnsupportedAppUsage
private String mPath;
private String mAuthInfo;
@@ -147,16 +152,19 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public String getScheme() {
return mScheme;
}
/** {@hide} */
+ @UnsupportedAppUsage
public void setHost(String host) {
mHost = host;
}
/** {@hide} */
+ @UnsupportedAppUsage
public String getHost() {
return mHost;
}
@@ -167,16 +175,19 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public int getPort() {
return mPort;
}
/** {@hide} */
+ @UnsupportedAppUsage
public void setPath(String path) {
mPath = path;
}
/** {@hide} */
+ @UnsupportedAppUsage
public String getPath() {
return mPath;
}
@@ -187,6 +198,7 @@
}
/** {@hide} */
+ @UnsupportedAppUsage
public String getAuthInfo() {
return mAuthInfo;
}
diff --git a/core/java/android/net/http/SslCertificate.java b/core/java/android/net/http/SslCertificate.java
index 21ada36..6fcd6eb 100644
--- a/core/java/android/net/http/SslCertificate.java
+++ b/core/java/android/net/http/SslCertificate.java
@@ -16,6 +16,7 @@
package android.net.http;
+import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.Bundle;
import android.text.format.DateFormat;
@@ -77,6 +78,7 @@
* be available, and saveState and restoreState can be simplified
* to be unconditional.
*/
+ @UnsupportedAppUsage
private final X509Certificate mX509Certificate;
/**
@@ -257,6 +259,7 @@
/**
* Convenience for UI presentation, not intended as public API.
*/
+ @UnsupportedAppUsage
private static String getSerialNumber(X509Certificate x509Certificate) {
if (x509Certificate == null) {
return "";
@@ -271,6 +274,7 @@
/**
* Convenience for UI presentation, not intended as public API.
*/
+ @UnsupportedAppUsage
private static String getDigest(X509Certificate x509Certificate, String algorithm) {
if (x509Certificate == null) {
return "";
@@ -454,6 +458,7 @@
*
* @hide Used by Browser and Settings
*/
+ @UnsupportedAppUsage
public View inflateCertificateView(Context context) {
LayoutInflater factory = LayoutInflater.from(context);
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 1cd73d2..fad6689 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -16,6 +16,7 @@
package android.net.http;
+import android.annotation.UnsupportedAppUsage;
import java.security.cert.X509Certificate;
/**
@@ -67,16 +68,19 @@
* The SSL error set bitfield (each individual error is a bit index;
* multiple individual errors can be OR-ed)
*/
+ @UnsupportedAppUsage
int mErrors;
/**
* The SSL certificate associated with the error set
*/
+ @UnsupportedAppUsage
final SslCertificate mCertificate;
/**
* The URL associated with the error set.
*/
+ @UnsupportedAppUsage
final String mUrl;
/**
diff --git a/core/java/android/net/metrics/ApfProgramEvent.java b/core/java/android/net/metrics/ApfProgramEvent.java
index ad4588f..5dabf35 100644
--- a/core/java/android/net/metrics/ApfProgramEvent.java
+++ b/core/java/android/net/metrics/ApfProgramEvent.java
@@ -17,6 +17,7 @@
package android.net.metrics;
import android.annotation.IntDef;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -47,13 +48,20 @@
@Retention(RetentionPolicy.SOURCE)
public @interface Flags {}
+ @UnsupportedAppUsage
public long lifetime; // Maximum computed lifetime of the program in seconds
+ @UnsupportedAppUsage
public long actualLifetime; // Effective program lifetime in seconds
+ @UnsupportedAppUsage
public int filteredRas; // Number of RAs filtered by the APF program
+ @UnsupportedAppUsage
public int currentRas; // Total number of current RAs at generation time
+ @UnsupportedAppUsage
public int programLength; // Length of the APF program in bytes
+ @UnsupportedAppUsage
public int flags; // Bitfield compound of FLAG_* constants
+ @UnsupportedAppUsage
public ApfProgramEvent() {
}
@@ -99,6 +107,7 @@
}
};
+ @UnsupportedAppUsage
public static @Flags int flagsFor(boolean hasIPv4, boolean multicastFilterOn) {
int bitfield = 0;
if (hasIPv4) {
diff --git a/core/java/android/net/metrics/ApfStats.java b/core/java/android/net/metrics/ApfStats.java
index 76a781d..bb2a35c 100644
--- a/core/java/android/net/metrics/ApfStats.java
+++ b/core/java/android/net/metrics/ApfStats.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -26,26 +27,37 @@
public final class ApfStats implements Parcelable {
/** time interval in milliseconds these stastistics covers. */
+ @UnsupportedAppUsage
public long durationMs;
/** number of received RAs. */
+ @UnsupportedAppUsage
public int receivedRas;
/** number of received RAs matching a known RA. */
+ @UnsupportedAppUsage
public int matchingRas;
/** number of received RAs ignored due to the MAX_RAS limit. */
+ @UnsupportedAppUsage
public int droppedRas;
/** number of received RAs with a minimum lifetime of 0. */
+ @UnsupportedAppUsage
public int zeroLifetimeRas;
/** number of received RAs that could not be parsed. */
+ @UnsupportedAppUsage
public int parseErrors;
/** number of APF program updates from receiving RAs.. */
+ @UnsupportedAppUsage
public int programUpdates;
/** total number of APF program updates. */
+ @UnsupportedAppUsage
public int programUpdatesAll;
/** number of APF program updates from allowing multicast traffic. */
+ @UnsupportedAppUsage
public int programUpdatesAllowingMulticast;
/** maximum APF program size advertised by hardware. */
+ @UnsupportedAppUsage
public int maxProgramSize;
+ @UnsupportedAppUsage
public ApfStats() {
}
diff --git a/core/java/android/net/metrics/DhcpClientEvent.java b/core/java/android/net/metrics/DhcpClientEvent.java
index c5b78a5..98a7d7e 100644
--- a/core/java/android/net/metrics/DhcpClientEvent.java
+++ b/core/java/android/net/metrics/DhcpClientEvent.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -34,6 +35,7 @@
public final String msg;
public final int durationMs;
+ @UnsupportedAppUsage
public DhcpClientEvent(String msg, int durationMs) {
this.msg = msg;
this.durationMs = durationMs;
diff --git a/core/java/android/net/metrics/DhcpErrorEvent.java b/core/java/android/net/metrics/DhcpErrorEvent.java
index 8b77197..c6c06f0 100644
--- a/core/java/android/net/metrics/DhcpErrorEvent.java
+++ b/core/java/android/net/metrics/DhcpErrorEvent.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;
@@ -33,25 +34,41 @@
public static final int DHCP_ERROR = 4;
public static final int MISC_ERROR = 5;
+ @UnsupportedAppUsage
public static final int L2_TOO_SHORT = makeErrorCode(L2_ERROR, 1);
+ @UnsupportedAppUsage
public static final int L2_WRONG_ETH_TYPE = makeErrorCode(L2_ERROR, 2);
+ @UnsupportedAppUsage
public static final int L3_TOO_SHORT = makeErrorCode(L3_ERROR, 1);
+ @UnsupportedAppUsage
public static final int L3_NOT_IPV4 = makeErrorCode(L3_ERROR, 2);
+ @UnsupportedAppUsage
public static final int L3_INVALID_IP = makeErrorCode(L3_ERROR, 3);
+ @UnsupportedAppUsage
public static final int L4_NOT_UDP = makeErrorCode(L4_ERROR, 1);
+ @UnsupportedAppUsage
public static final int L4_WRONG_PORT = makeErrorCode(L4_ERROR, 2);
+ @UnsupportedAppUsage
public static final int BOOTP_TOO_SHORT = makeErrorCode(DHCP_ERROR, 1);
+ @UnsupportedAppUsage
public static final int DHCP_BAD_MAGIC_COOKIE = makeErrorCode(DHCP_ERROR, 2);
+ @UnsupportedAppUsage
public static final int DHCP_INVALID_OPTION_LENGTH = makeErrorCode(DHCP_ERROR, 3);
+ @UnsupportedAppUsage
public static final int DHCP_NO_MSG_TYPE = makeErrorCode(DHCP_ERROR, 4);
+ @UnsupportedAppUsage
public static final int DHCP_UNKNOWN_MSG_TYPE = makeErrorCode(DHCP_ERROR, 5);
+ @UnsupportedAppUsage
public static final int DHCP_NO_COOKIE = makeErrorCode(DHCP_ERROR, 6);
+ @UnsupportedAppUsage
public static final int BUFFER_UNDERFLOW = makeErrorCode(MISC_ERROR, 1);
+ @UnsupportedAppUsage
public static final int RECEIVE_ERROR = makeErrorCode(MISC_ERROR, 2);
+ @UnsupportedAppUsage
public static final int PARSING_ERROR = makeErrorCode(MISC_ERROR, 3);
// error code byte format (MSB to LSB):
@@ -61,6 +78,7 @@
// byte 3: optional code
public final int errorCode;
+ @UnsupportedAppUsage
public DhcpErrorEvent(int errorCode) {
this.errorCode = errorCode;
}
@@ -90,6 +108,7 @@
}
};
+ @UnsupportedAppUsage
public static int errorCodeWithOption(int errorCode, int option) {
return (0xFFFF0000 & errorCode) | (0xFF & option);
}
diff --git a/core/java/android/net/metrics/IpConnectivityLog.java b/core/java/android/net/metrics/IpConnectivityLog.java
index 4e57efa..998f4ba 100644
--- a/core/java/android/net/metrics/IpConnectivityLog.java
+++ b/core/java/android/net/metrics/IpConnectivityLog.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.net.ConnectivityMetricsEvent;
import android.net.IIpConnectivityMetrics;
import android.os.Parcelable;
@@ -37,6 +38,7 @@
private IIpConnectivityMetrics mService;
+ @UnsupportedAppUsage
public IpConnectivityLog() {
}
@@ -104,6 +106,7 @@
* @param data is a Parcelable instance representing the event.
* @return true if the event was successfully logged.
*/
+ @UnsupportedAppUsage
public boolean log(String ifname, Parcelable data) {
ConnectivityMetricsEvent ev = makeEv(data);
ev.ifname = ifname;
@@ -130,6 +133,7 @@
* @param data is a Parcelable instance representing the event.
* @return true if the event was successfully logged.
*/
+ @UnsupportedAppUsage
public boolean log(Parcelable data) {
return log(makeEv(data));
}
diff --git a/core/java/android/net/metrics/IpManagerEvent.java b/core/java/android/net/metrics/IpManagerEvent.java
index f8a63ce..c47650f 100644
--- a/core/java/android/net/metrics/IpManagerEvent.java
+++ b/core/java/android/net/metrics/IpManagerEvent.java
@@ -17,6 +17,7 @@
package android.net.metrics;
import android.annotation.IntDef;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;
@@ -53,6 +54,7 @@
public final @EventType int eventType;
public final long durationMs;
+ @UnsupportedAppUsage
public IpManagerEvent(@EventType int eventType, long duration) {
this.eventType = eventType;
this.durationMs = duration;
diff --git a/core/java/android/net/metrics/IpReachabilityEvent.java b/core/java/android/net/metrics/IpReachabilityEvent.java
index 019c2c5..715c95e 100644
--- a/core/java/android/net/metrics/IpReachabilityEvent.java
+++ b/core/java/android/net/metrics/IpReachabilityEvent.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;
@@ -48,6 +49,7 @@
// byte 3: when byte 2 == PROBE, errno code from RTNetlink or IpReachabilityMonitor.
public final int eventType;
+ @UnsupportedAppUsage
public IpReachabilityEvent(int eventType) {
this.eventType = eventType;
}
@@ -80,6 +82,7 @@
/**
* Returns the NUD failure event type code corresponding to the given conditions.
*/
+ @UnsupportedAppUsage
public static int nudFailureEventType(boolean isFromProbe, boolean isProvisioningLost) {
if (isFromProbe) {
return isProvisioningLost ? PROVISIONING_LOST : NUD_FAILED;
diff --git a/core/java/android/net/metrics/RaEvent.java b/core/java/android/net/metrics/RaEvent.java
index 3249f80..c41881c 100644
--- a/core/java/android/net/metrics/RaEvent.java
+++ b/core/java/android/net/metrics/RaEvent.java
@@ -16,6 +16,7 @@
package android.net.metrics;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcel;
import android.os.Parcelable;
@@ -101,39 +102,47 @@
long rdnssLifetime = NO_LIFETIME;
long dnsslLifetime = NO_LIFETIME;
+ @UnsupportedAppUsage
public Builder() {
}
+ @UnsupportedAppUsage
public RaEvent build() {
return new RaEvent(routerLifetime, prefixValidLifetime, prefixPreferredLifetime,
routeInfoLifetime, rdnssLifetime, dnsslLifetime);
}
+ @UnsupportedAppUsage
public Builder updateRouterLifetime(long lifetime) {
routerLifetime = updateLifetime(routerLifetime, lifetime);
return this;
}
+ @UnsupportedAppUsage
public Builder updatePrefixValidLifetime(long lifetime) {
prefixValidLifetime = updateLifetime(prefixValidLifetime, lifetime);
return this;
}
+ @UnsupportedAppUsage
public Builder updatePrefixPreferredLifetime(long lifetime) {
prefixPreferredLifetime = updateLifetime(prefixPreferredLifetime, lifetime);
return this;
}
+ @UnsupportedAppUsage
public Builder updateRouteInfoLifetime(long lifetime) {
routeInfoLifetime = updateLifetime(routeInfoLifetime, lifetime);
return this;
}
+ @UnsupportedAppUsage
public Builder updateRdnssLifetime(long lifetime) {
rdnssLifetime = updateLifetime(rdnssLifetime, lifetime);
return this;
}
+ @UnsupportedAppUsage
public Builder updateDnsslLifetime(long lifetime) {
dnsslLifetime = updateLifetime(dnsslLifetime, lifetime);
return this;
diff --git a/core/java/android/net/nsd/NsdServiceInfo.java b/core/java/android/net/nsd/NsdServiceInfo.java
index bccaf60..9ba17ed 100644
--- a/core/java/android/net/nsd/NsdServiceInfo.java
+++ b/core/java/android/net/nsd/NsdServiceInfo.java
@@ -17,6 +17,7 @@
package android.net.nsd;
import android.annotation.NonNull;
+import android.annotation.UnsupportedAppUsage;
import android.os.Parcelable;
import android.os.Parcel;
import android.text.TextUtils;
@@ -185,6 +186,7 @@
}
/** @hide */
+ @UnsupportedAppUsage
public void setAttribute(String key, byte[] value) {
if (TextUtils.isEmpty(key)) {
throw new IllegalArgumentException("Key cannot be empty");