This is much faster and doesn't require a device. However, the test should also continue to run on-device as this is the sqlite version used in practice.
The IndexV2Updater fetches the new entry.jar, verifies it and then either processes a diff or the full index.
The RepoUpdater is a convenience class that encapsulates updating repos with potentially more than one format. It tries v2 first (in case the repo has upgraded) and falls back to v1 if the repo isn't known to support v2 already (downgrade protection).
One of those last minute requests for changing index structure...
We don't bother with making a new table for localizable repo icons. They just get serialized into the DB. If we ever need to update the structure, we can consider wiping the icons. They can get updated with a full index update.
In JSON, keys can come in any order, so we need to handle the case that we receive packages before the repo metadata. Now we explicitly clear data and rename the insert method to insertOrReplace in order to make it clear that data gets replaced.
Also, we pass the repoId into the constructor of the DB stream receivers to make clear that one receiver is meant to receive a single pre-existing repo.
and remove feature version as it app can't even use that.
Compatibility checking has been added to the DB layer as a post-processing step only because the UI wants to query for that on the app level (which would need all APKs).
Doing the actual update check is more work than it would be with keeping info about all installed apps in the DB. However, this way, we don't need to keep that info in sync with reality. Also, we need to check for updates only after updating repos, so there we are on a worker thread already anyway and an spare an extra second.
These are needed, so callers of the downloader can react to special errors.
Also signal that getInputStream() can throw NotFoundException for repo version fallback.
Also introduce interfaces for important classes, so they can be implemented by stuff like database classes as well. This makes UpdateChecker and CompatibilityChecker more generic.
Also add tests for CompatibilityChecker.
This uses hacky reflection and doesn't properly diff everything it could, but just what we need for the DB
This commit also sneaks in some last minute change requests for the indexV2 structure