/**
   * Count the number of days from the minimum entered Nepali date to the given Nepali date. If the
   * given Nepali date is out of range, an exception is thrown.
   *
   * @throws RuntimeException is entered date is out of range
   */
  private static int countDaysFromMinDay(int toYear, int toMonth, int toDay) {
    if (toYear < MIN_YEAR
        || toYear > MAX_YEAR
        || toMonth < 1
        || toMonth > 12
        || toDay < 1
        || toDay > NEPALI_YEAR_MONTHS.get(toYear)[toMonth]) {
      throw new RuntimeException("Date out of bounds");
    }

    int daysFromMinDay = -1;

    for (int year = MIN_YEAR; year <= toYear; year++) {
      int[] monthsInYear = NEPALI_YEAR_MONTHS.get(year);

      for (int month = 1; month <= 12; month++) {
        int daysInMonth = monthsInYear[month];

        for (int day = 1; day <= daysInMonth; day++) {
          daysFromMinDay++;

          if (year == toYear && month == toMonth && day == toDay) {
            return daysFromMinDay;
          }
        }
      }
    }

    throw new RuntimeException("Calculation error!");
  }
Beispiel #2
0
  /** Reports whether the bundle contains any parcelled file descriptors. */
  public boolean hasFileDescriptors() {
    if (!mFdsKnown) {
      boolean fdFound = false; // keep going until we find one or run out of data

      if (mParcelledData != null) {
        if (mParcelledData.hasFileDescriptors()) {
          fdFound = true;
        }
      } else {
        // It's been unparcelled, so we need to walk the map
        for (int i = mMap.size() - 1; i >= 0 && !fdFound; i--) {
          Object obj = mMap.valueAt(i);
          if (obj instanceof Parcelable) {
            if ((((Parcelable) obj).describeContents() & Parcelable.CONTENTS_FILE_DESCRIPTOR)
                != 0) {
              fdFound = true;
              break;
            }
          } else if (obj instanceof Parcelable[]) {
            Parcelable[] array = (Parcelable[]) obj;
            for (int n = array.length - 1; n >= 0; n--) {
              Parcelable p = array[n];
              if (p != null
                  && ((p.describeContents() & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0)) {
                fdFound = true;
                break;
              }
            }
          } else if (obj instanceof SparseArray) {
            SparseArray<? extends Parcelable> array = (SparseArray<? extends Parcelable>) obj;
            for (int n = array.size() - 1; n >= 0; n--) {
              Parcelable p = array.valueAt(n);
              if (p != null && (p.describeContents() & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0) {
                fdFound = true;
                break;
              }
            }
          } else if (obj instanceof ArrayList) {
            ArrayList array = (ArrayList) obj;
            // an ArrayList here might contain either Strings or
            // Parcelables; only look inside for Parcelables
            if (!array.isEmpty() && (array.get(0) instanceof Parcelable)) {
              for (int n = array.size() - 1; n >= 0; n--) {
                Parcelable p = (Parcelable) array.get(n);
                if (p != null
                    && ((p.describeContents() & Parcelable.CONTENTS_FILE_DESCRIPTOR) != 0)) {
                  fdFound = true;
                  break;
                }
              }
            }
          }
        }
      }

      mHasFds = fdFound;
      mFdsKnown = true;
    }
    return mHasFds;
  }
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   // Slog.d(TAG, "received " + action);
   if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
     int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL);
     if (userId >= 0) {
       getImplForUser(userId).sendInitialBroadcasts();
     } else {
       Slog.w(TAG, "Incorrect user handle supplied in " + intent);
     }
   } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
     for (int i = 0; i < mAppWidgetServices.size(); i++) {
       AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
       service.onConfigurationChanged();
     }
   } else {
     int sendingUser = getSendingUserId();
     if (sendingUser == UserHandle.USER_ALL) {
       for (int i = 0; i < mAppWidgetServices.size(); i++) {
         AppWidgetServiceImpl service = mAppWidgetServices.valueAt(i);
         service.onBroadcastReceived(intent);
       }
     } else {
       AppWidgetServiceImpl service = mAppWidgetServices.get(sendingUser);
       if (service != null) {
         service.onBroadcastReceived(intent);
       }
     }
   }
 }
 void resetProcessCrashTimeLocked(boolean resetEntireUser, int appId, int userId) {
   final ArrayMap<String, SparseArray<Long>> pmap = mProcessCrashTimes.getMap();
   for (int ip = pmap.size() - 1; ip >= 0; ip--) {
     SparseArray<Long> ba = pmap.valueAt(ip);
     for (int i = ba.size() - 1; i >= 0; i--) {
       boolean remove = false;
       final int entUid = ba.keyAt(i);
       if (!resetEntireUser) {
         if (userId == UserHandle.USER_ALL) {
           if (UserHandle.getAppId(entUid) == appId) {
             remove = true;
           }
         } else {
           if (entUid == UserHandle.getUid(userId, appId)) {
             remove = true;
           }
         }
       } else if (UserHandle.getUserId(entUid) == userId) {
         remove = true;
       }
       if (remove) {
         ba.removeAt(i);
       }
     }
     if (ba.size() == 0) {
       pmap.removeAt(ip);
     }
   }
 }
 final View J(int paramInt) {
   View localView = (View) nx.get(paramInt);
   if (localView != null) {
     nx.delete(paramInt);
   }
   return localView;
 }
  /**
   * Creates the list of {@link PhotoBoothModeAdapter.Mode} for the selection ui.
   *
   * @param context the {@link Context}.
   * @return the {@link SparseArray} of {@link PhotoBoothModeAdapter.Mode}.
   */
  private static SparseArray<PhotoBoothModeAdapter.Mode> createItems(Context context) {
    SparseArray<PhotoBoothModeAdapter.Mode> modes = new SparseArray<PhotoBoothModeAdapter.Mode>();

    // Add self-serve mode.
    PhotoBoothModeAdapter.Mode selfServeMode = new PhotoBoothModeAdapter.Mode();
    selfServeMode.mMode = PhotoBoothMode.SELF_SERVE;
    selfServeMode.mDisplayName =
        context.getString(R.string.photo_booth_mode_adapter__self_serve_display_name);
    selfServeMode.mDescription =
        context.getString(R.string.photo_booth_mode_adapter__self_serve_description);
    modes.put(PhotoBoothMode.SELF_SERVE.ordinal(), selfServeMode);

    // Add automatic mode.
    PhotoBoothModeAdapter.Mode automaticMode = new PhotoBoothModeAdapter.Mode();
    automaticMode.mMode = PhotoBoothMode.AUTOMATIC;
    automaticMode.mDisplayName =
        context.getString(R.string.photo_booth_mode_adapter__automatic_display_name);
    automaticMode.mDescription =
        context.getString(R.string.photo_booth_mode_adapter__automatic_description);
    modes.put(PhotoBoothMode.AUTOMATIC.ordinal(), automaticMode);

    // Add photographer mode.
    PhotoBoothModeAdapter.Mode photographerMode = new PhotoBoothModeAdapter.Mode();
    photographerMode.mMode = PhotoBoothMode.PHOTOGRAPHER;
    photographerMode.mDisplayName =
        context.getString(R.string.photo_booth_mode_adapter__photographer_display_name);
    photographerMode.mDescription =
        context.getString(R.string.photo_booth_mode_adapter__photographer_description);
    modes.put(PhotoBoothMode.PHOTOGRAPHER.ordinal(), photographerMode);

    return modes;
  }
 /* package */ VirtualDisplayAndroid addVirtualDisplay() {
   VirtualDisplayAndroid display = new VirtualDisplayAndroid(getNextVirtualDisplayId());
   assert mIdMap.get(display.getDisplayId()) == null;
   mIdMap.put(display.getDisplayId(), display);
   updateDisplayOnNativeSide(display);
   return display;
 }
 @Override
 public void run() {
   if (internaldetector.isOperational()) {
     if (null != mImage) {
       // ByteBuffer imgBuffr=
       Log.e(
           "IMG", "format : " + mImage.getFormat() + "  |  SIZE " + (mImage.getPlanes()).length);
       Frame frm =
           new Frame.Builder()
               .setImageData(
                   mImage.getPlanes()[0].getBuffer(),
                   mImage.getWidth(),
                   mImage.getHeight(),
                   ImageFormat.YV12)
               .build();
       SparseArray<Barcode> barcodes = internaldetector.detect(frm);
       for (int i = 0; i < barcodes.size(); i++) {
         if (barcodes.valueAt(i).rawValue.length() == 10
             || barcodes.valueAt(i).rawValue.length() == 13) {
           mBarcode = barcodes.valueAt(i).rawValue;
           Log.e("BARCODE", mBarcode);
         }
       }
     } else {
       Log.e("ImageReader", "NULL Image");
     }
   } else {
     Log.e("BARCODEERR", "Barcode not usable");
   }
   mImage.close();
   // internaldetector.s
 }
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    // Canvas background color depends on whether there is an active touch
    if (mHasTouch) {
      canvas.drawColor(BACKGROUND_ACTIVE);
    } else {
      // draw inactive border
      canvas.drawRect(
          mBorderWidth,
          mBorderWidth,
          getWidth() - mBorderWidth,
          getHeight() - mBorderWidth,
          mBorderPaint);
    }

    // loop through all active touches and draw them
    for (int i = 0; i < mTouches.size(); i++) {

      // get the pointer id and associated data for this index
      int id = mTouches.keyAt(i);
      TouchHistory data = mTouches.valueAt(i);

      // draw the data and its history to the canvas
      drawCircle(canvas, id, data);
    }
  }
Beispiel #10
0
  public static String getAppName(Context c, int uid, boolean withUid) {
    if (sSystemUids.get(uid) != null) {
      return sSystemUids.get(uid);
    }

    PackageManager pm = c.getPackageManager();
    String appName = "Unknown";
    String[] packages = pm.getPackagesForUid(uid);

    if (packages != null) {
      try {
        if (packages.length == 1) {
          appName = pm.getApplicationLabel(pm.getApplicationInfo(packages[0], 0)).toString();
        } else if (packages.length > 1) {
          appName = "";
          for (int i = 0; i < packages.length; i++) {
            appName += packages[i];
            if (i < packages.length - 1) {
              appName += ", ";
            }
          }
        }
      } catch (NameNotFoundException e) {
        Log.e(TAG, "Package name not found", e);
      }
    } else {
      Log.e(TAG, "Package not found for uid " + uid);
    }

    if (withUid) {
      appName += " (" + uid + ")";
    }

    return appName;
  }
Beispiel #11
0
  public static String getAppPackage(Context c, int uid) {
    if (sSystemUids.get(uid) != null) {
      return sSystemUids.get(uid);
    }

    PackageManager pm = c.getPackageManager();
    String[] packages = pm.getPackagesForUid(uid);
    String appPackage = "unknown";

    if (packages != null) {
      if (packages.length == 1) {
        appPackage = packages[0];
      } else if (packages.length > 1) {
        appPackage = "";
        for (int i = 0; i < packages.length; i++) {
          appPackage += packages[i];
          if (i < packages.length - 1) {
            appPackage += ", ";
          }
        }
      }
    } else {
      Log.e(TAG, "Package not found");
    }

    return appPackage;
  }
  @Override // Binder call
  public void registerCallback(IDisplayManagerCallback callback) {
    if (callback == null) {
      throw new IllegalArgumentException("listener must not be null");
    }

    synchronized (mSyncRoot) {
      int callingPid = Binder.getCallingPid();
      if (mCallbacks.get(callingPid) != null) {
        throw new SecurityException(
            "The calling process has already " + "registered an IDisplayManagerCallback.");
      }

      CallbackRecord record = new CallbackRecord(callingPid, callback);
      try {
        IBinder binder = callback.asBinder();
        binder.linkToDeath(record, 0);
      } catch (RemoteException ex) {
        // give up
        throw new RuntimeException(ex);
      }

      mCallbacks.put(callingPid, record);
    }
  }
 private int getResourceForMedia(Resources resources, Uri uri) {
   int drawable = 0;
   if (uri.getScheme().equals("file")) {
     if (uri.getLastPathSegment().endsWith("3gp")) {
       drawable = R.drawable.media_film;
     } else if (uri.getLastPathSegment().endsWith("jpg")) {
       drawable = R.drawable.media_camera;
     } else if (uri.getLastPathSegment().endsWith("txt")) {
       drawable = R.drawable.media_notepad;
     }
   } else if (uri.getScheme().equals("content")) {
     if (uri.getAuthority().equals(GPStracking.AUTHORITY + ".string")) {
       drawable = R.drawable.media_mark;
     } else if (uri.getAuthority().equals("media")) {
       drawable = R.drawable.media_speech;
     }
   }
   synchronized (sBitmapCache) {
     if (sBitmapCache.get(drawable) == null) {
       Bitmap bitmap = BitmapFactory.decodeResource(resources, drawable);
       sBitmapCache.put(drawable, bitmap);
     }
   }
   return drawable;
 }
  public static UniversalDate incrementMonth(UniversalDate date) {
    int year = date.year;
    int month = date.month;
    int day = date.day;

    month++;
    if (month > 12) {
      month = 1;
      year++;
    }

    if (year > MAX_YEAR) {
      year = MIN_YEAR;
    }

    if (day > NEPALI_YEAR_MONTHS.get(year)[month]) {
      day = NEPALI_YEAR_MONTHS.get(year)[month];
    }

    return new UniversalDate(
        year,
        month,
        day,
        toMillisFromJavaEpoch(year, month, day, date.millisFromJavaEpoch % MILLIS_IN_DAY));
  }
 @Override
 public void onNext(SparseArray sparseArray) {
   addressEntity.city = ((AddressEntity) sparseArray.get(Constants.LOCATION_TAG)).city;
   requestCities.clear();
   requestCities.addAll(
       (List<RequestCitiesEntity.RequestCity>) sparseArray.get(Constants.FORECAST_TAG));
 }
  static {
    sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    sMimeTypes = new SparseArray<String>();
    sUriMatcher.addURI(
        SmartKidContract.HomeSameCityList.AUTHORITY,
        SmartKidContract.HomeSameCityList.TABLE_NAME,
        1);
    sUriMatcher.addURI(
        SmartKidContract.HomeSameCityList.AUTHORITY,
        SmartKidContract.HomeSameCityList.TABLE_NAME + "/#",
        2);

    sMimeTypes.put(
        1,
        "vnd.android.cursor.dir/vnd."
            + SmartKidContract.HomeSameCityList.AUTHORITY
            + "."
            + SmartKidContract.HomeSameCityList.TABLE_NAME);
    sMimeTypes.put(
        2,
        "vnd.android.cursor.item/vnd."
            + SmartKidContract.HomeSameCityList.AUTHORITY
            + "."
            + SmartKidContract.HomeSameCityList.TABLE_NAME);
  }
  /** Convenience method to populate the UI Spinner with possible options. */
  private void populateSpinner() {
    //	Instantiate the adapter to later add items to Spinner
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    //	Place all of the names and IDs into a list for populating the spinner
    list = new SparseArray<String>();
    information = new SparseArray<String[]>();
    Field[] fields = R.xml.class.getFields();

    for (Field f : fields) {
      try {
        //	We need both the IDs and the Names, hence the use of SparseArray
        int id = f.getInt(null);
        String[] info =
            QuestionsDataStruct.readQuestionSetInformationOnly(QuestionTime.RESOURCES.getXml(id));
        list.append(id, info[QuestionsDataStruct.QUESTION_NAME]);
        information.append(id, info);
        adapter.add(info[QuestionsDataStruct.QUESTION_NAME]);
      } catch (IllegalArgumentException e) {
        Log.e(QuestionTime.TAG, e.getMessage());
      } catch (IllegalAccessException e) {
        Log.e(QuestionTime.TAG, e.getMessage());
      }
    }

    QUESTION_SETS.setAdapter(adapter);
  }
Beispiel #18
0
  /** Move all views remaining in activeViews to scrapViews. */
  void scrapActiveViews() {
    final View[] activeViews = this.activeViews;
    final int[] activeViewTypes = this.activeViewTypes;
    final boolean multipleScraps = viewTypeCount > 1;

    SparseArray<View> scrapViews = currentScrapViews;
    final int count = activeViews.length;
    for (int i = count - 1; i >= 0; i--) {
      final View victim = activeViews[i];
      if (victim != null) {
        int whichScrap = activeViewTypes[i];

        activeViews[i] = null;
        activeViewTypes[i] = -1;

        if (!shouldRecycleViewType(whichScrap)) {
          continue;
        }

        if (multipleScraps) {
          scrapViews = this.scrapViews[whichScrap];
        }
        scrapViews.put(i, victim);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
          victim.setAccessibilityDelegate(null);
        }
      }
    }

    pruneScrapViews();
  }
 public List<FileDownloaderModel> getAllTask() {
   List<FileDownloaderModel> allTask = new ArrayList<>();
   for (int i = 0; i < mAllTasks.size(); i++) {
     allTask.add(mAllTasks.valueAt(i));
   }
   return allTask;
 }
 /** Refreshes the fragments currently in the transactions activity */
 @Override
 public void refresh(long accountId) {
   for (int i = 0; i < mFragmentPageReferenceMap.size(); i++) {
     mFragmentPageReferenceMap.valueAt(i).refresh(accountId);
   }
   mTitlePageIndicator.notifyDataSetChanged();
 }
  /* package */ void removeVirtualDisplay(VirtualDisplayAndroid display) {
    DisplayAndroid displayAndroid = mIdMap.get(display.getDisplayId());
    assert displayAndroid == display;

    if (mNativePointer != 0) nativeRemoveDisplay(mNativePointer, display.getDisplayId());
    mIdMap.remove(display.getDisplayId());
  }
    @Override
    public void endElement(String nsURI, String strippedName, String tagName) throws SAXException {
      strippedName = strippedName.trim();
      String name = strippedName.length() == 0 ? tagName.trim() : strippedName;

      if (name.equalsIgnoreCase("across")) {
        inAcross = false;
      } else if (name.equalsIgnoreCase("down")) {
        inDown = false;
      } else if (name.equalsIgnoreCase("crossword")) {
        int numberOfClues = acrossNumToClueMap.size() + downNumToClueMap.size();
        puz.setNumberOfClues(numberOfClues);
        String[] rawClues = new String[numberOfClues];
        int i = 0;
        for (int clueNum = 1; clueNum <= maxClueNum; clueNum++) {
          String clue = acrossNumToClueMap.get(clueNum);
          if (clue != null) {
            rawClues[i] = clue;
            i++;
          }

          clue = downNumToClueMap.get(clueNum);
          if (clue != null) {
            rawClues[i] = clue;
            i++;
          }
        }
        puz.setRawClues(rawClues);
      }
    }
    private void registerClientLocked(IMediaRouterClient client,
            int pid, String packageName, int userId, boolean trusted) {
        final IBinder binder = client.asBinder();
        ClientRecord clientRecord = mAllClientRecords.get(binder);
        if (clientRecord == null) {
            boolean newUser = false;
            UserRecord userRecord = mUserRecords.get(userId);
            if (userRecord == null) {
                userRecord = new UserRecord(userId);
                newUser = true;
            }
            clientRecord = new ClientRecord(userRecord, client, pid, packageName, trusted);
            try {
                binder.linkToDeath(clientRecord, 0);
            } catch (RemoteException ex) {
                throw new RuntimeException("Media router client died prematurely.", ex);
            }

            if (newUser) {
                mUserRecords.put(userId, userRecord);
                initializeUserLocked(userRecord);
            }

            userRecord.mClientRecords.add(clientRecord);
            mAllClientRecords.put(binder, clientRecord);
            initializeClientLocked(clientRecord);
        }
    }
Beispiel #24
0
  public String processCommand(String command) {
    BaseCmd commandCmd = null;
    int cmd_result = BaseCmd.COMMAND_OK;
    String result = COMMAND_OK_STR;

    for (int i = 0; i <= m_command_list.size(); i++) {
      commandCmd = m_command_list.get(Integer.valueOf(i));
      if (commandCmd == null) {
        continue;
      }

      cmd_result = commandCmd.checkCommand(command);
      if (cmd_result == BaseCmd.COMMAND_UNSUPPORTED) {
        continue;
      } else if (cmd_result == BaseCmd.COMMAND_SUGGESTION) {
        result = commandCmd.getCmdName();
        return result;
      } else {
        Log.d(TAG, "processing command: " + command);
        cmd_result = commandCmd.process();
        break;
      }
    }

    return result;
  }
Beispiel #25
0
 public static Object getData(View view, int id) {
   SparseArray<Object> viewHolder = (SparseArray<Object>) view.getTag();
   if (viewHolder == null) {
     return null;
   }
   return viewHolder.get(id);
 }
  private void addNewItems() {

    currentChildCount = getChildCount();
    parentLayout = false;
    int start = itemIds.size();
    int end = Math.min(start + screenMaxColumns * rows * 2, adapter.getCount());

    for (int i = start; i < end; i++) {
      int left = (i / rows) * (itemWidth + spaceHori);
      int top = (i % rows) * (spaceVert + itemHeight);
      RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(itemWidth, itemHeight);
      rlp.setMargins(left, top, 0, 0);
      View child = adapter.getView(i, null, this);
      this.addView(child, rlp);
      int viewId = child.getId();
      if (viewId == -1) {
        viewId = TvUtil.buildId();
        // 此处硬设置id同时建议开发者不用此范围id
      }
      child.setId(viewId);
      itemIds.put(viewId, i);
      bindEventOnChild(child, i);
      layoutFlag = true;
    }

    colCount = itemIds.size() % rows == 0 ? itemIds.size() / rows : itemIds.size() / rows + 1;
  }
  /**
   * Add only the SectionHeaders that have history items within their range to a SparseArray, where
   * the array index is the position of the header in the history-only (no clients) ordering.
   *
   * @param c data Cursor
   * @param sparseArray SparseArray to populate
   */
  private static void populateSectionHeaders(Cursor c, SparseArray<SectionHeader> sparseArray) {
    sparseArray.clear();

    if (c == null || !c.moveToFirst()) {
      return;
    }

    SectionHeader section = null;

    do {
      final int historyPosition = c.getPosition();
      final long visitTime =
          c.getLong(c.getColumnIndexOrThrow(BrowserContract.History.DATE_LAST_VISITED));
      final SectionHeader itemSection = CombinedHistoryPanel.getSectionFromTime(visitTime);

      if (section != itemSection) {
        section = itemSection;
        sparseArray.append(historyPosition + sparseArray.size(), section);
      }

      if (section == SectionHeader.OLDER_THAN_SIX_MONTHS) {
        break;
      }
    } while (c.moveToNext());
  }
Beispiel #28
0
 public void removeAllPops() {
   int size = popupWindows.size();
   for (int i = 0; i < size; i++) {
     int key = popupWindows.keyAt(i);
     removePop(key);
   }
 }
  /**
   * Start activity for result.
   *
   * @param intent Intent to start activity.
   * @param callback Result call-back.
   * @return Handle to this operation.
   */
  public Handle startActivityForResult(Intent intent, ActivityResultCallback callback) {
    // check parameter
    if (intent == null) {
      Log.e(TAG, "startActivityForResult() - No intent");
      return null;
    }

    // check state
    this.verifyAccess();

    // generate request code
    int requestCode = 64;
    for (; requestCode > 0; --requestCode) {
      if (m_ActivityResultHandles.get(requestCode) == null) break;
    }
    if (requestCode <= 0) {
      Log.e(TAG, "startActivityForResult() - No available request code");
      return null;
    }

    // create handle
    ActivityResultHandle handle = new ActivityResultHandle(callback);
    m_ActivityResultHandles.put(requestCode, handle);

    // start activity for result
    try {
      this.startActivityForResult(intent, requestCode);
      return handle;
    } catch (Throwable ex) {
      Log.e(TAG, "startActivityForResult() - Fail to start activity", ex);
      m_ActivityResultHandles.delete(requestCode);
      return null;
    }
  }
 private void clearSatellites() {
   int satellitesCount = mSatellites.size();
   for (int i = 0; i < satellitesCount; i++) {
     GpsSatellite satellite = mSatellites.valueAt(i);
     satellite.mValid = false;
   }
 }