Merge "Revert "Revert "Suppress NewApi warnings for @SystemApi -> public APIs"""
This commit is contained in:
@@ -22,6 +22,7 @@ import static android.system.OsConstants.AF_INET6;
|
||||
import static com.android.net.module.util.NetworkStackConstants.IPV4_ADDR_ANY;
|
||||
import static com.android.net.module.util.NetworkStackConstants.IPV6_ADDR_ANY;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.IpPrefix;
|
||||
import android.system.OsConstants;
|
||||
|
||||
@@ -107,6 +108,7 @@ public class RtNetlinkRouteMessage extends NetlinkMessage {
|
||||
* @param header netlink message header.
|
||||
* @param byteBuffer the ByteBuffer instance that wraps the raw netlink message bytes.
|
||||
*/
|
||||
@SuppressLint("NewApi")
|
||||
@Nullable
|
||||
public static RtNetlinkRouteMessage parse(@NonNull final StructNlMsgHdr header,
|
||||
@NonNull final ByteBuffer byteBuffer) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.net.module.util.netlink;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.IpPrefix;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -107,6 +108,7 @@ public class StructNdOptPref64 extends NdOption {
|
||||
this.lifetime = lifetime & 0xfff8;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private StructNdOptPref64(@NonNull ByteBuffer buf) {
|
||||
super(buf.get(), Byte.toUnsignedInt(buf.get()));
|
||||
if (type != TYPE) throw new IllegalArgumentException("Invalid type " + type);
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.InetAddresses;
|
||||
import android.net.IpPrefix;
|
||||
|
||||
@@ -92,6 +93,7 @@ public class IpRangeTest {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testConstructor() {
|
||||
IpRange r = new IpRange(new IpPrefix(IPV4_ADDR, 32));
|
||||
@@ -119,6 +121,7 @@ public class IpRangeTest {
|
||||
assertEquals(IPV6_RANGE_END, r.getEndAddr());
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testContainsRangeEqualRanges() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 35));
|
||||
@@ -129,6 +132,7 @@ public class IpRangeTest {
|
||||
assertEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testContainsRangeSubset() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 64));
|
||||
@@ -139,6 +143,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testContainsRangeTruncatesLowerOrderBits() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 100));
|
||||
@@ -149,6 +154,7 @@ public class IpRangeTest {
|
||||
assertEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testContainsRangeSubsetSameStartAddr() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 35));
|
||||
@@ -159,6 +165,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testContainsRangeOverlapping() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(address("2001:db9::"), 32));
|
||||
@@ -169,6 +176,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testOverlapsRangeEqualRanges() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 35));
|
||||
@@ -179,6 +187,7 @@ public class IpRangeTest {
|
||||
assertEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testOverlapsRangeSubset() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 35));
|
||||
@@ -189,6 +198,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testOverlapsRangeDisjoint() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(IPV6_ADDR, 32));
|
||||
@@ -199,6 +209,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testOverlapsRangePartialOverlapLow() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(address("2001:db9::"), 32));
|
||||
@@ -209,6 +220,7 @@ public class IpRangeTest {
|
||||
assertNotEquals(r1, r2);
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@Test
|
||||
public void testOverlapsRangePartialOverlapHigh() {
|
||||
final IpRange r1 = new IpRange(new IpPrefix(address("2001:db7::"), 32));
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.InetAddresses;
|
||||
import android.net.IpPrefix;
|
||||
import android.net.LinkAddress;
|
||||
@@ -46,6 +47,7 @@ import java.util.function.Function;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public final class LinkPropertiesUtilsTest {
|
||||
@SuppressLint("NewApi")
|
||||
private static final IpPrefix PREFIX = new IpPrefix(toInetAddress("75.208.6.0"), 24);
|
||||
private static final InetAddress V4_ADDR = toInetAddress("75.208.6.1");
|
||||
private static final InetAddress V6_ADDR = toInetAddress(
|
||||
|
||||
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.InetAddresses;
|
||||
import android.net.IpPrefix;
|
||||
import android.net.MacAddress;
|
||||
@@ -453,6 +454,7 @@ public class StructTest {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void verifyPrefixByteArrayParsing(final PrefixMessage msg) throws Exception {
|
||||
// The original PREF64 option message has just 12 bytes for prefix byte array
|
||||
// (Highest 96 bits of the Prefix), copyOf pads the 128-bits IPv6 address with
|
||||
|
||||
@@ -24,6 +24,7 @@ import static com.android.testutils.MiscAsserts.assertThrows;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.net.IpPrefix;
|
||||
|
||||
import androidx.test.filters.SmallTest;
|
||||
@@ -51,6 +52,7 @@ public class StructNdOptPref64Test {
|
||||
return prefixBytes;
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private static IpPrefix prefix(String addrString, int prefixLength) throws Exception {
|
||||
return new IpPrefix(InetAddress.getByName(addrString), prefixLength);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user