/** * Returns the hash string for a given target (add-on or platform.) * * @param target A non-null target. * @return A non-null hash string uniquely representing this target. */ public static String getTargetHashString(@NonNull IAndroidTarget target) { if (target.isPlatform()) { return getPlatformHashString(target.getVersion()); } else { return getAddonHashString( target.getVendor(), target.getName(), target.getVersion()); } }
DetailsTypes.AddonDetailsType addonDetails = (DetailsTypes.AddonDetailsType) p.getTypeDetails(); String addonHash = AndroidTargetHash.getAddonHashString( addonDetails.getVendor().getDisplay(), addonDetails.getTag().getDisplay(),
/** * Create a new add-on package descriptor. * <p> * The vendor id and the name id provided are used to compute the add-on's * target hash. * * @param version The android version of the add-on package. * @param revision The revision of the add-on package. * @param addonVendor The vendor id/display of the add-on package. * @param addonName The name id/display of the add-on package. * @return A {@link PkgDesc} describing this add-on package. */ @NonNull public static Builder newAddon(@NonNull AndroidVersion version, @NonNull Revision revision, @NonNull IdDisplay addonVendor, @NonNull IdDisplay addonName) { Builder p = new Builder(PkgType.PKG_ADDON); p.mAndroidVersion = version; p.mRevision = revision; p.mVendor = addonVendor; p.mNameIdDisplay = addonName; p.mPath = AndroidTargetHash.getAddonHashString(addonVendor.getDisplay(), addonName.getDisplay(), version); return p; }