Exemple #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;
 }
Exemple #2
0
 /**
  * Checks whether the UpdateSource is applicable for a given application. The package name of the
  * given app is checked against the list of packages for which an update source can provide
  * version information.
  *
  * @param app The application to check.
  * @return Whether the UpdateSource is valid for a given application.
  */
 public boolean is_applicable(InstalledApp app) {
   return is_applicable(app.get_package_name());
 }