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
This commit is contained in:
markchien
2021-08-12 13:56:43 +08:00
committed by Mark Chien
parent 43dd35b6fc
commit 932df54493

View File

@@ -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);
}