Пример #1
0
 /**
  * Returns the name of all the update sources available for a given package.
  *
  * @param app The app we want to check against.
  * @return A list of names for UpdateSources that can be used to check the application's version.
  */
 public static String[] get_sources(InstalledApp app) {
   ArrayList<String> res = new ArrayList<String>();
   if (get_update_sources() == null) {
     return new String[] {};
   }
   for (UpdateSource s : get_update_sources()) {
     if (s.is_applicable(app)) {
       res.add(s.get_name());
     }
   }
   String[] retval = new String[res.size()];
   res.toArray(retval);
   return retval;
 }
Пример #2
0
 /**
  * Returns the update source set for an app, or the first applicable one.
  *
  * @param app The target application.
  * @return An update source that can be used for this application, or null if no source could be
  *     found.
  */
 public static UpdateSource get_source(InstalledApp app) {
   if (get_update_sources() == null) {
     return null;
   }
   // Return the stored update source first, if available.
   if (app.get_update_source() != null) {
     UpdateSource s = get_source(app.get_update_source());
     if (s != null) { // False if the source has been removed from assets.json
       return s;
     }
   }
   // Find the first applicable source.
   for (UpdateSource s : get_update_sources()) {
     if (s.is_applicable(app)) {
       return s;
     }
   }
   return null;
 }