diff options
-rw-r--r-- | core/java/android/net/EthernetDataTracker.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/net/EthernetDataTracker.java b/core/java/android/net/EthernetDataTracker.java index fb09ba5..28bd289 100644 --- a/core/java/android/net/EthernetDataTracker.java +++ b/core/java/android/net/EthernetDataTracker.java @@ -59,6 +59,8 @@ public class EthernetDataTracker implements NetworkStateTracker { private static String sIfaceMatch = ""; private static String mIface = ""; + private INetworkManagementService mNMService; + private static class InterfaceObserver extends INetworkManagementEventObserver.Stub { private EthernetDataTracker mTracker; @@ -117,6 +119,13 @@ public class EthernetDataTracker implements NetworkStateTracker { mIface = iface; } + // we don't get link status indications unless the iface is up - bring it up + try { + mNMService.setInterfaceUp(iface); + } catch (Exception e) { + Log.e(TAG, "Error upping interface " + iface + ": " + e); + } + mNetworkInfo.setIsAvailable(true); Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); msg.sendToTarget(); @@ -199,7 +208,7 @@ public class EthernetDataTracker implements NetworkStateTracker { // register for notifications from NetworkManagement Service IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); - INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); + mNMService = INetworkManagementService.Stub.asInterface(b); mInterfaceObserver = new InterfaceObserver(this); @@ -208,12 +217,12 @@ public class EthernetDataTracker implements NetworkStateTracker { sIfaceMatch = context.getResources().getString( com.android.internal.R.string.config_ethernet_iface_regex); try { - final String[] ifaces = service.listInterfaces(); + final String[] ifaces = mNMService.listInterfaces(); for (String iface : ifaces) { if (iface.matches(sIfaceMatch)) { mIface = iface; - service.setInterfaceUp(iface); - InterfaceConfiguration config = service.getInterfaceConfig(iface); + mNMService.setInterfaceUp(iface); + InterfaceConfiguration config = mNMService.getInterfaceConfig(iface); mLinkUp = config.isActive(); if (config != null && mHwAddr == null) { mHwAddr = config.getHardwareAddress(); @@ -230,7 +239,7 @@ public class EthernetDataTracker implements NetworkStateTracker { } try { - service.registerObserver(mInterfaceObserver); + mNMService.registerObserver(mInterfaceObserver); } catch (RemoteException e) { Log.e(TAG, "Could not register InterfaceObserver " + e); } |