From d02f9af9181d866dc24ae04dec2508e6610e2492 Mon Sep 17 00:00:00 2001 From: markchien Date: Thu, 4 Nov 2021 11:26:03 +0800 Subject: [PATCH] Rename tethering util folder and its package name Move tethering util files from android.net.util into com.android.networkstack.tethering.util. The goal is move all of tethering internal files into its own namespace com.android.networkstack.tethering.util. Bug: 205088391 Test: atest TetheringTests atest CtsTetheringTest atest TetheringPrivilegedTests Change-Id: I6559fb4f873b3cad5b210b10e49df1b6c6914a70 --- ...rkstack_tethering_util_TetheringUtils.cpp} | 30 +++++++++---------- Tethering/jni/onload.cpp | 4 +-- Tethering/src/android/net/ip/IpServer.java | 8 ++--- .../net/ip/NeighborPacketForwarder.java | 2 +- .../net/ip/RouterAdvertisementDaemon.java | 4 +-- .../tethering/BpfCoordinator.java | 2 +- .../tethering/OffloadHardwareInterface.java | 3 +- .../tethering/PrivateAddressCoordinator.java | 2 +- .../networkstack/tethering/Tethering.java | 10 +++---- .../tethering/TetheringInterfaceUtils.java | 2 +- .../tethering/UpstreamNetworkMonitor.java | 2 +- .../tethering}/util/InterfaceSet.java | 2 +- .../tethering}/util/PrefixUtils.java | 3 +- .../tethering}/util/TetheringMessageBase.java | 2 +- .../tethering}/util/TetheringUtils.java | 2 +- .../util/VersionedBroadcastListener.java | 2 +- .../src/android/net/ip/DadProxyTest.java | 2 +- .../unit/src/android/net/ip/IpServerTest.java | 4 +-- .../OffloadHardwareInterfaceTest.java | 2 +- .../PrivateAddressCoordinatorTest.java | 3 +- .../tethering}/util/InterfaceSetTest.java | 2 +- .../tethering}/util/TetheringUtilsTest.java | 2 +- .../util/VersionedBroadcastListenerTest.java | 2 +- 23 files changed, 49 insertions(+), 48 deletions(-) rename Tethering/jni/{android_net_util_TetheringUtils.cpp => com_android_networkstack_tethering_util_TetheringUtils.cpp} (83%) rename Tethering/src/{android/net => com/android/networkstack/tethering}/util/InterfaceSet.java (96%) rename Tethering/src/{android/net => com/android/networkstack/tethering}/util/PrefixUtils.java (97%) rename Tethering/src/{android/net => com/android/networkstack/tethering}/util/TetheringMessageBase.java (94%) rename Tethering/src/{android/net => com/android/networkstack/tethering}/util/TetheringUtils.java (99%) rename Tethering/src/{android/net => com/android/networkstack/tethering}/util/VersionedBroadcastListener.java (98%) rename Tethering/tests/unit/src/{android/net => com/android/networkstack/tethering}/util/InterfaceSetTest.java (97%) rename Tethering/tests/unit/src/{android/net => com/android/networkstack/tethering}/util/TetheringUtilsTest.java (99%) rename Tethering/tests/unit/src/{android/net => com/android/networkstack/tethering}/util/VersionedBroadcastListenerTest.java (98%) diff --git a/Tethering/jni/android_net_util_TetheringUtils.cpp b/Tethering/jni/com_android_networkstack_tethering_util_TetheringUtils.cpp similarity index 83% rename from Tethering/jni/android_net_util_TetheringUtils.cpp rename to Tethering/jni/com_android_networkstack_tethering_util_TetheringUtils.cpp index 2e76501cae..291bf542ec 100644 --- a/Tethering/jni/android_net_util_TetheringUtils.cpp +++ b/Tethering/jni/com_android_networkstack_tethering_util_TetheringUtils.cpp @@ -38,7 +38,8 @@ static void throwSocketException(JNIEnv *env, const char* msg, int error) { jniThrowExceptionFmt(env, "java/net/SocketException", "%s: %s", msg, strerror(error)); } -static void android_net_util_setupIcmpFilter(JNIEnv *env, jobject javaFd, uint32_t type) { +static void com_android_networkstack_tethering_util_setupIcmpFilter(JNIEnv *env, jobject javaFd, + uint32_t type) { sock_filter filter_code[] = { // Check header is ICMPv6. BPF_STMT(BPF_LD | BPF_B | BPF_ABS, kIPv6NextHeaderOffset), @@ -64,19 +65,18 @@ static void android_net_util_setupIcmpFilter(JNIEnv *env, jobject javaFd, uint32 } } -static void android_net_util_setupNaSocket(JNIEnv *env, jobject clazz, jobject javaFd) -{ - android_net_util_setupIcmpFilter(env, javaFd, ND_NEIGHBOR_ADVERT); +static void com_android_networkstack_tethering_util_setupNaSocket(JNIEnv *env, jobject clazz, + jobject javaFd) { + com_android_networkstack_tethering_util_setupIcmpFilter(env, javaFd, ND_NEIGHBOR_ADVERT); } -static void android_net_util_setupNsSocket(JNIEnv *env, jobject clazz, jobject javaFd) -{ - android_net_util_setupIcmpFilter(env, javaFd, ND_NEIGHBOR_SOLICIT); +static void com_android_networkstack_tethering_util_setupNsSocket(JNIEnv *env, jobject clazz, + jobject javaFd) { + com_android_networkstack_tethering_util_setupIcmpFilter(env, javaFd, ND_NEIGHBOR_SOLICIT); } -static void android_net_util_setupRaSocket(JNIEnv *env, jobject clazz, jobject javaFd, - jint ifIndex) -{ +static void com_android_networkstack_tethering_util_setupRaSocket(JNIEnv *env, jobject clazz, + jobject javaFd, jint ifIndex) { static const int kLinkLocalHopLimit = 255; int fd = netjniutils::GetNativeFileDescriptor(env, javaFd); @@ -164,16 +164,16 @@ static void android_net_util_setupRaSocket(JNIEnv *env, jobject clazz, jobject j static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ { "setupNaSocket", "(Ljava/io/FileDescriptor;)V", - (void*) android_net_util_setupNaSocket }, + (void*) com_android_networkstack_tethering_util_setupNaSocket }, { "setupNsSocket", "(Ljava/io/FileDescriptor;)V", - (void*) android_net_util_setupNsSocket }, + (void*) com_android_networkstack_tethering_util_setupNsSocket }, { "setupRaSocket", "(Ljava/io/FileDescriptor;I)V", - (void*) android_net_util_setupRaSocket }, + (void*) com_android_networkstack_tethering_util_setupRaSocket }, }; -int register_android_net_util_TetheringUtils(JNIEnv* env) { +int register_com_android_networkstack_tethering_util_TetheringUtils(JNIEnv* env) { return jniRegisterNativeMethods(env, - "android/net/util/TetheringUtils", + "com/android/networkstack/tethering/util/TetheringUtils", gMethods, NELEM(gMethods)); } diff --git a/Tethering/jni/onload.cpp b/Tethering/jni/onload.cpp index fbae615db7..72895f14a1 100644 --- a/Tethering/jni/onload.cpp +++ b/Tethering/jni/onload.cpp @@ -22,10 +22,10 @@ namespace android { -int register_android_net_util_TetheringUtils(JNIEnv* env); int register_com_android_net_module_util_BpfMap(JNIEnv* env, char const* class_name); int register_com_android_networkstack_tethering_BpfCoordinator(JNIEnv* env); int register_com_android_networkstack_tethering_BpfUtils(JNIEnv* env); +int register_com_android_networkstack_tethering_util_TetheringUtils(JNIEnv* env); extern "C" jint JNI_OnLoad(JavaVM* vm, void*) { JNIEnv *env; @@ -34,7 +34,7 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void*) { return JNI_ERR; } - if (register_android_net_util_TetheringUtils(env) < 0) return JNI_ERR; + if (register_com_android_networkstack_tethering_util_TetheringUtils(env) < 0) return JNI_ERR; if (register_com_android_net_module_util_BpfMap(env, "com/android/networkstack/tethering/util/BpfMap") < 0) return JNI_ERR; diff --git a/Tethering/src/android/net/ip/IpServer.java b/Tethering/src/android/net/ip/IpServer.java index bee928dfc4..b4228da371 100644 --- a/Tethering/src/android/net/ip/IpServer.java +++ b/Tethering/src/android/net/ip/IpServer.java @@ -21,12 +21,12 @@ import static android.net.TetheringManager.TetheringRequest.checkStaticAddressCo import static android.net.dhcp.IDhcpServer.STATUS_SUCCESS; import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH; import static android.net.util.NetworkConstants.asByte; -import static android.net.util.PrefixUtils.asIpPrefix; -import static android.net.util.TetheringMessageBase.BASE_IPSERVER; import static android.system.OsConstants.RT_SCOPE_UNIVERSE; import static com.android.net.module.util.Inet4AddressUtils.intToInet4AddressHTH; import static com.android.networkstack.tethering.UpstreamNetworkState.isVcnInterface; +import static com.android.networkstack.tethering.util.PrefixUtils.asIpPrefix; +import static com.android.networkstack.tethering.util.TetheringMessageBase.BASE_IPSERVER; import android.net.INetd; import android.net.INetworkStackStatusCallback; @@ -47,8 +47,6 @@ import android.net.dhcp.IDhcpServer; import android.net.ip.IpNeighborMonitor.NeighborEvent; import android.net.ip.RouterAdvertisementDaemon.RaParams; import android.net.util.InterfaceParams; -import android.net.util.InterfaceSet; -import android.net.util.PrefixUtils; import android.net.util.SharedLog; import android.os.Handler; import android.os.Looper; @@ -70,6 +68,8 @@ import com.android.networkstack.tethering.BpfCoordinator; import com.android.networkstack.tethering.BpfCoordinator.ClientInfo; import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule; import com.android.networkstack.tethering.PrivateAddressCoordinator; +import com.android.networkstack.tethering.util.InterfaceSet; +import com.android.networkstack.tethering.util.PrefixUtils; import java.net.Inet4Address; import java.net.Inet6Address; diff --git a/Tethering/src/android/net/ip/NeighborPacketForwarder.java b/Tethering/src/android/net/ip/NeighborPacketForwarder.java index 084743db03..27e59a1681 100644 --- a/Tethering/src/android/net/ip/NeighborPacketForwarder.java +++ b/Tethering/src/android/net/ip/NeighborPacketForwarder.java @@ -26,13 +26,13 @@ import static android.system.OsConstants.SOCK_RAW; import android.net.util.InterfaceParams; import android.net.util.SocketUtils; -import android.net.util.TetheringUtils; import android.os.Handler; import android.system.ErrnoException; import android.system.Os; import android.util.Log; import com.android.net.module.util.PacketReader; +import com.android.networkstack.tethering.util.TetheringUtils; import java.io.FileDescriptor; import java.io.IOException; diff --git a/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java b/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java index 543a5c722f..74f936967d 100644 --- a/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java +++ b/Tethering/src/android/net/ip/RouterAdvertisementDaemon.java @@ -17,7 +17,6 @@ package android.net.ip; import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH; -import static android.net.util.TetheringUtils.getAllNodesForScopeId; import static android.system.OsConstants.AF_INET6; import static android.system.OsConstants.IPPROTO_ICMPV6; import static android.system.OsConstants.SOCK_RAW; @@ -32,6 +31,7 @@ import static com.android.net.module.util.NetworkStackConstants.IPV6_MIN_MTU; import static com.android.net.module.util.NetworkStackConstants.PIO_FLAG_AUTONOMOUS; import static com.android.net.module.util.NetworkStackConstants.PIO_FLAG_ON_LINK; import static com.android.net.module.util.NetworkStackConstants.TAG_SYSTEM_NEIGHBOR; +import static com.android.networkstack.tethering.util.TetheringUtils.getAllNodesForScopeId; import android.net.IpPrefix; import android.net.LinkAddress; @@ -39,7 +39,6 @@ import android.net.MacAddress; import android.net.TrafficStats; import android.net.util.InterfaceParams; import android.net.util.SocketUtils; -import android.net.util.TetheringUtils; import android.system.ErrnoException; import android.system.Os; import android.system.StructTimeval; @@ -52,6 +51,7 @@ import com.android.net.module.util.structs.MtuOption; import com.android.net.module.util.structs.PrefixInformationOption; import com.android.net.module.util.structs.RaHeader; import com.android.net.module.util.structs.RdnssOption; +import com.android.networkstack.tethering.util.TetheringUtils; import java.io.FileDescriptor; import java.io.IOException; diff --git a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java index 4a6b9aa87b..2c510fe527 100644 --- a/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java +++ b/Tethering/src/com/android/networkstack/tethering/BpfCoordinator.java @@ -45,7 +45,6 @@ import android.net.ip.IpServer; import android.net.netstats.provider.NetworkStatsProvider; import android.net.util.InterfaceParams; import android.net.util.SharedLog; -import android.net.util.TetheringUtils.ForwardedStats; import android.os.Handler; import android.os.SystemClock; import android.system.ErrnoException; @@ -69,6 +68,7 @@ import com.android.net.module.util.netlink.ConntrackMessage; import com.android.net.module.util.netlink.NetlinkConstants; import com.android.net.module.util.netlink.NetlinkSocket; import com.android.networkstack.tethering.apishim.common.BpfCoordinatorShim; +import com.android.networkstack.tethering.util.TetheringUtils.ForwardedStats; import java.net.Inet4Address; import java.net.Inet6Address; diff --git a/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java b/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java index f336d9bae7..9da66d8119 100644 --- a/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java +++ b/Tethering/src/com/android/networkstack/tethering/OffloadHardwareInterface.java @@ -16,10 +16,9 @@ package com.android.networkstack.tethering; -import static android.net.util.TetheringUtils.uint16; - import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_DUMP; import static com.android.net.module.util.netlink.StructNlMsgHdr.NLM_F_REQUEST; +import static com.android.networkstack.tethering.util.TetheringUtils.uint16; import android.annotation.IntDef; import android.annotation.NonNull; diff --git a/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java b/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java index 4f616cdff0..c1e7127b02 100644 --- a/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java +++ b/Tethering/src/com/android/networkstack/tethering/PrivateAddressCoordinator.java @@ -18,11 +18,11 @@ package com.android.networkstack.tethering; import static android.net.NetworkCapabilities.TRANSPORT_VPN; import static android.net.TetheringManager.TETHERING_BLUETOOTH; import static android.net.TetheringManager.TETHERING_WIFI_P2P; -import static android.net.util.PrefixUtils.asIpPrefix; import static com.android.net.module.util.Inet4AddressUtils.inet4AddressToIntHTH; import static com.android.net.module.util.Inet4AddressUtils.intToInet4AddressHTH; import static com.android.net.module.util.Inet4AddressUtils.prefixLengthToV4NetmaskIntHTH; +import static com.android.networkstack.tethering.util.PrefixUtils.asIpPrefix; import static java.util.Arrays.asList; diff --git a/Tethering/src/com/android/networkstack/tethering/Tethering.java b/Tethering/src/com/android/networkstack/tethering/Tethering.java index c9428998a0..78f2afce4e 100644 --- a/Tethering/src/com/android/networkstack/tethering/Tethering.java +++ b/Tethering/src/com/android/networkstack/tethering/Tethering.java @@ -52,7 +52,6 @@ import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_FAILED; import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_STARTED; import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_STOPPED; import static android.net.TetheringManager.toIfaces; -import static android.net.util.TetheringMessageBase.BASE_MAIN_SM; import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_INTERFACE_NAME; import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_MODE; import static android.net.wifi.WifiManager.EXTRA_WIFI_AP_STATE; @@ -67,6 +66,7 @@ import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID; import static com.android.networkstack.tethering.TetheringConfiguration.TETHER_FORCE_USB_FUNCTIONS; import static com.android.networkstack.tethering.TetheringNotificationUpdater.DOWNSTREAM_NONE; import static com.android.networkstack.tethering.UpstreamNetworkMonitor.isCellular; +import static com.android.networkstack.tethering.util.TetheringMessageBase.BASE_MAIN_SM; import android.app.usage.NetworkStatsManager; import android.bluetooth.BluetoothAdapter; @@ -100,11 +100,7 @@ import android.net.TetheringManager.TetheringRequest; import android.net.TetheringRequestParcel; import android.net.ip.IpServer; import android.net.shared.NetdUtils; -import android.net.util.InterfaceSet; -import android.net.util.PrefixUtils; import android.net.util.SharedLog; -import android.net.util.TetheringUtils; -import android.net.util.VersionedBroadcastListener; import android.net.wifi.WifiClient; import android.net.wifi.WifiManager; import android.net.wifi.p2p.WifiP2pGroup; @@ -138,6 +134,10 @@ import com.android.internal.util.MessageUtils; import com.android.internal.util.State; import com.android.internal.util.StateMachine; import com.android.net.module.util.BaseNetdUnsolicitedEventListener; +import com.android.networkstack.tethering.util.InterfaceSet; +import com.android.networkstack.tethering.util.PrefixUtils; +import com.android.networkstack.tethering.util.TetheringUtils; +import com.android.networkstack.tethering.util.VersionedBroadcastListener; import java.io.FileDescriptor; import java.io.PrintWriter; diff --git a/Tethering/src/com/android/networkstack/tethering/TetheringInterfaceUtils.java b/Tethering/src/com/android/networkstack/tethering/TetheringInterfaceUtils.java index d0a1ac37f2..3974fa54ae 100644 --- a/Tethering/src/com/android/networkstack/tethering/TetheringInterfaceUtils.java +++ b/Tethering/src/com/android/networkstack/tethering/TetheringInterfaceUtils.java @@ -24,9 +24,9 @@ import android.annotation.Nullable; import android.net.LinkProperties; import android.net.NetworkCapabilities; import android.net.RouteInfo; -import android.net.util.InterfaceSet; import com.android.net.module.util.NetUtils; +import com.android.networkstack.tethering.util.InterfaceSet; import java.net.InetAddress; import java.net.UnknownHostException; diff --git a/Tethering/src/com/android/networkstack/tethering/UpstreamNetworkMonitor.java b/Tethering/src/com/android/networkstack/tethering/UpstreamNetworkMonitor.java index 5a86b84364..9d19335bcb 100644 --- a/Tethering/src/com/android/networkstack/tethering/UpstreamNetworkMonitor.java +++ b/Tethering/src/com/android/networkstack/tethering/UpstreamNetworkMonitor.java @@ -36,7 +36,6 @@ import android.net.LinkProperties; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkRequest; -import android.net.util.PrefixUtils; import android.net.util.SharedLog; import android.os.Handler; import android.util.Log; @@ -49,6 +48,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.util.StateMachine; import com.android.networkstack.apishim.ConnectivityManagerShimImpl; import com.android.networkstack.apishim.common.ConnectivityManagerShim; +import com.android.networkstack.tethering.util.PrefixUtils; import java.util.HashMap; import java.util.HashSet; diff --git a/Tethering/src/android/net/util/InterfaceSet.java b/Tethering/src/com/android/networkstack/tethering/util/InterfaceSet.java similarity index 96% rename from Tethering/src/android/net/util/InterfaceSet.java rename to Tethering/src/com/android/networkstack/tethering/util/InterfaceSet.java index 758978711b..44573f889d 100644 --- a/Tethering/src/android/net/util/InterfaceSet.java +++ b/Tethering/src/com/android/networkstack/tethering/util/InterfaceSet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import java.util.Collections; import java.util.HashSet; diff --git a/Tethering/src/android/net/util/PrefixUtils.java b/Tethering/src/com/android/networkstack/tethering/util/PrefixUtils.java similarity index 97% rename from Tethering/src/android/net/util/PrefixUtils.java rename to Tethering/src/com/android/networkstack/tethering/util/PrefixUtils.java index f203e9995f..50e5c4ae40 100644 --- a/Tethering/src/android/net/util/PrefixUtils.java +++ b/Tethering/src/com/android/networkstack/tethering/util/PrefixUtils.java @@ -14,11 +14,12 @@ * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import android.net.IpPrefix; import android.net.LinkAddress; import android.net.LinkProperties; +import android.net.util.NetworkConstants; import java.net.Inet4Address; import java.net.InetAddress; diff --git a/Tethering/src/android/net/util/TetheringMessageBase.java b/Tethering/src/com/android/networkstack/tethering/util/TetheringMessageBase.java similarity index 94% rename from Tethering/src/android/net/util/TetheringMessageBase.java rename to Tethering/src/com/android/networkstack/tethering/util/TetheringMessageBase.java index 29c0a817b6..27bb0f74cf 100644 --- a/Tethering/src/android/net/util/TetheringMessageBase.java +++ b/Tethering/src/com/android/networkstack/tethering/util/TetheringMessageBase.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; /** * This class defines Message.what base addresses for various state machine. diff --git a/Tethering/src/android/net/util/TetheringUtils.java b/Tethering/src/com/android/networkstack/tethering/util/TetheringUtils.java similarity index 99% rename from Tethering/src/android/net/util/TetheringUtils.java rename to Tethering/src/com/android/networkstack/tethering/util/TetheringUtils.java index 29900d9beb..a8945b1b93 100644 --- a/Tethering/src/android/net/util/TetheringUtils.java +++ b/Tethering/src/com/android/networkstack/tethering/util/TetheringUtils.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import android.net.TetherStatsParcel; import android.net.TetheringRequestParcel; diff --git a/Tethering/src/android/net/util/VersionedBroadcastListener.java b/Tethering/src/com/android/networkstack/tethering/util/VersionedBroadcastListener.java similarity index 98% rename from Tethering/src/android/net/util/VersionedBroadcastListener.java rename to Tethering/src/com/android/networkstack/tethering/util/VersionedBroadcastListener.java index e2804abd75..c9e75c0642 100644 --- a/Tethering/src/android/net/util/VersionedBroadcastListener.java +++ b/Tethering/src/com/android/networkstack/tethering/util/VersionedBroadcastListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import android.content.BroadcastReceiver; import android.content.Context; diff --git a/Tethering/tests/privileged/src/android/net/ip/DadProxyTest.java b/Tethering/tests/privileged/src/android/net/ip/DadProxyTest.java index 23d9055745..59974bfca5 100644 --- a/Tethering/tests/privileged/src/android/net/ip/DadProxyTest.java +++ b/Tethering/tests/privileged/src/android/net/ip/DadProxyTest.java @@ -30,7 +30,6 @@ import android.net.INetd; import android.net.InetAddresses; import android.net.MacAddress; import android.net.util.InterfaceParams; -import android.net.util.TetheringUtils; import android.os.Build; import android.os.Handler; import android.os.HandlerThread; @@ -40,6 +39,7 @@ import android.os.Looper; import androidx.test.InstrumentationRegistry; import androidx.test.filters.SmallTest; +import com.android.networkstack.tethering.util.TetheringUtils; import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo; import com.android.testutils.DevSdkIgnoreRunner; import com.android.testutils.TapPacketReader; diff --git a/Tethering/tests/unit/src/android/net/ip/IpServerTest.java b/Tethering/tests/unit/src/android/net/ip/IpServerTest.java index 86ff7acb5b..2f2cde0b15 100644 --- a/Tethering/tests/unit/src/android/net/ip/IpServerTest.java +++ b/Tethering/tests/unit/src/android/net/ip/IpServerTest.java @@ -85,8 +85,6 @@ import android.net.ip.IpNeighborMonitor.NeighborEvent; import android.net.ip.IpNeighborMonitor.NeighborEventConsumer; import android.net.ip.RouterAdvertisementDaemon.RaParams; import android.net.util.InterfaceParams; -import android.net.util.InterfaceSet; -import android.net.util.PrefixUtils; import android.net.util.SharedLog; import android.os.Build; import android.os.Handler; @@ -116,6 +114,8 @@ import com.android.networkstack.tethering.TetherStatsKey; import com.android.networkstack.tethering.TetherStatsValue; import com.android.networkstack.tethering.TetherUpstream6Key; import com.android.networkstack.tethering.TetheringConfiguration; +import com.android.networkstack.tethering.util.InterfaceSet; +import com.android.networkstack.tethering.util.PrefixUtils; import com.android.testutils.DevSdkIgnoreRule; import com.android.testutils.DevSdkIgnoreRule.IgnoreAfter; import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo; diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java index 24716b25c9..d1891edec9 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/OffloadHardwareInterfaceTest.java @@ -16,13 +16,13 @@ package com.android.networkstack.tethering; -import static android.net.util.TetheringUtils.uint16; import static android.system.OsConstants.AF_INET; import static android.system.OsConstants.AF_UNIX; import static android.system.OsConstants.SOCK_STREAM; import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_0; import static com.android.networkstack.tethering.OffloadHardwareInterface.OFFLOAD_HAL_VERSION_1_1; +import static com.android.networkstack.tethering.util.TetheringUtils.uint16; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; diff --git a/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java index 41d46e522c..6c98f2fdda 100644 --- a/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/PrivateAddressCoordinatorTest.java @@ -23,7 +23,8 @@ import static android.net.TetheringManager.TETHERING_ETHERNET; import static android.net.TetheringManager.TETHERING_USB; import static android.net.TetheringManager.TETHERING_WIFI; import static android.net.TetheringManager.TETHERING_WIFI_P2P; -import static android.net.util.PrefixUtils.asIpPrefix; + +import static com.android.networkstack.tethering.util.PrefixUtils.asIpPrefix; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; diff --git a/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/InterfaceSetTest.java similarity index 97% rename from Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java rename to Tethering/tests/unit/src/com/android/networkstack/tethering/util/InterfaceSetTest.java index ea084b6078..d52dc0f042 100644 --- a/Tethering/tests/unit/src/android/net/util/InterfaceSetTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/InterfaceSetTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; diff --git a/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/TetheringUtilsTest.java similarity index 99% rename from Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java rename to Tethering/tests/unit/src/com/android/networkstack/tethering/util/TetheringUtilsTest.java index e5d0b1cd38..94ce2b6370 100644 --- a/Tethering/tests/unit/src/android/net/util/TetheringUtilsTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/TetheringUtilsTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import static android.net.TetheringManager.CONNECTIVITY_SCOPE_LOCAL; import static android.net.TetheringManager.TETHERING_USB; diff --git a/Tethering/tests/unit/src/android/net/util/VersionedBroadcastListenerTest.java b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/VersionedBroadcastListenerTest.java similarity index 98% rename from Tethering/tests/unit/src/android/net/util/VersionedBroadcastListenerTest.java rename to Tethering/tests/unit/src/com/android/networkstack/tethering/util/VersionedBroadcastListenerTest.java index 5a9b6e380e..b7dc66e015 100644 --- a/Tethering/tests/unit/src/android/net/util/VersionedBroadcastListenerTest.java +++ b/Tethering/tests/unit/src/com/android/networkstack/tethering/util/VersionedBroadcastListenerTest.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package android.net.util; +package com.android.networkstack.tethering.util; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.reset;