コード例 #1
0
ファイル: bp.java プロジェクト: ZoneMo/test
 public final void onSignalStrengthsChanged(SignalStrength paramSignalStrength) {
   super.onSignalStrengthsChanged(paramSignalStrength);
   if (bo.a(this.geG) == 2) bo.ep(paramSignalStrength.getCdmaDbm());
   if (bo.a(this.geG) == 1) bo.ep(-113 + 2 * paramSignalStrength.getGsmSignalStrength());
   if (bo.b(this.geG) != null) bo.b(this.geG).listen(bo.c(this.geG), 0);
   bo.d(this.geG);
 }
  private static int getNormalizedSignalStrength(int networkType, SignalStrength ss) {

    int level;

    switch (networkType) {
      case TelephonyManager.NETWORK_TYPE_EDGE:
      case TelephonyManager.NETWORK_TYPE_GPRS:
      case TelephonyManager.NETWORK_TYPE_UMTS:
      case TelephonyManager.NETWORK_TYPE_HSDPA:
      case TelephonyManager.NETWORK_TYPE_HSUPA:
      case TelephonyManager.NETWORK_TYPE_HSPA:
      case TelephonyManager.NETWORK_TYPE_HSPAP:
        level = ss.getGsmLevel();
        break;
      case TelephonyManager.NETWORK_TYPE_CDMA:
      case TelephonyManager.NETWORK_TYPE_1xRTT:
        level = ss.getCdmaLevel();
        break;
      case TelephonyManager.NETWORK_TYPE_EVDO_0:
      case TelephonyManager.NETWORK_TYPE_EVDO_A:
      case TelephonyManager.NETWORK_TYPE_EVDO_B:
        level = ss.getEvdoLevel();
        break;
      case TelephonyManager.NETWORK_TYPE_LTE:
        level = ss.getLteLevel();
        break;
      case TelephonyManager.NETWORK_TYPE_IDEN:
      case TelephonyManager.NETWORK_TYPE_EHRPD:
      default:
        return UNKNOWN;
    }

    return (level * LinkQualityInfo.NORMALIZED_SIGNAL_STRENGTH_RANGE)
        / SignalStrength.NUM_SIGNAL_STRENGTH_BINS;
  }
コード例 #3
0
 @Override
 public void onSignalStrengthsChanged(SignalStrength signalStrength) {
   super.onSignalStrengthsChanged(signalStrength);
   if (signalStrength.isGsm()) {
     int asu = signalStrength.getGsmSignalStrength();
     int RSSIindBM = -113 + 2 * asu;
     NotificationHelper notificationHelper = new NotificationHelper(getApplicationContext());
     SharedPreferences settings = getSharedPreferences("TiTiPreferences", 0);
     int threshold = settings.getInt("NetworkSignalStrengthThreshold", -90);
     if (RSSIindBM < threshold) {
       if (GlobalValuesNStatus.getInstance().muteSignalStrengthAlertForNTimes <= 0) {
         notificationHelper.createNotification(
             "TiTi",
             "Network Signal is getting poor... " + RSSIindBM + "db Calls may drop",
             6767,
             new Intent(getApplicationContext(), NetworkSignalStrengthSettings.class),
             true,
             false,
             "serious");
         GlobalValuesNStatus.getInstance().muteSignalStrengthAlertForNTimes =
             5; // mute for 5 occurrence
       } else {
         GlobalValuesNStatus.getInstance().muteSignalStrengthAlertForNTimes--;
       }
     } else {
       NotificationManager nMgr =
           (NotificationManager)
               getApplicationContext()
                   .getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
       nMgr.cancel(6767); // Signals improved cancel notification
       GlobalValuesNStatus.getInstance().muteSignalStrengthAlertForNTimes = 0;
     }
   }
 }
コード例 #4
0
  void updateSignalStrength(SignalStrength signalStrength) {
    if (mSignalStrength != null) {
      int state = mPhone.getServiceState().getState();
      Resources r = getResources();

      if ((ServiceState.STATE_OUT_OF_SERVICE == state) || (ServiceState.STATE_POWER_OFF == state)) {
        mSignalStrength.setSummary("0");
        return;
      }

      int signalDbm = signalStrength.getDbm();

      if (-1 == signalDbm) signalDbm = 0;

      int signalAsu = signalStrength.getAsuLevel();

      if (-1 == signalAsu) signalAsu = 0;

      mSignalStrength.setSummary(
          String.valueOf(signalDbm)
              + " "
              + r.getString(R.string.radioInfo_display_dbm)
              + "   "
              + String.valueOf(signalAsu)
              + " "
              + r.getString(R.string.radioInfo_display_asu));
    }
  }
コード例 #5
0
ファイル: bb.java プロジェクト: ZoneMo/test
 public final void onSignalStrengthsChanged(SignalStrength paramSignalStrength) {
   super.onSignalStrengthsChanged(paramSignalStrength);
   if (!paramSignalStrength.isGsm()) {
     ba.lL(paramSignalStrength.getCdmaDbm());
     return;
   }
   ba.lL(paramSignalStrength.getGsmSignalStrength());
 }
コード例 #6
0
ファイル: Cellular.java プロジェクト: jifalops/flat
 @Override
 public void onSignalStrengthsChanged(SignalStrength signalStrength) {
   CellLocationInfo.Params p = new CellLocationInfo.Params(baseStation);
   p.time = System.nanoTime();
   if (signalStrength.isGsm()) {
     p.asu = signalStrength.getGsmSignalStrength();
   } else {
     p.dbm = signalStrength.getCdmaDbm();
   }
   baseStation = new CellLocationInfo(p);
   notifyListeners(EVENT_CELL_STRENGTH);
 }
コード例 #7
0
ファイル: au.java プロジェクト: ZoneMo/com.tencent.mm
 public final void onSignalStrengthsChanged(SignalStrength paramSignalStrength) {
   super.onSignalStrengthsChanged(paramSignalStrength);
   if (at.a(iau) == 2) {
     at.iY(paramSignalStrength.getCdmaDbm());
   }
   if (at.a(iau) == 1) {
     at.iY(paramSignalStrength.getGsmSignalStrength() * 2 - 113);
   }
   if (at.b(iau) != null) {
     at.b(iau).listen(at.c(iau), 0);
   }
   at.d(iau);
 }
コード例 #8
0
  /**
   * send signal-strength-changed notification if changed Called both for solicited and unsolicited
   * signal strength updates
   *
   * @return true if the signal strength changed and a notification was sent.
   */
  protected boolean onSignalStrengthResult(AsyncResult ar, boolean isGsm) {
    SignalStrength oldSignalStrength = mSignalStrength;

    // This signal is used for both voice and data radio signal so parse
    // all fields

    if ((ar.exception == null) && (ar.result != null)) {
      mSignalStrength = (SignalStrength) ar.result;
      mSignalStrength.validateInput();
      mSignalStrength.setGsm(isGsm);
    } else {
      log("onSignalStrengthResult() Exception from RIL : " + ar.exception);
      mSignalStrength = new SignalStrength(isGsm);
    }

    return notifySignalStrength();
  }
コード例 #9
0
 // Get the Signal strength from the provider, each time there is an update
 @Override
 public void onSignalStrengthsChanged(SignalStrength signalStrength) {
   super.onSignalStrengthsChanged(signalStrength);
   sigLevel = signalStrength.getGsmSignalStrength();
   GsmCellLocation gsmInfo = (GsmCellLocation) phoneStateManager.getCellLocation();
   cellID = gsmInfo.getCid() / 10; // cut off sector ID
   postSignalLocation();
 }
コード例 #10
0
  private void sendLog() {
    if (mKaaStarted) {

      mSentLogCount++;
      mLastLogTime = System.currentTimeMillis();

      /*
       * Create an instance of a cell monitor log record and populate it with the latest values.
       */
      CellMonitorLog cellMonitorLog = new CellMonitorLog();
      cellMonitorLog.setLogTime(mLastLogTime);
      String networkOperator = mTelephonyManager.getNetworkOperator();
      if (networkOperator == null || networkOperator.isEmpty()) {
        cellMonitorLog.setNetworkOperatorCode(UNDEFINED);
      } else {
        cellMonitorLog.setNetworkOperatorCode(
            Integer.valueOf(mTelephonyManager.getNetworkOperator()));
      }
      cellMonitorLog.setNetworkOperatorName(mTelephonyManager.getNetworkOperatorName());

      int cid = UNDEFINED;
      int lac = UNDEFINED;

      if (mCellLocation != null && mCellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmCellLocation = (GsmCellLocation) mCellLocation;
        cid = gsmCellLocation.getCid();
        lac = gsmCellLocation.getLac();
      }

      cellMonitorLog.setGsmCellId(cid);
      cellMonitorLog.setGsmLac(lac);

      int gsmSignalStrength = UNDEFINED;

      if (mSignalStrength != null) {
        gsmSignalStrength = mSignalStrength.getGsmSignalStrength();
      }
      cellMonitorLog.setSignalStrength(gsmSignalStrength);

      org.kaaproject.kaa.demo.cellmonitor.Location phoneLocation =
          new org.kaaproject.kaa.demo.cellmonitor.Location();
      if (mGpsLocation != null) {
        phoneLocation.setLatitude(mGpsLocation.getLatitude());
        phoneLocation.setLongitude(mGpsLocation.getLongitude());
      }
      cellMonitorLog.setPhoneGpsLocation(phoneLocation);

      /*
       * Pass a cell monitor log record to the Kaa client. The Kaa client will upload
       * the log record according to the defined log upload strategy.
       */
      mClient.addLogRecord(cellMonitorLog);

      mEventBus.post(new LogSent());
    }
  }
コード例 #11
0
 protected boolean notifySignalStrength() {
   boolean notified = false;
   synchronized (mCellInfo) {
     if (!mSignalStrength.equals(mLastSignalStrength)) {
       try {
         mPhoneBase.notifySignalStrength();
         notified = true;
       } catch (NullPointerException ex) {
         loge(
             "updateSignalStrength() Phone already destroyed: "
                 + ex
                 + "SignalStrength not notified");
       }
     }
   }
   return notified;
 }
コード例 #12
0
ファイル: ThreeGLogger.java プロジェクト: redsniper/Logger
 @Override
 public void onSignalStrengthsChanged(SignalStrength signalStrength) {
   super.onSignalStrengthsChanged(signalStrength);
   m_ss = signalStrength.getGsmSignalStrength();
 }
コード例 #13
0
  @Override
  public LinkQualityInfo getLinkQualityInfo() {
    if (mNetworkInfo == null || mNetworkInfo.getType() == ConnectivityManager.TYPE_NONE) {
      // no data available yet; just return
      return null;
    }

    MobileLinkQualityInfo li = new MobileLinkQualityInfo();

    li.setNetworkType(mNetworkInfo.getType());

    mSamplingDataTracker.setCommonLinkQualityInfoFields(li);

    if (mNetworkInfo.getSubtype() != TelephonyManager.NETWORK_TYPE_UNKNOWN) {
      li.setMobileNetworkType(mNetworkInfo.getSubtype());

      NetworkDataEntry entry = getNetworkDataEntry(mNetworkInfo.getSubtype());
      if (entry != null) {
        li.setTheoreticalRxBandwidth(entry.downloadBandwidth);
        li.setTheoreticalRxBandwidth(entry.uploadBandwidth);
        li.setTheoreticalLatency(entry.latency);
      }

      if (mSignalStrength != null) {
        li.setNormalizedSignalStrength(
            getNormalizedSignalStrength(li.getMobileNetworkType(), mSignalStrength));
      }
    }

    SignalStrength ss = mSignalStrength;
    if (ss != null) {

      li.setRssi(ss.getGsmSignalStrength());
      li.setGsmErrorRate(ss.getGsmBitErrorRate());
      li.setCdmaDbm(ss.getCdmaDbm());
      li.setCdmaEcio(ss.getCdmaEcio());
      li.setEvdoDbm(ss.getEvdoDbm());
      li.setEvdoEcio(ss.getEvdoEcio());
      li.setEvdoSnr(ss.getEvdoSnr());
      li.setLteSignalStrength(ss.getLteSignalStrength());
      li.setLteRsrp(ss.getLteRsrp());
      li.setLteRsrq(ss.getLteRsrq());
      li.setLteRssnr(ss.getLteRssnr());
      li.setLteCqi(ss.getLteCqi());
    }

    if (VDBG) {
      Slog.d(
          TAG,
          "Returning LinkQualityInfo with"
              + " MobileNetworkType = "
              + String.valueOf(li.getMobileNetworkType())
              + " Theoretical Rx BW = "
              + String.valueOf(li.getTheoreticalRxBandwidth())
              + " gsm Signal Strength = "
              + String.valueOf(li.getRssi())
              + " cdma Signal Strength = "
              + String.valueOf(li.getCdmaDbm())
              + " evdo Signal Strength = "
              + String.valueOf(li.getEvdoDbm())
              + " Lte Signal Strength = "
              + String.valueOf(li.getLteSignalStrength()));
    }

    return li;
  }
コード例 #14
0
 /**
  * Create a new SignalStrength from a intent notifier Bundle
  *
  * <p>This method is used by PhoneStateIntentReceiver and maybe by external applications.
  *
  * @param m Bundle from intent notifier
  * @return newly created SignalStrength
  * @hide
  */
 public static SignalStrength newFromBundle(Bundle m) {
   SignalStrength ret;
   ret = new SignalStrength();
   ret.setFromNotifierBundle(m);
   return ret;
 }