private static String sIfaceMatch = "";
private static String mIface = "";
+ private INetworkManagementService mNMService;
+
private static class InterfaceObserver extends INetworkManagementEventObserver.Stub {
private EthernetDataTracker mTracker;
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();
// 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);
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();
}
try {
- service.registerObserver(mInterfaceObserver);
+ mNMService.registerObserver(mInterfaceObserver);
} catch (RemoteException e) {
Log.e(TAG, "Could not register InterfaceObserver " + e);
}