From b8e0167935004dca37b248ef6be5921077884498 Mon Sep 17 00:00:00 2001 From: Xiao Ma Date: Tue, 12 Apr 2022 23:45:22 +0900 Subject: [PATCH] Remove the legacy ethernet config resource check. The legacy ethernet config resource check isn't required any more when the legacy resource cleanup in outside callers finishes, just read the resource config from Connectivity module, but the value still can be overlaid with pre-built RRO. Bug: 214348333 Test: atest FrameworksNetTests Change-Id: I86f6229343f9d48f0bd822e8086bdc880b81135f --- .../ethernet/EthernetNetworkFactory.java | 23 +--------- .../server/ethernet/EthernetTracker.java | 46 +++---------------- 2 files changed, 8 insertions(+), 61 deletions(-) diff --git a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java index eb22f7875b..fe273357a4 100644 --- a/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java +++ b/service-t/src/com/android/server/ethernet/EthernetNetworkFactory.java @@ -19,7 +19,6 @@ package com.android.server.ethernet; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; -import android.content.res.Resources; import android.net.ConnectivityManager; import android.net.ConnectivityResources; import android.net.EthernetManager; @@ -71,8 +70,6 @@ public class EthernetNetworkFactory extends NetworkFactory { private final static int NETWORK_SCORE = 70; private static final String NETWORK_TYPE = "Ethernet"; - private static final String LEGACY_TCP_BUFFER_SIZES = - "524288,1048576,3145728,524288,1048576,2097152"; private final ConcurrentHashMap mTrackingInterfaces = new ConcurrentHashMap<>(); @@ -99,25 +96,9 @@ public class EthernetNetworkFactory extends NetworkFactory { return InterfaceParams.getByName(name); } - // TODO: remove legacy resource fallback after migrating its overlays. - private String getPlatformTcpBufferSizes(Context context) { - final Resources r = context.getResources(); - final int resId = r.getIdentifier("config_ethernet_tcp_buffers", "string", - context.getPackageName()); - return r.getString(resId); - } - public String getTcpBufferSizesFromResource(Context context) { - final String tcpBufferSizes; - final String platformTcpBufferSizes = getPlatformTcpBufferSizes(context); - if (!LEGACY_TCP_BUFFER_SIZES.equals(platformTcpBufferSizes)) { - // Platform resource is not the historical default: use the overlay. - tcpBufferSizes = platformTcpBufferSizes; - } else { - final ConnectivityResources resources = new ConnectivityResources(context); - tcpBufferSizes = resources.get().getString(R.string.config_ethernet_tcp_buffers); - } - return tcpBufferSizes; + final ConnectivityResources resources = new ConnectivityResources(context); + return resources.get().getString(R.string.config_ethernet_tcp_buffers); } } diff --git a/service-t/src/com/android/server/ethernet/EthernetTracker.java b/service-t/src/com/android/server/ethernet/EthernetTracker.java index 693d91ab5c..e9053dd654 100644 --- a/service-t/src/com/android/server/ethernet/EthernetTracker.java +++ b/service-t/src/com/android/server/ethernet/EthernetTracker.java @@ -25,7 +25,6 @@ import static com.android.internal.annotations.VisibleForTesting.Visibility.PACK import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; -import android.content.res.Resources; import android.net.ConnectivityResources; import android.net.EthernetManager; import android.net.IEthernetServiceListener; @@ -86,7 +85,6 @@ public class EthernetTracker { private static final boolean DBG = EthernetNetworkFactory.DBG; private static final String TEST_IFACE_REGEXP = TEST_TAP_PREFIX + "\\d+"; - private static final String LEGACY_IFACE_REGEXP = "eth\\d"; /** * Interface names we track. This is a product-dependent regular expression, plus, @@ -134,48 +132,16 @@ public class EthernetTracker { } public static class Dependencies { - // TODO: remove legacy resource fallback after migrating its overlays. - private String getPlatformRegexResource(Context context) { - final Resources r = context.getResources(); - final int resId = - r.getIdentifier("config_ethernet_iface_regex", "string", context.getPackageName()); - return r.getString(resId); - } - - // TODO: remove legacy resource fallback after migrating its overlays. - private String[] getPlatformInterfaceConfigs(Context context) { - final Resources r = context.getResources(); - final int resId = r.getIdentifier("config_ethernet_interfaces", "array", - context.getPackageName()); - return r.getStringArray(resId); - } - public String getInterfaceRegexFromResource(Context context) { - final String platformRegex = getPlatformRegexResource(context); - final String match; - if (!LEGACY_IFACE_REGEXP.equals(platformRegex)) { - // Platform resource is not the historical default: use the overlay - match = platformRegex; - } else { - final ConnectivityResources resources = new ConnectivityResources(context); - match = resources.get().getString( - com.android.connectivity.resources.R.string.config_ethernet_iface_regex); - } - return match; + final ConnectivityResources resources = new ConnectivityResources(context); + return resources.get().getString( + com.android.connectivity.resources.R.string.config_ethernet_iface_regex); } public String[] getInterfaceConfigFromResource(Context context) { - final String[] platformInterfaceConfigs = getPlatformInterfaceConfigs(context); - final String[] interfaceConfigs; - if (platformInterfaceConfigs.length != 0) { - // Platform resource is not the historical default: use the overlay - interfaceConfigs = platformInterfaceConfigs; - } else { - final ConnectivityResources resources = new ConnectivityResources(context); - interfaceConfigs = resources.get().getStringArray( - com.android.connectivity.resources.R.array.config_ethernet_interfaces); - } - return interfaceConfigs; + final ConnectivityResources resources = new ConnectivityResources(context); + return resources.get().getStringArray( + com.android.connectivity.resources.R.array.config_ethernet_interfaces); } }