3601 Commits

Author SHA1 Message Date
Daniel Martí
cde57efb98 Rename App.suggestedVercode to App.suggestedVersionCode
Updates #37.
2016-04-19 22:44:22 +01:00
Daniel Martí
4d8e410176 Rename Apk.version to Apk.versionName
Updates #37.
2016-04-19 22:44:22 +01:00
Daniel Martí
1abbedc4ab Rename Apk.vercode to Apk.versionCode
Updates #37.
2016-04-19 22:44:22 +01:00
Daniel Martí
887bb171aa Remove media/, now in its own repo
See the new shiny https://gitlab.com/fdroid/artwork page for details.
The git history of media/ is preserved in the new repo.
2016-04-19 22:06:46 +01:00
Daniel Martí
ac22cc5266 Bump to 0.100-alpha4 v0.100-alpha4 2016-04-17 11:02:40 +01:00
F-Droid Translatebot
ca3e13ebf6 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz    Catalan
ageru                    French
Alberto Moshpirit        Spanish
Allan Nordhøy            Norwegian Bokmål
Enol P                   Asturian
ezjerry liao             Traditional Chinese
Green Lunar              Hebrew
Kristoffer Grundström    Swedish
Ldm Public               French
Marcelo Santana          Portuguese (Brazil)
Mladen Pejaković         Serbian
naofum                   Japanese
Pander                   Dutch
Sérgio Marques           Portuguese (Portugal)
Tobias Bannert           German
Verdulo                  Esperanto
Verdulo                  Polish
Yaron Shahrabani         Hebrew
YFdyh000                 Simplified Chinese
2016-04-17 11:00:38 +01:00
Daniel Martí
58aa19f392 Merge branch 'notify-download-progress' into 'master'
Show progress bar in download notification.

This enhances the download notification to include a progress bar of the downloads progress.

(It doesn't show the actual size of the download or the number of bytes downloaded in text yet. Need to think about internationalizing this from the `AppDetails` `updateProgress` method so that it is not copy-pasted in two places.)

See merge request !261
2016-04-17 09:39:14 +00:00
Peter Serwylo
6d603ada0d Show progress bar in download notification.
By providing the same notification id, the existing one is updated.
2016-04-17 09:10:22 +10:00
Hans-Christoph Steiner
8d7b5bff5d Merge branch 'build-fixes' into 'master'
Build fixes and library updates



See merge request !257
2016-04-14 18:52:18 +00:00
Daniel Martí
132519590f Bump accesspoint library to 0.2.0
This release allows for Android 6+ support, but we'll need to ask for
permissions at runtime too. This commit simply does one half of the work
needed to support Android 6 with all things wi-fi.

See the issue and example app commit for reference:

https://github.com/mvdan/accesspoint/issues/6
6284f0376b
2016-04-14 15:31:47 +01:00
Daniel Martí
27c9a21764 Gradle: Bump android plugin to 2.0.0
Also add useProgard true, since minifyEnabled now refers to the new
experimental code shrinker.

I'm not removing proguard yet as we depend on it for the samsung
workaround. I also do not know how to port the rest of the config
options to the new shrinker.
2016-04-14 15:31:47 +01:00
Daniel Martí
127c65b78d Bump support libs to 23.3.0
Also bump the CI image to include the updated support lib maven repo.
2016-04-14 15:31:47 +01:00
Daniel Martí
db798afb67 PMD: Do all java files like checkstyle
Not just the org.fdroid.* classes. No changes needed.
2016-04-14 15:31:47 +01:00
Daniel Martí
158668f378 Merge branch 'new-downloader-service' into 'master'
New DownloaderService

This merge request is too big, but I have all this work complete, so I'm submitting it now for review.  If there are bigger issues with parts, I can rebase it down to the uncontroversial bits to get things merged.

This replaces `ApkDownloader`, `AsyncDownload`, and `AsyncDownloadWrapper`, and puts the whole APK download procedure into a custom `Service` that is based on the source code for `IntentService`.  It can't be a subclass of `IntentService` because it needs to be cancelable.  This does not yet add back a notification for the downloading, e.g. #592.  That was handled before by the Android DownloadManager stuff, and was not replaced since that was disabled.

My current implementation does not filter out duplicate requests like discussed in #601.  While its possible to do, I think it'll complicate the code a lot, and I really think that should be handled elsewhere.  The UI should prevent the possibility of the user being able to submit duplicate install requests.  If not, even if `DownloaderService` filtered them out, it would still be a buggy UX since the user would be clicking install again or something like that even though the install was in progress.

This also moves the APK verification logic to the `Installer` side.  The downloading side can check the file size to see if the whole thing is downloaded.  And to be extra safe, it should not be possible to submit an APK for installation without it going through the verification procedure.  So the only method for installing APKs, `Installer.install()`, is where the verification now happens.   Also, the installer now always copies the APK to be installed into the safe location RE: the Cure53 audit issue.  This way, the APK download and cache dirs can be merged into one, making resumable downloads and cache management easy.

ping @mvdan @pserwylo @dschuermann 
more comments in the commit messages

See merge request !248
2016-04-14 14:00:06 +00:00
Daniel Martí
44f39793be Merge branch 'issue-490' into 'master'
Fix Cursor initialization deprecation

Closes Issue #490, Avoids usage of `deprecated` constructors and suppresses deprecation warnings.

See merge request !242
2016-04-14 13:58:10 +00:00
Hans-Christoph Steiner
74d1c9521d put up a notification for each completed download
This makes background installs and updates a lot easier
2016-04-13 11:08:54 -04:00
Hans-Christoph Steiner
d114f428e7 add "Auto Download" pref to enable auto-downloading of updates
Now that we have a nice background service, let's put it to work!  This
makes update APKs be automatically downloaded after the index is updated.
Then when the user goes to install the updates, they will not have to wait
for the download part.

#601 https://gitlab.com/fdroid/fdroidclient/issues/601
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
adcdc417ab add basic in progress Notification to DownloaderService
This is super basic, really just a placeholder to have something there. It
should be replaced with something much better as part of the UX overhaul.

#601 https://gitlab.com/fdroid/fdroidclient/issues/601
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
77e041d640 put stray preference handling into Preferences
This moves a few stray preference handling instances into Preferences, and
move the non-preference "lastUpdateCheck" state to local only to
UpdateService.  This will still work with existing installs since the
String constant value is the same.
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
721d4a300a add method to check if a URL is being handled by DownloaderService
This also saves the activeDownloadUrlString per packageName. Both are
necessary so that AppDetails can accurately display the current state
of a background download. Saving this per-packageName allows there to
be multiple active downloads in the background, then when people move
around AppDetails, it'll restore the progress meter and button state
when coming back to the app that they clicked install on.

By definition, there is just one DownloaderService enforced by
Android with a single active Downloader instance enforced by the
DownloaderService.  That means using a static variable maps directly
to those conditions and provides a really simple, implementation,
especially compared to what would have to happen to do it via messages
from the thread and any Activities.  If this ends up blocking testing
or something, it can always be changed when someone implements those
tests.
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
49635c224d show download errors in a Toast
There are many possible cryptic errors that can cause downloads to fail. So
just show the localized message from the Exception in an extended Toast.
These might not show up until AppDetails works better with the lifecycle of
downloads, but they are being sent :)

closes #496 https://gitlab.com/fdroid/fdroidclient/issues/496
closes #594 https://gitlab.com/fdroid/fdroidclient/issues/594
closes #599 https://gitlab.com/fdroid/fdroidclient/issues/599
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
3265c8634c implement resumable APK downloads for HttpDownloader
Moving towards having the Downloader always download directly into the
cache means its really easy to support resuming downloads.

This should also work for updates and icons, since it fetches the
Content Length via HTTP first.  The icon and update downloading code
needs to be adjusted to support that. For APKs, it probably makes
sense to include the file size from the index db to save the query
over the net.  That would be probably more helpful on Bluetooth.
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
fa766180bf download APKs into dir named after repo's hostname
This is to prevent conflicts if two repos have APKs with the same names,
but are not the same app/version.
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
ee37f26c4d verify APKs on install, and purge ApkDownloader
This moves the last piece of code to the DownloaderService model. Moving
the APK prep and verification to Installer.installPackage() makes it hard
to mess up and make bugs like installing from the External Storage issue
found by the Cure53 audit.
2016-04-13 11:07:17 -04:00
Hans-Christoph Steiner
d07c8b5d74 convert Installer's Exception into generic InstallFailedException
AndroidNotCompatibleException is not used for anything specific right now,
and in the process of adding verification to the start of the install
process, there will be other kinds of failures. So convert that Exception
into a general usage InstallFailedException.
2016-04-13 10:40:01 -04:00
Hans-Christoph Steiner
0b8796e56f add AndroidManifest parser for reading directly from APKs
This will make our algorithm choices a lot more flexible both in terms of
the Installer process and the swap repo process.
2016-04-13 10:40:01 -04:00
Hans-Christoph Steiner
fc9459d6c5 send Downloader progress on a 100 ms timer
No need to flood receivers with progress events since they are basically
always going to the UI, and the UI will only refresh every so often.  If
the refresh rate is 50Hz, then that's every 20ms.  100ms seems to make a
smooth enough progress bar, and saves some CPU time.  This becomes more
important if there are multiple downloads happening in the background, like
if we make DownloaderService support parallel downloads from different repos
2016-04-13 10:40:01 -04:00
Hans-Christoph Steiner
5e59f812ce port everything over to new Downloader.ACTION_PROGRESS
This replaces all of the previous progress events and listeners.
2016-04-13 10:40:01 -04:00
Hans-Christoph Steiner
2e3d2c84ae eliminate Interfaces used only internal to AppDetails class
When dealing with complex lifecycles like Fragments, it is important
to expose the reliance of the Fragment on the Activity, since they
have different lifecycles.

Just cast to AppDetails instead of adding complexity with unneeded
Interfaces.  The actual instance and class will be the same with or
without the Interfaces, so it does not help with lifecycle issues.
The methods that implement the interfaces only hide the fact that they
rely on an active instance of AppDetails, which can lead to
lifecycle-related crashes.

This is a step along the way to streamlining AppDetails Activity so that it
only uses Fragments when they are beneficial.
2016-04-13 10:40:01 -04:00
Hans-Christoph Steiner
20c66a825d use IntentService style to download all APKs via a queue
DownloaderService is based on IntentService to provide queued requests that
run in a background thread via the Handler and the HandlerThread.  It began
as the IntentService code, but it could not be a subclass because the
downloading needs to be cancelable.  IntentServices cannot be canceled and
they provide no visibility into their queue.

DownloaderService then announces relevant events via LocalBroadcastManager
and Intents with custom "action" Strings.

https://gitlab.com/fdroid/fdroidclient/issues/601 #601
2016-04-13 10:40:01 -04:00
Daniel Martí
d98d59a8d3 Merge branch 'check-privileged-certificate' into 'master'
Verify apk signature of privileged extension before installation

This implements a check that the signature of the extension apk is the same as the signature of F-Droid before installing the extension apk. Related issue: https://gitlab.com/fdroid/fdroidclient/issues/437

See merge request !256
2016-04-13 11:50:54 +00:00
Dominik Schürmann
15ec420db4 Check apk signature of privileged extension against F-Droid signature before installation 2016-04-13 13:35:48 +02:00
F-Droid Translatebot
f8ef7cda39 Pull translation updates from Weblate
Translators:

ezjerry liao    Traditional Chinese
Lev Lamberov    Russian
2016-04-13 09:54:01 +01:00
Daniel Martí
5fd591bbe8 Merge branch 'more-tests-and-bug-fixes' into 'master'
More tests and bug fixes

I pulled a few commits out of the !248 saga, and added a bug fix or two.  It would be easier if this was merged before !248 

ping @mvdan @pserwylo 

See merge request !255
2016-04-11 16:48:42 +00:00
Hans-Christoph Steiner
ed09b1af2d run UpdateService at lowest priority possible
Currently, UpdateService is running at default priority, which is the same
as the UI tasks, since it is a regular IntentService.  That means it would
put a noticable load on the device when running, especially on older
devices.  This should help with that.

#563 https://gitlab.com/fdroid/fdroidclient/issues/563
2016-04-11 11:26:21 -04:00
Hans-Christoph Steiner
22e40bfee1 port all but Provider tests to JUnit4 semantics
Android recently switched from JUnit 3 to 4 for its base testing classes.
It doesn't seem to support the old JUnit3 methods with gradle and AS. So
all the tests need to be ported to JUnit4 to work again.

#607 https://gitlab.com/fdroid/fdroidclient/issues/607
2016-04-11 11:26:21 -04:00
Hans-Christoph Steiner
6b3004160f HttpDownloaderTest: delete test files only if test succeeds
This helps with debugging. And since these tests run on the JVM,
deleteOnExit() actually works.
2016-04-11 11:26:21 -04:00
Hans-Christoph Steiner
eb93a38cf5 HttpDownloader: handle SSL errors like any other download error
Since SSLHandshakeException is a subclass of IOException, and all that is
happening is rethrowing an Exception, instead pass this one through so it
will be handled by the central Downloader error handling.  That's currently
just a Toast, but it can easily be expanded in the future.
2016-04-11 11:26:21 -04:00
Hans-Christoph Steiner
b86a30d40f fix expert mode version display when maxSdkVersion is MAX_VALUE
closes #616 https://gitlab.com/fdroid/fdroidclient/issues/616
2016-04-11 11:26:21 -04:00
Hans-Christoph Steiner
c4a1295095 move Theme handling to Preferences class
This is one of the last instances of direct SharedPreferences manipulation
in the code.  Moving it to Preferences like the rest.
2016-04-11 10:38:59 -04:00
Daniel Martí
230c06d536 Bump to 0.100-alpha3 v0.100-alpha3 2016-04-08 10:27:58 +01:00
Hans-Christoph Steiner
907507d27d Merge branch 'transition-v21' into 'master'
Shared element transition for app list item v21 and above

Shared element transitions for API level v21 and above  
![JJhZVJh](/uploads/05ff326b69176e2e793cd17dca63637f/JJhZVJh.gif)

See merge request !251
2016-04-06 09:00:54 +00:00
Paresh Chouhan
cdd0848927 Shared element transition for app list item v21 and above 2016-04-05 22:45:51 +05:30
Hans-Christoph Steiner
d846e18d7f Merge branch 'fixes-and-cleanups' into 'master'
fixes and cleanups related to ongoing DownloaderService work

This includes a fix for bug that @mvdan found in the processing of `Apk.maxSdkVersion`, as well as some cleanups related to the ongoing work in !248 . Indeed a couple of these commits were pulled out of that MR.

See merge request !253
2016-04-05 15:22:59 +00:00
Hans-Christoph Steiner
35c2ef8c1c re-add SNI support to guardianproject.info repo
Apparently, it uses SNI, but does not always fail without SNI support.
2016-04-05 13:06:25 +02:00
Hans-Christoph Steiner
fd51fad73b keep the core Downloader classes pure Java for easy testing 2016-04-05 12:44:01 +02:00
Hans-Christoph Steiner
514e83e604 convert Downloader's outputFile to a read-only property
Since Downloader's outputFile variable is final, it can safely be used
as a public property variable.  This makes it simple to use in
subclasses. Making it a public final variable rather than a getter
also communicates that the value does not change since there is no
getter method that could potentially change it.

http://binkley.blogspot.com/2005/01/read-only-properties-in-java.html
2016-04-05 12:44:01 +02:00
Hans-Christoph Steiner
9d69098605 purge unused code from Installer classes 2016-04-05 12:44:01 +02:00
Hans-Christoph Steiner
0e1584f083 ignore gradle.properties
This file is generated by Android Studio whenever I'm using a proxy like
Tor.  Its not used otherwise, and should not be checked into git.
2016-04-05 12:44:01 +02:00
Hans-Christoph Steiner
70864e3479 use custom proguard config for running tests
The new Android Testing Support library stuff causes proguard to freak
out, so make proguard ignore all that stuff when running tests.
2016-04-05 12:44:01 +02:00