Esempio n. 1
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;
 }