Merge "Add NetworkUtils utilities to SystemApi"

am: 9cc31061fe

Change-Id: I82f20718d86b08cd0916ee33300ca0ee734305a6
This commit is contained in:
Remi NGUYEN VAN
2019-01-29 03:17:41 -08:00
committed by android-build-merger
5 changed files with 14 additions and 3 deletions

View File

@@ -104,6 +104,8 @@ public final class IpPrefix implements Parcelable {
* *
* @hide * @hide
*/ */
@SystemApi
@TestApi
public IpPrefix(String prefix) { public IpPrefix(String prefix) {
// We don't reuse the (InetAddress, int) constructor because "error: call to this must be // We don't reuse the (InetAddress, int) constructor because "error: call to this must be
// first statement in constructor". We could factor out setting the member variables to an // first statement in constructor". We could factor out setting the member variables to an

View File

@@ -176,6 +176,7 @@ public class LinkAddress implements Parcelable {
* @hide * @hide
*/ */
@SystemApi @SystemApi
@TestApi
public LinkAddress(InetAddress address, int prefixLength) { public LinkAddress(InetAddress address, int prefixLength) {
this(address, prefixLength, 0, 0); this(address, prefixLength, 0, 0);
this.scope = scopeForUnicastAddress(address); this.scope = scopeForUnicastAddress(address);
@@ -199,6 +200,7 @@ public class LinkAddress implements Parcelable {
* @hide * @hide
*/ */
@SystemApi @SystemApi
@TestApi
public LinkAddress(String address) { public LinkAddress(String address) {
this(address, 0, 0); this(address, 0, 0);
this.scope = scopeForUnicastAddress(this.address); this.scope = scopeForUnicastAddress(this.address);
@@ -212,6 +214,8 @@ public class LinkAddress implements Parcelable {
* @param scope The address scope. * @param scope The address scope.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public LinkAddress(String address, int flags, int scope) { public LinkAddress(String address, int flags, int scope) {
// This may throw an IllegalArgumentException; catching it is the caller's responsibility. // This may throw an IllegalArgumentException; catching it is the caller's responsibility.
// TODO: consider rejecting mapped IPv4 addresses such as "::ffff:192.0.2.5/24". // TODO: consider rejecting mapped IPv4 addresses such as "::ffff:192.0.2.5/24".

View File

@@ -287,7 +287,8 @@ public final class LinkProperties implements Parcelable {
* @return true if {@code address} was added or updated, false otherwise. * @return true if {@code address} was added or updated, false otherwise.
* @hide * @hide
*/ */
@UnsupportedAppUsage @SystemApi
@TestApi
public boolean addLinkAddress(LinkAddress address) { public boolean addLinkAddress(LinkAddress address) {
if (address == null) { if (address == null) {
return false; return false;
@@ -315,6 +316,8 @@ public final class LinkProperties implements Parcelable {
* @return true if the address was removed, false if it did not exist. * @return true if the address was removed, false if it did not exist.
* @hide * @hide
*/ */
@SystemApi
@TestApi
public boolean removeLinkAddress(LinkAddress toRemove) { public boolean removeLinkAddress(LinkAddress toRemove) {
int i = findLinkAddressIndex(toRemove); int i = findLinkAddressIndex(toRemove);
if (i >= 0) { if (i >= 0) {

View File

@@ -123,6 +123,8 @@ public class Network implements Parcelable {
/** /**
* @hide * @hide
*/ */
@SystemApi
@TestApi
public Network(Network that) { public Network(Network that) {
this(that.netId, that.mPrivateDnsBypass); this(that.netId, that.mPrivateDnsBypass);
} }

View File

@@ -81,14 +81,14 @@ public class ApfCapabilities {
/** /**
* @return Whether the APF Filter in the device should filter out IEEE 802.3 Frames. * @return Whether the APF Filter in the device should filter out IEEE 802.3 Frames.
*/ */
public boolean getApfDrop8023Frames(Context context) { public static boolean getApfDrop8023Frames(Context context) {
return context.getResources().getBoolean(R.bool.config_apfDrop802_3Frames); return context.getResources().getBoolean(R.bool.config_apfDrop802_3Frames);
} }
/** /**
* @return An array of blacklisted EtherType, packets with EtherTypes within it will be dropped. * @return An array of blacklisted EtherType, packets with EtherTypes within it will be dropped.
*/ */
public int[] getApfEthTypeBlackList(Context context) { public static int[] getApfEthTypeBlackList(Context context) {
return context.getResources().getIntArray(R.array.config_apfEthTypeBlackList); return context.getResources().getIntArray(R.array.config_apfEthTypeBlackList);
} }
} }