getUpdate

fun <T : PackageVersion> getUpdate(versions: List<T>, packageInfo: PackageInfo, releaseChannels: List<String>? = null, includeKnownVulnerabilities: Boolean = false, preferencesGetter: () -> PackagePreference?? = null): T?

Returns a PackageVersion for the given packageInfo that is the suggested update or null if there is no suitable update in versions.

Parameters

versions

a sorted list of PackageVersion with highest version code first.

packageInfo

needs to be retrieved with GET_SIGNING_CERTIFICATES

releaseChannels

optional list of release channels to consider on top of stable. If this is null or empty, only versions without channel (stable) will be considered.

preferencesGetter

an optional way to consider additional per app preferences

includeKnownVulnerabilities

if true, versions with the PackageInfo.getLongVersionCode will be returned if PackageVersion.hasKnownVulnerability is true, even without real update.


fun <T : PackageVersion> getUpdate(versions: List<T>, allowedSignersGetter: () -> Set<String>?? = null, installedVersionCode: Long = 0, allowedReleaseChannels: List<String>? = null, includeKnownVulnerabilities: Boolean = false, preferencesGetter: () -> PackagePreference?? = null): T?

Returns the PackageVersion that is the suggested update for the given installedVersionCode or suggested for new installed if the given code is 0, or null if there is no suitable candidate in versions.

Parameters

versions

a sorted list of PackageVersion with highest version code first.

allowedSignersGetter

should return set of SHA-256 hashes of the signing certificates in lower-case hex. Only versions from these signers will be considered for installation. This is is null or returns null, all signers will be allowed. If the set of signers is empty, no signers will be allowed, i.e. only apps without signer.

allowedReleaseChannels

optional list of release channels to consider on top of stable. If this is null or empty, only versions without channel (stable) will be considered.

preferencesGetter

an optional way to consider additional per app preferences.

includeKnownVulnerabilities

if true, versions with the installedVersionCode will be returned if PackageVersion.hasKnownVulnerability is true, even without real update.