Ejemplo n.º 1
0
  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;
  }
Ejemplo n.º 2
0
  private EthernetDataTracker() {
    mNetworkInfo = new NetworkInfo(ConnectivityManager.TYPE_ETHERNET, 0, NETWORKTYPE, "");
    mLinkProperties = new LinkProperties();
    mLinkCapabilities = new LinkCapabilities();
    mLinkUp = false;

    mNetworkInfo.setIsAvailable(false);
    setTeardownRequested(false);
  }
Ejemplo n.º 3
0
  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();
  }
Ejemplo n.º 4
0
  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 = "";
  }