AppUpdateStatusManager and InstallManagerService should be using only the
Canonical URL of the package since that is the global unique ID. The actual
URL used to download it needs to be isolated in DownloaderService, which can
entirely manage the mirror selection process. This is just a bunch of
renaming to make this all clearer.
This adds a new PendingInstall event which broadcasts that an install
process has started, but the state of it is not yet known, like
whether it needs to be downloaded still, or is ready to install. It
marks the very first step of the whole InstallManagerService process.
Installer events should only be directly related to the install process as
managed by the Installer set of classes. The newer AppStatusUpdate stuff
now tracks the whole lifecycle of the process.
This mostly reverts f0d6acd974 since there is
now the overarching concept of "Pending Install" to mark packages that are
somewhere in the whole process.
refs #828
refs #1357
If you quickly cycle between installing an app and uninstalling it, then
`app.installedApk` will still be null when AppDetails2.startUninstall()
calls InstallerService.uninstall(). It is better to crash earlier here,
before the Intent is sent with a null APK, because InstallerService is set
to receive Sticky Intents. That means they will automatically be resent
by the system until they successfully complete.
This implements the APK Extension Files spec for finding, downloading, and
installing OBB files that are extension packs for APKs.
This needs WRITE_EXTERNAL_STORAGE since "installing" OBB files is just
copying them to a specific path on the external storage.
https://developer.android.com/google/play/expansion-files.html
Since e69a6d5a8f, the Apk instance is
provided in the constructor and is available as a final instance variable.
No need to pass it around. Thanks to @pserwylo for spotting this.
If F-Droid or InstallManagerService get killed while an install is in
progress, that install will ultimately broadcast back to
InstallManagerService to manage the notifications. The state is gone
since things have been killed, so include the Apk instance in the
Intent that is included in the broadcasts so that
InstallManagerService can fetch all required info from the database.
closes#698
F-Droid shouldn't crash if a push request includes a bad package name. This
just makes it silently ignore those push requests. If its a debug build,
it will send a message to logcat. I'm not sure this is best way to handle
this, but this is better than crashing the app. This will make it harder
for repo operators to debug issues with push requests.
The usage of ContentValues to send App/Apk objects
to services was an hack in my opinion.
This hack broke in https://gitlab.com/fdroid/fdroidclient/merge_requests/359
where the packageName has been removed from the
toContentValues() method, which leads to NPEs in
the services.
* moves apk verification back inside the Installer class
* uses support libs FileProvider for content Uris
* move apk file caching and storage methods into
ApkCache class
InstallManagerService and DownloaderService both use the download URL as
the unique ID to represent a given APK install through the whole lifecycle
of the install and download process. This converts the installer stuff to
use the same semantics. A Uri instance is mostly used there because its
the most useful format, but ultimately, the String, Uri, and int all derive
from the exact same URL. This then removes the local APK URI from use in
the installer broadcasts.
While I normally think reusing terms from Android is the best thing to do,
"originating URI" drives me nuts because it is almost nonsense English.
"Originating" is a verb in the continuous form, meaning that it is an
action that is ongoing. A URI is a static thing, and in this case, a URI
that points to a file that is completely downloaded. I left the term in
place for DefaultInstaller because it wraps PackageManager, which is where
that term originates.
This handles "Use strings instead of Uris in InstallManagerService for
urlString" as listed in #680