Exemplo n.º 1
0
 /** @return all available cell information or null if none. */
 public List<CellInfo> getAllCellInfo() {
   CellInfoResult result = new CellInfoResult();
   if (VDBG) log("SST.getAllCellInfo(): E");
   int ver = mCi.getRilVersion();
   if (ver >= 8) {
     if (isCallerOnDifferentThread()) {
       if ((SystemClock.elapsedRealtime() - mLastCellInfoListTime)
           > LAST_CELL_INFO_LIST_MAX_AGE_MS) {
         Message msg = obtainMessage(EVENT_GET_CELL_INFO_LIST, result);
         synchronized (result.lockObj) {
           result.list = null;
           mCi.getCellInfoList(msg);
           try {
             result.lockObj.wait(5000);
           } catch (InterruptedException e) {
             e.printStackTrace();
           }
         }
       } else {
         if (DBG) log("SST.getAllCellInfo(): return last, back to back calls");
         result.list = mLastCellInfoList;
       }
     } else {
       if (DBG) log("SST.getAllCellInfo(): return last, same thread can't block");
       result.list = mLastCellInfoList;
     }
   } else {
     if (DBG) log("SST.getAllCellInfo(): not implemented");
     result.list = null;
   }
   synchronized (result.lockObj) {
     if (result.list != null) {
       if (DBG) log("SST.getAllCellInfo(): X size=" + result.list.size() + " list=" + result.list);
       return result.list;
     } else {
       if (DBG) log("SST.getAllCellInfo(): X size=0 list=null");
       return null;
     }
   }
 }