Lookup private resources in run-time
This fixes the following cases for us:
android.net.cts.ConnectivityManagerTest#testGetAllNetworkInfo
android.net.cts.ConnectivityManagerTest#testGetNetworkInfo
android.net.cts.ConnectivityManagerTest#testIsNetworkSupported
android.net.cts.ConnectivityManagerTest#testRequestRouteToHost
android.net.cts.ConnectivityManagerTest#testSetNetworkPreference
We need to use the prebuilt binary but that has dependency to
private resource identities that differs in our environment. With
this change the resources are looked up in run-time to avoid the
build time dependency.
Change-Id: I6579338b591ca7a0da3f03f796136269c7789780
(cherry picked from commit b29370db34)
This commit is contained in:
@@ -66,8 +66,10 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
||||
mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
|
||||
mPackageManager = getContext().getPackageManager();
|
||||
|
||||
String[] naStrings = getContext().getResources().getStringArray(
|
||||
com.android.internal.R.array.networkAttributes);
|
||||
// Get com.android.internal.R.array.networkAttributes
|
||||
int resId = getContext().getResources().getIdentifier("networkAttributes", "array", "android");
|
||||
String[] naStrings = getContext().getResources().getStringArray(resId);
|
||||
|
||||
for (String naString : naStrings) {
|
||||
try {
|
||||
NetworkConfig n = new NetworkConfig(naString);
|
||||
@@ -75,8 +77,9 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
|
||||
int[] protectedNetworks = getContext().getResources().getIntArray(
|
||||
com.android.internal.R.array.config_protectedNetworks);
|
||||
// Get com.android.internal.R.array.config_protectedNetworks
|
||||
resId = getContext().getResources().getIdentifier("config_protectedNetworks", "array", "android");
|
||||
int[] protectedNetworks = getContext().getResources().getIntArray(resId);
|
||||
for (int p : protectedNetworks) {
|
||||
mProtectedNetworks.add(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user