Snap for 6364069 from 8a31e59ece18f4028c1f52674d08984bd6004b59 to rvc-release
Change-Id: Id38059a6d812248e753fc2059b8ba08727ef6303
This commit is contained in:
@@ -169,6 +169,7 @@ public final class NetworkCapabilities implements Parcelable {
|
|||||||
NET_CAPABILITY_OEM_PAID,
|
NET_CAPABILITY_OEM_PAID,
|
||||||
NET_CAPABILITY_MCX,
|
NET_CAPABILITY_MCX,
|
||||||
NET_CAPABILITY_PARTIAL_CONNECTIVITY,
|
NET_CAPABILITY_PARTIAL_CONNECTIVITY,
|
||||||
|
NET_CAPABILITY_TEMPORARILY_NOT_METERED,
|
||||||
})
|
})
|
||||||
public @interface NetCapability { }
|
public @interface NetCapability { }
|
||||||
|
|
||||||
@@ -336,8 +337,16 @@ public final class NetworkCapabilities implements Parcelable {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
public static final int NET_CAPABILITY_PARTIAL_CONNECTIVITY = 24;
|
public static final int NET_CAPABILITY_PARTIAL_CONNECTIVITY = 24;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This capability will be set for networks that are generally metered, but are currently
|
||||||
|
* unmetered, e.g., because the user is in a particular area. This capability can be changed at
|
||||||
|
* any time. When it is removed, applications are responsible for stopping any data transfer
|
||||||
|
* that should not occur on a metered network.
|
||||||
|
*/
|
||||||
|
public static final int NET_CAPABILITY_TEMPORARILY_NOT_METERED = 25;
|
||||||
|
|
||||||
private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS;
|
private static final int MIN_NET_CAPABILITY = NET_CAPABILITY_MMS;
|
||||||
private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_PARTIAL_CONNECTIVITY;
|
private static final int MAX_NET_CAPABILITY = NET_CAPABILITY_TEMPORARILY_NOT_METERED;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network capabilities that are expected to be mutable, i.e., can change while a particular
|
* Network capabilities that are expected to be mutable, i.e., can change while a particular
|
||||||
@@ -353,7 +362,8 @@ public final class NetworkCapabilities implements Parcelable {
|
|||||||
| (1 << NET_CAPABILITY_FOREGROUND)
|
| (1 << NET_CAPABILITY_FOREGROUND)
|
||||||
| (1 << NET_CAPABILITY_NOT_CONGESTED)
|
| (1 << NET_CAPABILITY_NOT_CONGESTED)
|
||||||
| (1 << NET_CAPABILITY_NOT_SUSPENDED)
|
| (1 << NET_CAPABILITY_NOT_SUSPENDED)
|
||||||
| (1 << NET_CAPABILITY_PARTIAL_CONNECTIVITY);
|
| (1 << NET_CAPABILITY_PARTIAL_CONNECTIVITY
|
||||||
|
| (1 << NET_CAPABILITY_TEMPORARILY_NOT_METERED));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Network capabilities that are not allowed in NetworkRequests. This exists because the
|
* Network capabilities that are not allowed in NetworkRequests. This exists because the
|
||||||
@@ -424,6 +434,7 @@ public final class NetworkCapabilities implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
private static final long TEST_NETWORKS_ALLOWED_CAPABILITIES =
|
private static final long TEST_NETWORKS_ALLOWED_CAPABILITIES =
|
||||||
(1 << NET_CAPABILITY_NOT_METERED)
|
(1 << NET_CAPABILITY_NOT_METERED)
|
||||||
|
| (1 << NET_CAPABILITY_TEMPORARILY_NOT_METERED)
|
||||||
| (1 << NET_CAPABILITY_NOT_RESTRICTED)
|
| (1 << NET_CAPABILITY_NOT_RESTRICTED)
|
||||||
| (1 << NET_CAPABILITY_NOT_VPN)
|
| (1 << NET_CAPABILITY_NOT_VPN)
|
||||||
| (1 << NET_CAPABILITY_NOT_ROAMING)
|
| (1 << NET_CAPABILITY_NOT_ROAMING)
|
||||||
@@ -1864,6 +1875,7 @@ public final class NetworkCapabilities implements Parcelable {
|
|||||||
case NET_CAPABILITY_OEM_PAID: return "OEM_PAID";
|
case NET_CAPABILITY_OEM_PAID: return "OEM_PAID";
|
||||||
case NET_CAPABILITY_MCX: return "MCX";
|
case NET_CAPABILITY_MCX: return "MCX";
|
||||||
case NET_CAPABILITY_PARTIAL_CONNECTIVITY: return "PARTIAL_CONNECTIVITY";
|
case NET_CAPABILITY_PARTIAL_CONNECTIVITY: return "PARTIAL_CONNECTIVITY";
|
||||||
|
case NET_CAPABILITY_TEMPORARILY_NOT_METERED: return "TEMPORARILY_NOT_METERED";
|
||||||
default: return Integer.toString(capability);
|
default: return Integer.toString(capability);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,14 +445,20 @@ public class LinkPropertiesTest {
|
|||||||
// Check comparisons work.
|
// Check comparisons work.
|
||||||
LinkProperties lp2 = new LinkProperties(lp);
|
LinkProperties lp2 = new LinkProperties(lp);
|
||||||
assertAllRoutesHaveInterface("wlan0", lp2);
|
assertAllRoutesHaveInterface("wlan0", lp2);
|
||||||
assertEquals(0, lp.compareAllRoutes(lp2).added.size());
|
// LinkProperties#compareAllRoutes exists both in R and before R, but the return type
|
||||||
assertEquals(0, lp.compareAllRoutes(lp2).removed.size());
|
// changed in R, so a test compiled with the R version of LinkProperties cannot run on Q.
|
||||||
|
if (isAtLeastR()) {
|
||||||
|
assertEquals(0, lp.compareAllRoutes(lp2).added.size());
|
||||||
|
assertEquals(0, lp.compareAllRoutes(lp2).removed.size());
|
||||||
|
}
|
||||||
|
|
||||||
lp2.setInterfaceName("p2p0");
|
lp2.setInterfaceName("p2p0");
|
||||||
assertAllRoutesHaveInterface("p2p0", lp2);
|
assertAllRoutesHaveInterface("p2p0", lp2);
|
||||||
assertAllRoutesNotHaveInterface("wlan0", lp2);
|
assertAllRoutesNotHaveInterface("wlan0", lp2);
|
||||||
assertEquals(3, lp.compareAllRoutes(lp2).added.size());
|
if (isAtLeastR()) {
|
||||||
assertEquals(3, lp.compareAllRoutes(lp2).removed.size());
|
assertEquals(3, lp.compareAllRoutes(lp2).added.size());
|
||||||
|
assertEquals(3, lp.compareAllRoutes(lp2).removed.size());
|
||||||
|
}
|
||||||
|
|
||||||
// Remove route with incorrect interface, no route removed.
|
// Remove route with incorrect interface, no route removed.
|
||||||
lp.removeRoute(new RouteInfo(prefix2, null, null));
|
lp.removeRoute(new RouteInfo(prefix2, null, null));
|
||||||
@@ -946,7 +952,7 @@ public class LinkPropertiesTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test @IgnoreUpTo(Build.VERSION_CODES.Q)
|
||||||
public void testCompareResult() {
|
public void testCompareResult() {
|
||||||
// Either adding or removing items
|
// Either adding or removing items
|
||||||
compareResult(Arrays.asList(1, 2, 3, 4), Arrays.asList(1),
|
compareResult(Arrays.asList(1, 2, 3, 4), Arrays.asList(1),
|
||||||
|
|||||||
Reference in New Issue
Block a user