add TRANSPORT_THREAD to NetworkCapabilities

This commit also updates to use V11 dnsresolver APIs which was V9.

Bug: 262683651
Test: unit tests
Change-Id: Ifbd71157012dc66ec0f377beef9fa59d1c8620b8

Former-commit-id: 707a996c9b
This commit is contained in:
Kangping Dong 2022-12-19 16:33:55 +08:00
parent 29b208bdcc
commit 4ae0afad16
4 changed files with 12 additions and 4 deletions

View File

@ -360,6 +360,7 @@ package android.net {
field public static final int TRANSPORT_CELLULAR = 0; // 0x0
field public static final int TRANSPORT_ETHERNET = 3; // 0x3
field public static final int TRANSPORT_LOWPAN = 6; // 0x6
field public static final int TRANSPORT_THREAD = 9; // 0x9
field public static final int TRANSPORT_USB = 8; // 0x8
field public static final int TRANSPORT_VPN = 4; // 0x4
field public static final int TRANSPORT_WIFI = 1; // 0x1

View File

@ -1109,6 +1109,7 @@ public final class NetworkCapabilities implements Parcelable {
TRANSPORT_LOWPAN,
TRANSPORT_TEST,
TRANSPORT_USB,
TRANSPORT_THREAD,
})
public @interface Transport { }
@ -1160,10 +1161,15 @@ public final class NetworkCapabilities implements Parcelable {
*/
public static final int TRANSPORT_USB = 8;
/**
* Indicates this network uses a Thread transport.
*/
public static final int TRANSPORT_THREAD = 9;
/** @hide */
public static final int MIN_TRANSPORT = TRANSPORT_CELLULAR;
/** @hide */
public static final int MAX_TRANSPORT = TRANSPORT_USB;
public static final int MAX_TRANSPORT = TRANSPORT_THREAD;
private static final int ALL_VALID_TRANSPORTS;
static {
@ -1188,7 +1194,8 @@ public final class NetworkCapabilities implements Parcelable {
"WIFI_AWARE",
"LOWPAN",
"TEST",
"USB"
"USB",
"THREAD",
};
/**

View File

@ -171,7 +171,7 @@ java_library {
"androidx.annotation_annotation",
"connectivity-net-module-utils-bpf",
"connectivity_native_aidl_interface-lateststable-java",
"dnsresolver_aidl_interface-V9-java",
"dnsresolver_aidl_interface-V11-java",
"modules-utils-shell-command-handler",
"net-utils-device-common",
"net-utils-device-common-bpf",

View File

@ -104,7 +104,7 @@ class KeepaliveUtilsTest {
// Check valid customization generates expected array.
val validRes = arrayOf("0,3", "1,0", "4,4")
val expectedValidRes = intArrayOf(3, 0, 0, 0, 4, 0, 0, 0, 0)
val expectedValidRes = intArrayOf(3, 0, 0, 0, 4, 0, 0, 0, 0, 0)
val mockContext = getMockedContextWithStringArrayRes(
R.array.config_networkSupportedKeepaliveCount,