From 4ae0afad16e9e83726c8463c4ea34e488176ef97 Mon Sep 17 00:00:00 2001 From: Kangping Dong Date: Mon, 19 Dec 2022 16:33:55 +0800 Subject: [PATCH] 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: 707a996c9bcb0c794b03e74d2092655de27c4f72 --- framework/api/current.txt | 1 + framework/src/android/net/NetworkCapabilities.java | 11 +++++++++-- service/Android.bp | 2 +- .../unit/java/android/net/util/KeepaliveUtilsTest.kt | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/framework/api/current.txt b/framework/api/current.txt index 547b7e26a6..672e3e264f 100644 --- a/framework/api/current.txt +++ b/framework/api/current.txt @@ -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 diff --git a/framework/src/android/net/NetworkCapabilities.java b/framework/src/android/net/NetworkCapabilities.java index e07601f1cc..a81da22c22 100644 --- a/framework/src/android/net/NetworkCapabilities.java +++ b/framework/src/android/net/NetworkCapabilities.java @@ -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", }; /** diff --git a/service/Android.bp b/service/Android.bp index 224fa19bc1..b7ddc8ad33 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -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", diff --git a/tests/unit/java/android/net/util/KeepaliveUtilsTest.kt b/tests/unit/java/android/net/util/KeepaliveUtilsTest.kt index 9203f8f6cf..cca0b661c2 100644 --- a/tests/unit/java/android/net/util/KeepaliveUtilsTest.kt +++ b/tests/unit/java/android/net/util/KeepaliveUtilsTest.kt @@ -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,