Merge "Support WiFi only device at runtime." into kitkat-cts-dev

This commit is contained in:
Daniel Xie
2015-07-23 17:41:42 +00:00
committed by Gerrit Code Review

View File

@@ -30,6 +30,7 @@ import android.net.NetworkInfo.State;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
import android.util.Log; import android.util.Log;
import android.os.SystemProperties;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@@ -69,10 +70,14 @@ public class ConnectivityManagerTest extends AndroidTestCase {
// Get com.android.internal.R.array.networkAttributes // Get com.android.internal.R.array.networkAttributes
int resId = getContext().getResources().getIdentifier("networkAttributes", "array", "android"); int resId = getContext().getResources().getIdentifier("networkAttributes", "array", "android");
String[] naStrings = getContext().getResources().getStringArray(resId); String[] naStrings = getContext().getResources().getStringArray(resId);
//TODO: What is the "correct" way to determine if this is a wifi only device?
boolean wifiOnly = SystemProperties.getBoolean("ro.radio.noril", false);
for (String naString : naStrings) { for (String naString : naStrings) {
try { try {
NetworkConfig n = new NetworkConfig(naString); NetworkConfig n = new NetworkConfig(naString);
if (wifiOnly && ConnectivityManager.isNetworkTypeMobile(n.type)) {
continue;
}
mNetworks.put(n.type, n); mNetworks.put(n.type, n);
} catch (Exception e) {} } catch (Exception e) {}
} }