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
This commit is contained in:
@@ -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<String, NetworkInterfaceState> 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;
|
||||
return resources.get().getString(R.string.config_ethernet_tcp_buffers);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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,49 +132,17 @@ 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(
|
||||
return resources.get().getString(
|
||||
com.android.connectivity.resources.R.string.config_ethernet_iface_regex);
|
||||
}
|
||||
return match;
|
||||
}
|
||||
|
||||
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(
|
||||
return resources.get().getStringArray(
|
||||
com.android.connectivity.resources.R.array.config_ethernet_interfaces);
|
||||
}
|
||||
return interfaceConfigs;
|
||||
}
|
||||
}
|
||||
|
||||
EthernetTracker(@NonNull final Context context, @NonNull final Handler handler,
|
||||
|
||||
Reference in New Issue
Block a user