Merge "Ensure that Ethernet is supported if the service is running." am: 266fad4970
am: ace309a7ad
Change-Id: I6a1e8364c3e0801cf75e13920606ec04a1054e12
This commit is contained in:
@@ -37,6 +37,7 @@ import android.net.NetworkInfo.DetailedState;
|
|||||||
import android.net.NetworkInfo.State;
|
import android.net.NetworkInfo.State;
|
||||||
import android.net.NetworkRequest;
|
import android.net.NetworkRequest;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
|
import android.os.Looper;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.OsConstants;
|
import android.system.OsConstants;
|
||||||
@@ -110,6 +111,7 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
|||||||
@Override
|
@Override
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
Looper.prepare();
|
||||||
mContext = getContext();
|
mContext = getContext();
|
||||||
mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
|
||||||
@@ -279,11 +281,10 @@ public class ConnectivityManagerTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSupported(int networkType) {
|
private boolean isSupported(int networkType) {
|
||||||
// Change-Id I02eb5f22737720095f646f8db5c87fd66da129d6 added VPN support
|
|
||||||
// to all devices directly in software, independent of any external
|
|
||||||
// configuration.
|
|
||||||
return mNetworks.containsKey(networkType) ||
|
return mNetworks.containsKey(networkType) ||
|
||||||
(networkType == ConnectivityManager.TYPE_VPN);
|
(networkType == ConnectivityManager.TYPE_VPN) ||
|
||||||
|
(networkType == ConnectivityManager.TYPE_ETHERNET &&
|
||||||
|
mContext.getSystemService(Context.ETHERNET_SERVICE) != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsNetworkSupported() {
|
public void testIsNetworkSupported() {
|
||||||
|
|||||||
Reference in New Issue
Block a user