java类android.telephony.NeighboringCellInfo的实例源码

CellTracker.java 文件源码 项目:AIMSICDL 阅读 23 收藏 0 点赞 0 评论 0
/**
 *  Description:  TODO: add more info
 *
 *  Issues:
 *
 *      [ ]     Getting and comparing signal strengths between different RATs can be very
 *              tricky, since they all return different ranges of values. AOS doesn't
 *              specify very clearly what exactly is returned, even though people have
 *              a good idea, by trial and error.
 *
 *              See note in : SignalStrengthTracker.java
 *
 *  Notes:
 *
 *
 *
 */
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
    // Update Signal Strength
    if (signalStrength.isGsm()) {
        int dbm;
        if (signalStrength.getGsmSignalStrength() <= 2 ||
                signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
            // Unknown signal strength, get it another way
            String[] bits = signalStrength.toString().split(" ");
            dbm = Integer.parseInt(bits[9]);
        } else {
            dbm = signalStrength.getGsmSignalStrength();
        }
        mDevice.setSignalDbm(dbm);
    } else {
        int evdoDbm = signalStrength.getEvdoDbm();
        int cdmaDbm = signalStrength.getCdmaDbm();

        // Use lowest signal to be conservative
        mDevice.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
    }
    // Send it to signal tracker
    signalStrengthTracker.registerSignalStrength(mDevice.mCell.getCID(), mDevice.getSignalDBm());
    //signalStrengthTracker.isMysterious(mDevice.mCell.getCID(), mDevice.getSignalDBm());
}
b.java 文件源码 项目:letv 阅读 29 收藏 0 点赞 0 评论 0
public final int[] d() {
    if (this.c == 0) {
        return new int[0];
    }
    List<NeighboringCellInfo> neighboringCellInfo = this.q.getNeighboringCellInfo();
    if (neighboringCellInfo == null || neighboringCellInfo.size() == 0) {
        return new int[]{this.c};
    }
    Object obj = new int[((neighboringCellInfo.size() * 2) + 2)];
    obj[0] = this.c;
    obj[1] = this.a;
    int i = 2;
    for (NeighboringCellInfo neighboringCellInfo2 : neighboringCellInfo) {
        int cid = neighboringCellInfo2.getCid();
        if (cid > 0 && cid != SupportMenu.USER_MASK) {
            int i2 = i + 1;
            obj[i] = cid;
            i = i2 + 1;
            obj[i2] = neighboringCellInfo2.getRssi();
        }
    }
    Object obj2 = new int[i];
    System.arraycopy(obj, 0, obj2, 0, i);
    return obj2;
}
MethodProxies.java 文件源码 项目:TPlayer 阅读 29 收藏 0 点赞 0 评论 0
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    if (isFakeLocationEnable()) {
        List<VCell> cells = VirtualLocationManager.get().getNeighboringCell(getAppUserId(), getAppPkg());
        if (cells != null) {
            List<NeighboringCellInfo> infos = new ArrayList<>();
            for (VCell cell : cells) {
                NeighboringCellInfo info = new NeighboringCellInfo();
                mirror.android.telephony.NeighboringCellInfo.mLac.set(info, cell.lac);
                mirror.android.telephony.NeighboringCellInfo.mCid.set(info, cell.cid);
                mirror.android.telephony.NeighboringCellInfo.mRssi.set(info, 6);
                infos.add(info);
            }
            return infos;
        }
    }
    return super.call(who, method, args);
}
LegacyMeasurementParser.java 文件源码 项目:TowerCollector 阅读 19 收藏 0 点赞 0 评论 0
private void removeDuplicatedNeighbors(List<NeighboringCellInfo> neighboringCells, Measurement measurement) {
    List<NeighboringCellInfo> cellsToRemove = new ArrayList<NeighboringCellInfo>();
    Set<String> uniqueCellKeys = new HashSet<String>();

    uniqueCellKeys.add(createCellKey(measurement));
    for (NeighboringCellInfo cell : neighboringCells) {
        String key = createCellKey(cell, measurement);
        if (uniqueCellKeys.contains(key)) {
            Log.d("removeDuplicatedNeighbors(): Remove duplicated cell: %s", key);
            cellsToRemove.add(cell);
        } else {
            uniqueCellKeys.add(key);
        }
    }

    neighboringCells.removeAll(cellsToRemove);
}
MeasurementUpdater.java 文件源码 项目:TowerCollector 阅读 17 收藏 0 点赞 0 评论 0
public synchronized void setLastCellLocation(CellLocation cellLocation, NetworkGroup networkType,
                                             String operatorCode, String operatorName, List<NeighboringCellInfo> neighboringCells) {
    Log.d("setLastCellLocation(): Cell location updated: %s, network type: %s, operator code: %s, operator name: %s", cellLocation, networkType, operatorCode, operatorName);
    // check if any changes
    boolean cellChanged = (!isCellLocationEqual(lastCellLocation, cellLocation)
            || lastNetworkType != networkType
            || !lastOperatorCode.equals(operatorCode)
            || !lastOperatorName.equals(operatorName));
    // update last cell
    this.lastCellLocation = cellLocation;
    this.lastNetworkType = networkType;
    this.lastOperatorCode = operatorCode;
    this.lastOperatorName = operatorName;
    this.neighboringCells = neighboringCells;
    if (this.neighboringCells == null) {
        this.neighboringCells = EMPTY_NEIGHBORING_CELL_LIST;
    }
    if (cellChanged) {
        notifyIfReadyToProcess();
    }
}
CellLocationConverter.java 文件源码 项目:TowerCollector 阅读 20 收藏 0 点赞 0 评论 0
public void update(Measurement m, CellLocation cellLocation, int mcc, int mnc, NetworkGroup networkType) {
    if (cellLocation instanceof GsmCellLocation) {
        GsmCellLocation gsmCellLocation = (GsmCellLocation) cellLocation;
        if (gsmCellLocation.getCid() <= 65535 && gsmCellLocation.getPsc() == NeighboringCellInfo.UNKNOWN_CID) {
            m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), NetworkGroup.Gsm);
        } else {
            // fix invalid network types (unfortunately not possible to distinguish between UMTS and LTE)
            if (networkType == NetworkGroup.Gsm || networkType == NetworkGroup.Cdma)
                networkType = NetworkGroup.Unknown;
            int psc = gsmCellLocation.getPsc();
            if (psc == NeighboringCellInfo.UNKNOWN_CID || psc == Measurement.UNKNOWN_CID) {
                psc = Measurement.UNKNOWN_CID;
            } else if (psc >= 504) {
                // only UMTS networks support larger PSC
                networkType = NetworkGroup.Wcdma;
            }
            m.setGsmCellLocation(mcc, mnc, gsmCellLocation.getLac(), gsmCellLocation.getCid(), psc, networkType);
        }
    } else if (cellLocation instanceof CdmaCellLocation) {
        CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) cellLocation;
        m.setCdmaCellLocation(cdmaCellLocation.getSystemId(), cdmaCellLocation.getNetworkId(), cdmaCellLocation.getBaseStationId());
    } else {
        throw new UnsupportedOperationException("Cell location type not supported `" + cellLocation.getClass().getName() + "`");
    }
}
CellTracker.java 文件源码 项目:Android-IMSI-Catcher-Detector 阅读 18 收藏 0 点赞 0 评论 0
/**
 *  Description:  TODO: add more info
 *
 *  Issues:
 *
 *      [ ]     Getting and comparing signal strengths between different RATs can be very
 *              tricky, since they all return different ranges of values. AOS doesn't
 *              specify very clearly what exactly is returned, even though people have
 *              a good idea, by trial and error.
 *
 *              See note in : SignalStrengthTracker.java
 */
public void onSignalStrengthsChanged(SignalStrength signalStrength) {
    // Update Signal Strength
    if (signalStrength.isGsm()) {
        int dbm;
        if (signalStrength.getGsmSignalStrength() <= 2 ||
                signalStrength.getGsmSignalStrength() == NeighboringCellInfo.UNKNOWN_RSSI) {
            // Unknown signal strength, get it another way
            String[] bits = signalStrength.toString().split(" ");
            dbm = Integer.parseInt(bits[9]);
        } else {
            dbm = signalStrength.getGsmSignalStrength();
        }
        device.setSignalDbm(dbm);
    } else {
        int evdoDbm = signalStrength.getEvdoDbm();
        int cdmaDbm = signalStrength.getCdmaDbm();

        // Use lowest signal to be conservative
        device.setSignalDbm((cdmaDbm < evdoDbm) ? cdmaDbm : evdoDbm);
    }
    // Send it to signal tracker
    signalStrengthTracker.registerSignalStrength(device.cell.getCellId(), device.getSignalDBm());
    //signalStrengthTracker.isMysterious(device.cell.getCid(), device.getSignalDBm());
}
LoggingService.java 文件源码 项目:mobility-logger 阅读 26 收藏 0 点赞 0 评论 0
private void updateNeighboringCells(){
    /** Neighboring cells */
    List<NeighboringCellInfo> neighboringCellInfo;
    neighboringCellInfo = srvcTelephonyManager.getNeighboringCellInfo();

    /** Fill the hash tables depending on the network type*/
    for (NeighboringCellInfo i : neighboringCellInfo) {
        int networktype=i.getNetworkType();
        if ((networktype == TelephonyManager.NETWORK_TYPE_UMTS) || 
                (networktype == TelephonyManager.NETWORK_TYPE_HSDPA) ||
                (networktype == TelephonyManager.NETWORK_TYPE_HSUPA) ||
                (networktype == TelephonyManager.NETWORK_TYPE_HSPA))
            //neighborsmapUMTS.put(i.getPsc(), i.getRssi()-115);
            // Nexus 5 phone gives the actual rsrp instead of index level of CPICH
            neighborsmapUMTS.put(i.getPsc(), i.getRssi());
        else 
            neighborsmapGSM.put(i.getLac()+"-"+i.getCid(), (-113+2*(i.getRssi())));
    }
}
CellIdPre17API.java 文件源码 项目:tabulae 阅读 26 收藏 0 点赞 0 评论 0
public CellIdPre17API(TelephonyManager telephonyManager, CellLocation cellLocation, List<NeighboringCellInfo> neighboringCellInfoList) {
    if (DEBUG) Log.d(TAG, "CellIdPre17API:");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        fallback_pre17api = true;
    }
    this.cellLocation = cellLocation;
    this.neighboringCellInfoList = neighboringCellInfoList;
    if (cellLocation != null) {
        this.i = -1;
    } else {
        this.i = 0;
    }
    String mccmnc = telephonyManager.getNetworkOperator();
    if (mccmnc != null && mccmnc.length() >= 5 && mccmnc.length() <= 6) {
        mcc = Integer.parseInt(mccmnc.substring(0, 3));
        mnc = Integer.parseInt(mccmnc.substring(3));
    } else {
        Log.e(TAG, "CellIdPre17API: wrong legnth (5-6) for mccmnc=" + mccmnc);
    }
    type = telephonyManager.getNetworkType();
    if (DEBUG)
        Log.d(TAG, "CellIdPre17API: mcc=" + mcc + ", mnc=" + mnc + ", type=" + type + " cellLocation=" + cellLocation + ", neighboringCellInfoList=" + neighboringCellInfoList);
}
CellIdPre17API.java 文件源码 项目:tabulae 阅读 22 收藏 0 点赞 0 评论 0
public void fill(TheDictionary map, NeighboringCellInfo value) throws Exception {
    if (value != null) {
        map.put("mcc", mcc);
        map.put("mnc", mnc);
        int i;
        i = value.getPsc();
        if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("psc", i);
        i = value.getRssi();
        if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("rssi", i);
        i = value.getLac();
        if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("lac", i);
        i = value.getCid();
        if (i != NeighboringCellInfo.UNKNOWN_CID) map.put("cid", i);
        map.put("registered", false);
        determine_type(map);
    }
}
CellIdPre17API.java 文件源码 项目:Simplicissimus 阅读 19 收藏 0 点赞 0 评论 0
public CellIdPre17API(TelephonyManager telephonyManager, CellLocation cellLocation, List<NeighboringCellInfo> neighboringCellInfoList) {
    if (DEBUG) Log.d(TAG, "CellIdPre17API:");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        this.fallback_pre17api = true;
    }
    this.cellLocation = cellLocation;
    this.neighboringCellInfoList = neighboringCellInfoList;
    if (cellLocation != null) {
        this.i = -1;
    }
    else {
        this.i = 0;
    }
    String mccmnc = telephonyManager.getNetworkOperator();
    if (mccmnc != null && mccmnc.length() >= 5 && mccmnc.length() <= 6) {
        mcc = Integer.parseInt(mccmnc.substring(0, 3));
        mnc = Integer.parseInt(mccmnc.substring(3));
    }
    else {
        Log.e(TAG, "CellIdPre17API: wrong legnth (5-6) for mccmnc=" + mccmnc);
    }
    type = telephonyManager.getNetworkType();
    if (DEBUG) Log.d(TAG, "CellIdPre17API: mcc=" + mcc + ", mnc=" + mnc + ", type=" + type + " cellLocation=" + cellLocation + ", neighboringCellInfoList=" + neighboringCellInfoList);
}
CellbasedLocationProvider.java 文件源码 项目:LocalGSMLocationProvider 阅读 16 收藏 0 点赞 0 评论 0
/**
 * Add neighbouring cells as generated by the getNeighboringCells API.
 * @param neighbours The list of neighbouring cells.
 */
public void addNeighbours(List<NeighboringCellInfo> neighbours) {
    if (neighbours == null || neighbours.isEmpty()) return;
    for (NeighboringCellInfo neighbour : neighbours) {
        List<CellInfo> cellInfos = db.query(neighbour.getCid(), neighbour.getLac());
        if (cellInfos != null && !cellInfos.isEmpty()) {
            for (CellInfo cellInfo : cellInfos) {
                pushRecentCells(cellInfo);
            }
        } else {
            CellInfo ci = new CellInfo();
            ci.lng = 0d;
            ci.lat = 0d;
            ci.CID = neighbour.getCid();
            ci.LAC = neighbour.getLac();
            ci.MCC = -1;
            ci.MNC = -1;
            pushUnusedCells(ci);
        }
    }
}
CellbasedLocationProvider.java 文件源码 项目:LocalGSMLocationProvider 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Handle a modem event by trying to pull all information. The parameter inc defines if the
 * measurement counter should be increased on success.
 * @param inc True if the measurement counter should be increased.
 */
private void handle(boolean inc) {
    if (telephonyManager == null) return;
    final List<android.telephony.CellInfo> cellInfos = telephonyManager.getAllCellInfo();
    final List<NeighboringCellInfo> neighbours = telephonyManager.getNeighboringCellInfo();
    final CellLocation cellLocation = telephonyManager.getCellLocation();
    if (cellInfos == null || cellInfos.isEmpty()) {
        if (neighbours == null || neighbours.isEmpty()) {
            if (cellLocation == null || !(cellLocation instanceof GsmCellLocation)) return;
        }
    }
    if (inc) measurement.getAndIncrement();
    add(cellLocation);
    addNeighbours(neighbours);
    addCells(cellInfos);
    synchronized (recentCells) {
        cleanup();
    }
}
LoggingService.java 文件源码 项目:Mobilog 阅读 25 收藏 0 点赞 0 评论 0
private void updateNeighboringCells(){
    /** Neighboring cells */
    List<NeighboringCellInfo> neighboringCellInfo;
    neighboringCellInfo = srvcTelephonyManager.getNeighboringCellInfo();

    /** Fill the hash tables depending on the network type*/
    for (NeighboringCellInfo i : neighboringCellInfo) {
        int networktype=i.getNetworkType();
        if ((networktype == TelephonyManager.NETWORK_TYPE_UMTS) || 
                (networktype == TelephonyManager.NETWORK_TYPE_HSDPA) ||
                (networktype == TelephonyManager.NETWORK_TYPE_HSUPA) ||
                (networktype == TelephonyManager.NETWORK_TYPE_HSPA))
            neighborsmapUMTS.put(i.getPsc(), i.getRssi()-115);
        else 
            neighborsmapGSM.put(i.getLac()+"-"+i.getCid(), (-113+2*(i.getRssi())));
    }
}
PhoneUtils.java 文件源码 项目:Mobilyzer 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Returns the information about cell towers in range. Returns null if the information is 
 * not available 
 * 
 * TODO(wenjiezeng): As folklore has it and Wenjie has confirmed, we cannot get cell info from
 * Samsung phones.
 */
public String getCellInfo(boolean cidOnly) {
  initNetwork();
  List<NeighboringCellInfo> infos = telephonyManager.getNeighboringCellInfo();
  StringBuffer buf = new StringBuffer();
  String tempResult = "";
  if (infos.size() > 0) {
    for (NeighboringCellInfo info : infos) {
      tempResult = cidOnly ? info.getCid() + ";" : info.getLac() + "," 
                             + info.getCid() + "," + info.getRssi() + ";";
      buf.append(tempResult);
    }
    // Removes the trailing semicolon
    buf.deleteCharAt(buf.length() - 1);
    return buf.toString();
  } else {
    return null;
  }
}
CellIdPre17API.java 文件源码 项目:pyneo-wirelesslocation 阅读 19 收藏 0 点赞 0 评论 0
public CellIdPre17API(TelephonyManager telephonyManager, CellLocation cellLocation, List<NeighboringCellInfo> neighboringCellInfoList) {
    if (DEBUG) Log.d(TAG, "CellIdPre17API:");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        this.fallback_pre17api = true;
    }
    this.cellLocation = cellLocation;
    this.neighboringCellInfoList = neighboringCellInfoList;
    if (cellLocation != null) {
        this.i = -1;
    }
    else {
        this.i = 0;
    }
    String mccmnc = telephonyManager.getNetworkOperator();
    if (mccmnc != null && mccmnc.length() >= 5 && mccmnc.length() <= 6) {
        mcc = Integer.parseInt(mccmnc.substring(0, 3));
        mnc = Integer.parseInt(mccmnc.substring(3));
    }
    else {
        Log.e(TAG, "CellIdPre17API: wrong legnth (5-6) for mccmnc=" + mccmnc);
    }
    type = telephonyManager.getNetworkType();
    if (DEBUG) Log.d(TAG, "CellIdPre17API: mcc=" + mcc + ", mnc=" + mnc + ", type=" + type + " cellLocation=" + cellLocation + ", neighboringCellInfoList=" + neighboringCellInfoList);
}
PhoneUtils.java 文件源码 项目:Mobiperf-Library 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Returns the information about cell towers in range. Returns null if the information is 
 * not available 
 * 
 * TODO(wenjiezeng): As folklore has it and Wenjie has confirmed, we cannot get cell info from
 * Samsung phones.
 */
public String getCellInfo(boolean cidOnly) {
  initNetwork();
  List<NeighboringCellInfo> infos = telephonyManager.getNeighboringCellInfo();
  StringBuffer buf = new StringBuffer();
  String tempResult = "";
  if (infos.size() > 0) {
    for (NeighboringCellInfo info : infos) {
      tempResult = cidOnly ? info.getCid() + ";" : info.getLac() + "," 
                             + info.getCid() + "," + info.getRssi() + ";";
      buf.append(tempResult);
    }
    // Removes the trailing semicolon
    buf.deleteCharAt(buf.length() - 1);
    return buf.toString();
  } else {
    return null;
  }
}
RadioSectionFragment.java 文件源码 项目:satstat 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Requeries neighboring cells
 */
protected void updateNeighboringCellInfo() {
    try {
        /*
         * NeighboringCellInfo is not supported on some devices and will return no data. It lists
         * only GSM and successors' cells, but not CDMA cells.
         */
        List<NeighboringCellInfo> neighboringCells = mainActivity.telephonyManager.getNeighboringCellInfo();
        String networkOperator = mainActivity.telephonyManager.getNetworkOperator();
        mCellsGsm.updateAll(networkOperator, neighboringCells);
        mCellsLte.updateAll(networkOperator, neighboringCells);
    } catch (SecurityException e) {
        // Permission not granted, can't retrieve cell data
        Log.w(TAG, "Permission not granted, cannot get neighboring cell info");
    }
}
CellTracker.java 文件源码 项目:AIMSICDL 阅读 22 收藏 0 点赞 0 评论 0
private void handlePhoneStateChange() {
    List<NeighboringCellInfo> neighboringCellInfo = tm.getNeighboringCellInfo();
    if (neighboringCellInfo == null || neighboringCellInfo.size() == 0) {
        return;
    }

    Log.i(TAG, mTAG + "NeighbouringCellInfo empty - event based polling succeeded!");
    tm.listen(phoneStatelistener, PhoneStateListener.LISTEN_NONE);
    if (neighboringCellInfo == null) {
        neighboringCellInfo = new ArrayList<>();
    }
    neighboringCellBlockingQueue.addAll(neighboringCellInfo);
}
NeighboringCellInfoSubject.java 文件源码 项目:truth-android 阅读 15 收藏 0 点赞 0 评论 0
public static SubjectFactory<NeighboringCellInfoSubject, NeighboringCellInfo> type() {
  return new SubjectFactory<NeighboringCellInfoSubject, NeighboringCellInfo>() {
    @Override
    public NeighboringCellInfoSubject getSubject(FailureStrategy fs, NeighboringCellInfo that) {
      return new NeighboringCellInfoSubject(fs, that);
    }
  };
}
GSMCellLocationLbs.java 文件源码 项目:LBS 阅读 18 收藏 0 点赞 0 评论 0
public static void getCurrentLocation(Context context) {
    TelephonyManager mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

    // 返回值MCC + MNC
    String operator = mTelephonyManager.getNetworkOperator();
    int mcc = Integer.parseInt(operator.substring(0, 3));
    int mnc = Integer.parseInt(operator.substring(3));
    Log.i(TAG, " MCC = " + mcc + "\t MNC = " + mnc + "\t");
    // 中国移动和中国联通获取LAC、CID的方式
    GsmCellLocation location = (GsmCellLocation) mTelephonyManager.getCellLocation();
    int lac = location.getLac();
    int cellId = location.getCid();



    // 中国电信获取LAC、CID的方式
    CdmaCellLocation location1 = (CdmaCellLocation) mTelephonyManager.getCellLocation();
    lac = location1.getNetworkId();
    cellId = location1.getBaseStationId();
    cellId /= 16;

    Log.i(TAG, " MCC = " + mcc + "\t MNC = " + mnc + "\t LAC = " + lac + "\t CID = " + cellId);
    // 获取邻区基站信息
    List<NeighboringCellInfo> infos = mTelephonyManager.getNeighboringCellInfo();
    StringBuffer sb = new StringBuffer("总数 : " + infos.size() + "\n");
    for (NeighboringCellInfo info1 : infos) { // 根据邻区总数进行循环
        sb.append(" LAC : " + info1.getLac()); // 取出当前邻区的LAC
        sb.append(" CID : " + info1.getCid()); // 取出当前邻区的CID
        sb.append(" BSSS : " + (-113 + 2 * info1.getRssi()) + "\n"); // 获取邻区基站信号强度
    }

    Log.i(TAG, " 获取邻区基站信息:" + sb.toString());
}
CollectorService.java 文件源码 项目:TowerCollector 阅读 21 收藏 0 点赞 0 评论 0
private void processCellLocation(CellLocation cellLocation, List<NeighboringCellInfo> neighboringCells) {
    // get network type
    int networkTypeInt = telephonyManager.getNetworkType();
    NetworkGroup networkType = NetworkTypeUtils.getNetworkGroup(networkTypeInt);
    // get network operator (may be unreliable for CDMA)
    String networkOperatorCode = telephonyManager.getNetworkOperator();
    String networkOperatorName = telephonyManager.getNetworkOperatorName();
    Log.d("processCellLocation(): Operator code = '%s', name = '%s'", networkOperatorCode, networkOperatorName);
    Log.d("processCellLocation(): Reported %s neighboring cells", (neighboringCells != null ? neighboringCells.size() : null));
    measurementUpdater.setLastCellLocation(cellLocation, networkType, networkOperatorCode, networkOperatorName, neighboringCells);
}
CellLocationValidator.java 文件源码 项目:TowerCollector 阅读 21 收藏 0 点赞 0 评论 0
public boolean isValid(NeighboringCellInfo neighboringCell, Measurement measurement) {
    NetworkGroup netType = NetworkTypeUtils.getNetworkGroup(neighboringCell.getNetworkType());
    if (netType == NetworkGroup.Gsm) {
        return getGsmValidator().isValid(neighboringCell.getCid(), neighboringCell.getLac(), measurement.getMnc(), measurement.getMcc(), NeighboringCellInfo.UNKNOWN_CID);
    } else if (netType == NetworkGroup.Wcdma) {
        // NOTE: Maybe some phones return full set for WCDMA and then it should be valid
        return getGsmValidator().isValid(neighboringCell.getCid(), neighboringCell.getLac(), measurement.getMnc(), measurement.getMcc(), neighboringCell.getPsc());
    }
    return false;
}
CellLocationConverter.java 文件源码 项目:TowerCollector 阅读 22 收藏 0 点赞 0 评论 0
public void update(Measurement m, NeighboringCellInfo cell, int mcc, int mnc) {
    // no type checking because only GSM and UMTS cells can have neighboring cells
    NetworkGroup networkType = NetworkTypeUtils.getNetworkGroup(cell.getNetworkType());
    if (networkType == NetworkGroup.Gsm) {
        m.setGsmCellLocation(mcc, mnc, cell.getLac(), cell.getCid(), NetworkGroup.Gsm);
    } else {
        int psc = cell.getPsc();
        if (psc == NeighboringCellInfo.UNKNOWN_CID) {
            psc = Measurement.UNKNOWN_CID;
        }
        m.setGsmCellLocation(mcc, mnc, m.getLac(), m.getCid(), psc, NetworkGroup.Wcdma);
    }
}
UnitConverter.java 文件源码 项目:TowerCollector 阅读 16 收藏 0 点赞 0 评论 0
public static int convertGsmDbmToAsu(int dbm) {
    if (dbm == Measurement.UNKNOWN_SIGNAL || dbm == NeighboringCellInfo.UNKNOWN_RSSI)
        return Measurement.UNKNOWN_SIGNAL;
    if (dbm <= -113)
        return 0;
    int asu = (dbm + 113) / 2;
    if (asu > 31)
        return 31;
    return asu;
}
UnitConverter.java 文件源码 项目:TowerCollector 阅读 18 收藏 0 点赞 0 评论 0
public static int convertLteAsuToDbm(int asu) {
    if (asu == Measurement.UNKNOWN_SIGNAL || asu == NeighboringCellInfo.UNKNOWN_RSSI)
        return Measurement.UNKNOWN_SIGNAL;
    if (asu <= 0)
        return -140;
    if (asu >= 97)
        return -43;
    return asu - 140;
}
UnitConverter.java 文件源码 项目:TowerCollector 阅读 21 收藏 0 点赞 0 评论 0
public static int convertLteDbmToAsu(int dbm) {
    if (dbm == Measurement.UNKNOWN_SIGNAL || dbm == NeighboringCellInfo.UNKNOWN_RSSI)
        return Measurement.UNKNOWN_SIGNAL;
    if (dbm <= -140)
        return 0;
    if (dbm >= -43)
        return 97;
    return dbm + 140;
}
UnitConverter.java 文件源码 项目:TowerCollector 阅读 16 收藏 0 点赞 0 评论 0
public static int convertCdmaAsuToDbm(int asu) {
    if (asu == Measurement.UNKNOWN_SIGNAL || asu == NeighboringCellInfo.UNKNOWN_RSSI)
        return Measurement.UNKNOWN_SIGNAL;
    if (asu == 16)
        return -75;
    else if (asu == 8)
        return -82;
    else if (asu == 4)
        return -90;
    else if (asu == 2)
        return -95;
    else if (asu == 1)
        return -100;
    return Measurement.UNKNOWN_SIGNAL;
}
LegacyMeasurementProcessingEvent.java 文件源码 项目:TowerCollector 阅读 15 收藏 0 点赞 0 评论 0
public LegacyMeasurementProcessingEvent(Location lastLocation, long lastLocationObtainedTime,
                                        CellLocation lastCellLocation, SignalStrength lastSignalStrength, NetworkGroup lastNetworkType,
                                        String lastOperatorCode, String lastOperatorName, List<NeighboringCellInfo> neighboringCells,
                                        int minDistance) {
    this.lastLocation = lastLocation;
    this.lastLocationObtainedTime = lastLocationObtainedTime;
    this.lastCellLocation = lastCellLocation;
    this.lastSignalStrength = lastSignalStrength;
    this.lastNetworkType = lastNetworkType;
    this.neighboringCells = neighboringCells;
    this.lastOperatorCode = lastOperatorCode;
    this.lastOperatorName = lastOperatorName;
    this.minDistance = minDistance;
}
CellTracker.java 文件源码 项目:Android-IMSI-Catcher-Detector 阅读 19 收藏 0 点赞 0 评论 0
private void handlePhoneStateChange() {
    List<NeighboringCellInfo> neighboringCellInfo = tm.getNeighboringCellInfo();
    if (neighboringCellInfo == null || neighboringCellInfo.size() == 0) {
        return;
    }

    log.info("NeighboringCellInfo empty - event based polling succeeded!");
    tm.listen(phoneStatelistener, PhoneStateListener.LISTEN_NONE);
    if (neighboringCellInfo == null) {
        neighboringCellInfo = new ArrayList<>();
    }
    neighboringCellBlockingQueue.addAll(neighboringCellInfo);
}


问题


面经


文章

微信
公众号

扫码关注公众号