public NetworkInfo getNetworkInfo() { if (FeatureOption.MTK_GEMINI_SUPPORT) { getPhoneService(true); /* * If the phone process has crashed in the past, we'll get a * RemoteException and need to re-reference the service. */ for (int retry = 0; retry < 2; retry++) { if (mPhoneService == null) { loge("Ignoring feature request because could not acquire PhoneService"); break; } try { /** * M: update availabe info due to it may not correct when we received from * ACTION_ANY_DATA_CONNECTION_STATE_CHANGED */ mNetworkInfo.setIsAvailable(mPhoneService.isDataConnectivityPossible()); log("getNetworkInfo: updated IsAvailable=" + mNetworkInfo.isAvailable()); } catch (RemoteException e) { if (retry == 0) getPhoneService(true); } } } return mNetworkInfo; }
private EthernetDataTracker() { mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORKTYPE, ""); mLinkProperties = new LinkProperties(); mLinkCapabilities = new LinkCapabilities(); mLinkUp = false; mNetworkInfo.setIsAvailable(false); setTeardownRequested(false); }
private void interfaceAdded(String iface) { if (!iface.matches(sIfaceMatch)) return; Log.d(TAG, "Adding " + iface); synchronized (mIface) { if (!mIface.isEmpty()) return; mIface = iface; } mNetworkInfo.setIsAvailable(true); Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); msg.sendToTarget(); runDhcp(); }
private void interfaceRemoved(String iface) { if (!iface.equals(mIface)) return; Log.d(TAG, "Removing " + iface); NetworkUtils.stopDhcp(mIface); mLinkProperties.clear(); mNetworkInfo.setIsAvailable(false); mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null); Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); msg.sendToTarget(); msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); msg.sendToTarget(); mIface = ""; }