diff --git a/service-t/src/com/android/server/ethernet/EthernetTracker.java b/service-t/src/com/android/server/ethernet/EthernetTracker.java
index def701b..1c453cb 100644
--- a/service-t/src/com/android/server/ethernet/EthernetTracker.java
+++ b/service-t/src/com/android/server/ethernet/EthernetTracker.java
@@ -170,6 +170,10 @@
             return resources.get().getStringArray(
                     com.android.connectivity.resources.R.array.config_ethernet_interfaces);
         }
+
+        public boolean isAtLeastB() {
+            return SdkLevel.isAtLeastB();
+        }
     }
 
     private class EthernetNetlinkMonitor extends NetlinkMonitor {
@@ -758,7 +762,7 @@
      * <interface name|mac address>;[Network Capabilities];[IP config];[Override Transport]}
      */
     private void parseEthernetConfig(String configString) {
-        final EthernetTrackerConfig config = new EthernetTrackerConfig(configString);
+        final EthernetConfigParser config = new EthernetConfigParser(configString);
         NetworkCapabilities nc;
         // Starting with Android B (API level 36), we provide default NetworkCapabilities
         // for Ethernet interfaces when no explicit capabilities are specified in the
@@ -770,9 +774,8 @@
         // capabilities) to prevent certain Ethernet interfaces from becoming
         // the default network. To avoid breaking existing device configurations, this
         // change is gated by the SDK level.
-        if (SdkLevel.isAtLeastB() && config.mCaps.isEmpty()) {
-            boolean isTestIface = config.mIface.matches(TEST_IFACE_REGEXP);
-            nc = createDefaultNetworkCapabilities(isTestIface, config.mTransport);
+        if (mDeps.isAtLeastB() && config.mCaps.isEmpty()) {
+            nc = createDefaultNetworkCapabilities(false /* isTestIface */, config.mTransport);
         } else {
             nc = createNetworkCapabilities(config.mCaps, config.mTransport).build();
         }
@@ -1012,13 +1015,13 @@
     }
 
     @VisibleForTesting
-    static class EthernetTrackerConfig {
+    static class EthernetConfigParser {
         final String mIface;
         final List<Integer> mCaps;
         final String mIpConfig;
         final int mTransport;
 
-        private static List<Integer> parseCapabilities(String capabilitiesString) {
+        private static List<Integer> parseCapabilities(@Nullable String capabilitiesString) {
             if (TextUtils.isEmpty(capabilitiesString)) {
                 return Collections.emptyList();
             }
@@ -1037,10 +1040,10 @@
                 }
                 capabilities.add(capability);
             }
-            return capabilities;
+            return Collections.unmodifiableList(capabilities);
         }
 
-        private static int parseTransportType(String transportString) {
+        private static int parseTransportType(@Nullable String transportString) {
             if (TextUtils.isEmpty(transportString)) {
                 return TRANSPORT_ETHERNET;
             }
@@ -1068,13 +1071,13 @@
             }
         }
 
-        EthernetTrackerConfig(String configString) {
-            Objects.requireNonNull(configString, "EthernetTrackerConfig requires non-null config");
+        EthernetConfigParser(String configString) {
+            Objects.requireNonNull(configString, "EthernetConfigParser requires non-null config");
             final String[] tokens = configString.split(";", /* limit of tokens */ 4);
             mIface = tokens[0];
-            mCaps = tokens.length > 1 ? parseCapabilities(tokens[1]) : Collections.emptyList();
+            mCaps = parseCapabilities(tokens.length > 1 ? tokens[1] : null);
             mIpConfig = tokens.length > 2 && !TextUtils.isEmpty(tokens[2]) ? tokens[2] : null;
-            mTransport = tokens.length > 3 ? parseTransportType(tokens[3]) : TRANSPORT_ETHERNET;
+            mTransport = parseTransportType(tokens.length > 3 ? tokens[3] : null);
         }
     }
 }
diff --git a/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java b/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
index 6ce7dbc..03fb505 100644
--- a/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
+++ b/tests/unit/java/com/android/server/ethernet/EthernetTrackerTest.java
@@ -46,7 +46,7 @@
 
 import androidx.test.filters.SmallTest;
 
-import com.android.server.ethernet.EthernetTracker.EthernetTrackerConfig;
+import com.android.server.ethernet.EthernetTracker.EthernetConfigParser;
 import com.android.testutils.DevSdkIgnoreRule;
 import com.android.testutils.DevSdkIgnoreRunner;
 import com.android.testutils.HandlerUtils;
@@ -291,20 +291,20 @@
         final String ipConfig = "";
         final String configString =
                 String.join(";", TEST_IFACE, configCapabilities, ipConfig, configTransports);
-        final EthernetTrackerConfig config = new EthernetTrackerConfig(configString);
+        final EthernetConfigParser config = new EthernetConfigParser(configString);
         assertEquals(
                 expectedNetworkCapabilities,
                 EthernetTracker.createNetworkCapabilities(config.mCaps, config.mTransport).build());
     }
 
     @Test
-    public void testCreateEthernetTrackerConfigReturnsCorrectValue() {
+    public void testCreateEthernetConfigParserReturnsCorrectValue() {
         final String capabilities = "2,4,6,8";
         final String ipConfig = "3";
         final String transport = "1";
         final String configString = String.join(";", TEST_IFACE, capabilities, ipConfig, transport);
 
-        final EthernetTrackerConfig config = new EthernetTrackerConfig(configString);
+        final EthernetConfigParser config = new EthernetConfigParser(configString);
 
         assertEquals(TEST_IFACE, config.mIface);
         assertThat(config.mCaps).containsExactly(2, 4, 6, 8);
@@ -313,30 +313,30 @@
     }
 
     @Test
-    public void testCreateEthernetTrackerConfig_withInvalidTransport() {
+    public void testCreateEthernetConfigParser_withInvalidTransport() {
         final String capabilities = "2";
         final String ipConfig = "3";
         final String transport = "100"; // Invalid transport type
         final String configString = String.join(";", TEST_IFACE, capabilities, ipConfig, transport);
 
-        final EthernetTrackerConfig config = new EthernetTrackerConfig(configString);
+        final EthernetConfigParser config = new EthernetConfigParser(configString);
         assertEquals(NetworkCapabilities.TRANSPORT_ETHERNET, config.mTransport);
     }
 
     @Test
-    public void testCreateEthernetTrackerConfig_withDisallowedTransport() {
+    public void testCreateEthernetConfigParser_withDisallowedTransport() {
         final String capabilities = "2";
         final String ipConfig = "3";
         final String transport = "4"; // TRANSPORT_VPN is not allowed
         final String configString = String.join(";", TEST_IFACE, capabilities, ipConfig, transport);
 
-        final EthernetTrackerConfig config = new EthernetTrackerConfig(configString);
+        final EthernetConfigParser config = new EthernetConfigParser(configString);
         assertEquals(NetworkCapabilities.TRANSPORT_ETHERNET, config.mTransport);
     }
 
     @Test
-    public void testCreateEthernetTrackerConfigThrowsNpeWithNullInput() {
-        assertThrows(NullPointerException.class, () -> new EthernetTrackerConfig(null));
+    public void testCreateEthernetConfigParserThrowsNpeWithNullInput() {
+        assertThrows(NullPointerException.class, () -> new EthernetConfigParser(null));
     }
 
     @Test
