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
 /** Report whether data connectivity is possible. */
 public boolean isAvailable() {
   return mNetworkInfo.isAvailable();
 }
Ejemplo n.º 3
0
 /** @return true - If are we currently tethered with another device. */
 public synchronized boolean isAvailable() {
   return mNetworkInfo.isAvailable();
 }