Commit Graph

27 Commits

Author SHA1 Message Date
Torsten Grote decc2cc6e3
Add ktlint and run it in CI
Fixes formatting issues it found.

Also remove version variables from gradle scripts as they are not wanted by the project.
2022-02-16 09:43:19 -03:00
Torsten Grote 062c870f23
Move (Http)Downloader into download library 2022-02-16 09:43:18 -03:00
Hans-Christoph Steiner cf94cfb543
run Android Studio's Ctrl-Alt-O Organize Imports on all .java files 2021-04-13 10:23:59 +02:00
Hans-Christoph Steiner 021d5cc1ff
EXTRA_CANONICAL_URL instance must always be a String 2020-10-21 11:52:19 +02:00
Marcus Hoffmann 18592150c1 perform androidX migration through android studio
Project compiles and works fine after this.
2020-07-14 14:10:21 +02:00
Hans-Christoph Steiner 0aab6bc422 standardize on EXTRA_CANONICAL_URL throughout the code base
There were a few different constants used, this unifies them all into one,
so that it is easy to track where it is used, and what it means.
2019-03-28 11:41:10 +01:00
Hans-Christoph Steiner 3378c0a333 rename Canonical vs. Download URL in InstallManagerService process
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.
2019-03-28 11:41:10 +01:00
Hans-Christoph Steiner 148d1cdc8a rename AppDetails2 to AppDetailsActivity
This also moves it into org.fdroid.fdroid.views
2018-12-17 17:16:51 +01:00
Hans-Christoph Steiner 6f88dcdbf5 fix NewApi lint issue in InstallerService.uninstall
For whatever reason, this didn't seem to cause crashes on old devices. But
better safe than sorry.
2018-08-17 10:10:00 +02:00
Hans-Christoph Steiner a1edfdfc8d PendingInstall event for announcing start of process
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
2018-07-21 00:07:54 +02:00
Hans-Christoph Steiner 6c66697762 send ACTION_UNINSTALL_STARTED before any work has started
This needs to be broadcast as soon as possible so the UI can change to lock
out the user from doing conflicting actions.

refs #1357
2018-07-13 13:34:15 +02:00
Hans-Christoph Steiner 519101a8a4 prevent crash loop after rapid install/uninstall cycling
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.
2018-06-27 17:16:30 +02:00
Hans-Christoph Steiner fe260d931c use JobIntentService for CleanCache, DeleteCache, Installer, InstalledApp
This should ensure that these jobs complete before sleep, and also, they
should work more reliably with the new Android 8.0 background restrictions.
https://developer.android.com/reference/android/support/v4/app/JobIntentService.html #1426
2018-04-24 21:05:43 +02:00
Hans-Christoph Steiner 8affa08d11 auto-download and -install any associated OBB files
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
2016-10-06 19:12:01 +02:00
Hans-Christoph Steiner 372b28a71a Installer methods no longer need to accept Apk as an argument
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.
2016-09-29 13:58:33 +02:00
Hans-Christoph Steiner e69a6d5a8f store Apk instance in Installer instance for fetching state
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
2016-09-29 10:59:16 +02:00
Hans-Christoph Steiner b90cf7386c prevent crashing if push requests include bad packageNames
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.
2016-09-28 23:36:11 +02:00
Dominik Schürmann 2e92dc941b Use App/Apk parceling instead of ContentVals
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.
2016-07-25 17:50:28 +02:00
Dominik Schürmann 16f97125d7 Provide content Uris via FileProvider
* 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
2016-06-20 11:07:06 +02:00
Hans-Christoph Steiner 9d2fe4000d use download URL as unique ID through the whole install process
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
2016-06-01 22:29:36 +02:00
Dominik Schürmann 9e0787f23d Add javadoc to installer classes 2016-05-31 17:15:07 +02:00
Dominik Schürmann 13f2e30a40 Make InstallerService an IntentService
Because only one apk should be installed at a time
and no cancelation is required it is sufficient to
use an IntentService
2016-05-31 17:15:07 +02:00
Dominik Schürmann d6803e1bf4 Remove scopes from switch statements
also change two-case switch statements to if-else
2016-05-31 17:15:07 +02:00
Dominik Schürmann f860257826 Fix pmd errors and code style 2016-05-31 17:15:07 +02:00
Dominik Schürmann de1d310499 Move installation of extension into own Installer 2016-05-31 17:14:31 +02:00
Dominik Schürmann a2356b05d6 Refactor installer package 2016-05-31 17:13:53 +02:00
Dominik Schürmann 6d2f2d20a8 InstallerService 2016-05-31 17:13:26 +02:00