From 932df54493023db70f6331bef3687ed243183423 Mon Sep 17 00:00:00 2001 From: markchien Date: Thu, 12 Aug 2021 13:56:43 +0800 Subject: [PATCH] Use SdkLevel util instead of explicitly checking the version There are IpServerTest test case fail because the code check the wrong code name for T pre-release builds. Bug: 194812819 Test: atest TetheringTests Change-Id: I73bf58c60b6e790fe0060b60c023c10f5d8cbfa8 --- Tethering/src/android/net/ip/IpServer.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Tethering/src/android/net/ip/IpServer.java b/Tethering/src/android/net/ip/IpServer.java index 859f23a141..cf49683acb 100644 --- a/Tethering/src/android/net/ip/IpServer.java +++ b/Tethering/src/android/net/ip/IpServer.java @@ -52,7 +52,6 @@ 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; import android.os.Looper; import android.os.Message; @@ -67,6 +66,7 @@ import androidx.annotation.Nullable; import com.android.internal.util.MessageUtils; import com.android.internal.util.State; import com.android.internal.util.StateMachine; +import com.android.modules.utils.build.SdkLevel; import com.android.networkstack.tethering.BpfCoordinator; import com.android.networkstack.tethering.BpfCoordinator.ClientInfo; import com.android.networkstack.tethering.BpfCoordinator.Ipv6ForwardingRule; @@ -676,9 +676,7 @@ public class IpServer extends StateMachine { return false; } - // TODO: use ShimUtils instead of explicitly checking the version here. - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R || "S".equals(Build.VERSION.CODENAME) - || "T".equals(Build.VERSION.CODENAME)) { + if (SdkLevel.isAtLeastS()) { // DAD Proxy starts forwarding packets after IPv6 upstream is present. mDadProxy = mDeps.getDadProxy(getHandler(), mInterfaceParams); }