예제 #1
0
 private static void addOrphanedSystemImage(
     ISystemImage image, IPkgDesc desc, Map<MissingTarget, MissingTarget> targets) {
   IdDisplay vendor = desc.getVendor();
   MissingTarget target =
       new MissingTarget(
           vendor == null ? null : vendor.getDisplay(),
           desc.getTag().getDisplay(),
           desc.getAndroidVersion());
   MissingTarget existing = targets.get(target);
   if (existing == null) {
     existing = target;
     targets.put(target, target);
   }
   existing.addSystemImage(image);
 }
예제 #2
0
  /**
   * Retrieves information on a package identified by an {@link AndroidVersion}.
   *
   * <p>Note: don't use this for {@link PkgType#PKG_SYS_IMAGE} since there can be more than one ABI
   * and this method only returns a single package per filter type.
   *
   * @param filter {@link PkgType#PKG_PLATFORM}, {@link PkgType#PKG_SAMPLE} or {@link
   *     PkgType#PKG_SOURCE}.
   * @param version The {@link AndroidVersion} specific for this package type.
   * @return An existing package information or null if not found.
   */
  @Nullable
  public LocalPkgInfo getPkgInfo(@NonNull PkgType filter, @NonNull AndroidVersion version) {
    assert filter == PkgType.PKG_PLATFORM
        || filter == PkgType.PKG_SAMPLE
        || filter == PkgType.PKG_SOURCE;

    for (LocalPkgInfo pkg : getPkgsInfos(filter)) {
      IPkgDesc d = pkg.getDesc();
      if (d.hasAndroidVersion() && d.getAndroidVersion().equals(version)) {
        return pkg;
      }
    }

    return null;
  }