824 Commits

Author SHA1 Message Date
Daniel Martí
b4e23c2cbc Make most fields in AsyncDownloader final 2015-09-11 15:48:21 -07:00
Daniel Martí
0c9c93e493 Fix some javadoc warnings 2015-09-11 15:47:38 -07:00
Daniel Martí
9cbefca4bb Code cleanup via AS 2015-09-11 15:34:05 -07:00
Daniel Martí
0f8c310c8d Optimize imports via AS 2015-09-11 15:32:22 -07:00
Daniel Martí
110a004d59 AppDetalis: Avoid division by zero crash 2015-09-11 15:26:56 -07:00
Toby Kurien
6d6d9bc7cd Follow download progress in AppDetails
Added a new thread to update the AppDetails screen with the progress of the
download once per second.
2015-09-11 15:14:22 -07:00
Daniel Martí
860bc8ae97 Apply some checkstyle fixes 2015-09-11 14:45:19 -07:00
Daniel Martí
1dfe3d962f Hasher cleanup and simplification 2015-09-11 13:07:53 -07:00
Daniel Martí
27f212f3ec Use Writer, always close FileWriter exactly once 2015-09-11 13:07:53 -07:00
Daniel Martí
d415ceae15 Block formatting fixes 2015-09-10 19:04:18 -07:00
Daniel Martí
cba2e67a70 Cleanup after bluetooth-swap merge 2015-09-10 19:00:09 -07:00
Daniel Martí
42d31eb0e6 Fix build after bluetooth-swap merge 2015-09-10 18:56:47 -07:00
Daniel Martí
2159b3d49b Merge branch 'bluetooth-swap' of https://gitlab.com/n8fr8/fdroidclient 2015-09-10 18:52:52 -07:00
Daniel Martí
cc8b9bb41d Fix formatting error in WifiStateChangeService
It's %d, not %i.
2015-09-10 18:29:48 -07:00
n8fr8
6dec9fb928 remove unnecessary whitespace 2015-09-10 21:26:28 -04:00
n8fr8
884c8219fd put exception back into Log per this comment: https://gitlab.com/fdroid/fdroidclient/merge_requests/137 2015-09-10 21:26:28 -04:00
n8fr8
988f5dbfdc use TextUtils.isEmpty() - a better solution! 2015-09-10 21:26:28 -04:00
n8fr8
b6939dcce4 for #404 a few more tweaks to make sure things are getting closed! 2015-09-10 21:26:28 -04:00
n8fr8
b3f8ac0a5b related to #404 improvement to patterns to support close and discoverable
You must, must, must close the BT sockets else you run out of them.
This code tries to handle all the places where BT sockets may not get closed.
It also tries to tweak user experience/UI integration pieces in a few areas,
and handle some NPEs that can occur when BT fails.
2015-09-10 21:26:28 -04:00
n8fr8
0a96d17dd1 now handling empty repo fingerprint during check
- also support icondownloading over bluetooth
- also check for null repoUrl variable
2015-09-10 21:26:28 -04:00
n8fr8
c831cf77cc Many changes to swap workflow to get Bluetooth to work
- don't try to start BT in the background. you can only start/stop a BT server once, else new connections don't work
- be more mindful of reading/writing bytes from the input/output streams... make sure bytes are available, because you will block forever if you do not do that
- use the device class tag to filter devices in discovery instead of the fdroid name tag
- this now successfully connects but there is an error in the certificate fingerprint verification still
2015-09-10 21:26:28 -04:00
Daniel Martí
f05d0e12a0 Merge branch 'my-first-new-swap-fixes' into 'master'
My first new-swap fixes

I've been working on getting new-swap stable, these are my fixes so far.  The big one is fixing swap when proxy settings are enabled.  Comments in the commits.

See merge request !136
2015-09-11 00:50:48 +00:00
Daniel Martí
30ed545981 Bump accesspoint lib 2015-09-10 10:49:45 -07:00
Hans-Christoph Steiner
a69488b32f HttpDownloader bypasses proxy when accessing a swap repo
Proxying are basically always for internet access, and swap repos are by
definition only on the local network.  This adds a pretty strict check for
whether a given download URL is for a swap repo, and if so, the proxy
settings are ignored.

fixes https://dev.guardianproject.info/issues/3421
2015-09-10 18:42:36 +02:00
Hans-Christoph Steiner
1654443b00 StrictMode only works in android-9 and above 2015-09-10 18:42:36 +02:00
Hans-Christoph Steiner
0f44fcb8fd swap: remove useless text that used to be a link
It is not helpful to the user to tell them they can download from the web
when they are using swap, since a) they should use F-Droid since its safer,
and b) they are probably using swap because they can't access the web
reliably.
2015-09-10 18:42:36 +02:00
Hans-Christoph Steiner
8d20135779 swap: close resources reported by StrictMode
This required rebuilding the zipsigner.jar, since there was once issue to
be fixed in kellingwood.security.zipsigner.ZipSigner.

Here are the stacktraces:

            StrictMode  E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'close' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.io.FileOutputStream.<init>(FileOutputStream.java:90)
                        E      at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
                        E      at java.io.FileWriter.<init>(FileWriter.java:42)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)
                        E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'close' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128)
                        E      at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57)
                        E      at kellinwood.zipio.ZipInput.read(ZipInput.java:75)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)
                        E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
                        E  java.lang.Throwable: Explicit termination method 'end' not called
                        E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                        E      at java.util.zip.Inflater.<init>(Inflater.java:82)
                        E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475)
                        E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445)
                        E      at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713)
                        E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
                        E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
                        E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
                        E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                        E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                        E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                        E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                        E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                        E      at java.lang.Thread.run(Thread.java:841)

StrictMode  E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'close' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.io.FileOutputStream.<init>(FileOutputStream.java:90)
            E      at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
            E      at java.io.FileWriter.<init>(FileWriter.java:42)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:488)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
            E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'close' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.io.RandomAccessFile.<init>(RandomAccessFile.java:128)
            E      at kellinwood.zipio.ZipInput.<init>(ZipInput.java:57)
            E      at kellinwood.zipio.ZipInput.read(ZipInput.java:75)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:646)
            E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
            E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
            E  java.lang.Throwable: Explicit termination method 'end' not called
            E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            E      at java.util.zip.Inflater.<init>(Inflater.java:82)
            E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:475)
            E      at kellinwood.zipio.ZioEntry.getInputStream(ZioEntry.java:445)
            E      at kellinwood.security.zipsigner.ZipSigner.addDigestsToManifest(ZipSigner.java:418)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:713)
            E      at kellinwood.security.zipsigner.ZipSigner.signZip(ZipSigner.java:647)
            E      at org.fdroid.fdroid.localrepo.LocalRepoKeyStore.signZip(LocalRepoKeyStore.java:218)
            E      at org.fdroid.fdroid.localrepo.LocalRepoManager.writeIndexJar(LocalRepoManager.java:515)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:698)
            E      at org.fdroid.fdroid.views.swap.SwapWorkflowActivity$PrepareSwapRepo.doInBackground(SwapWorkflowActivity.java:645)
            E      at android.os.AsyncTask$2.call(AsyncTask.java:288)
            E      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            E      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            E      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            E      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            E      at java.lang.Thread.run(Thread.java:841)
2015-09-10 18:42:35 +02:00
Daniel Martí
5bb5e3a96b Fix conflict between swap and privileged merges
Also avoid possible NPE in the package name comparison.
2015-09-09 21:35:38 -07:00
Daniel Martí
faecbd03a0 Unify and deduplicate gitignores 2015-09-09 21:24:36 -07:00
Daniel Martí
ed5de47197 Merge branch 'enhanced-priv-install' of https://gitlab.com/dschuermann/fdroidclient 2015-09-09 21:21:06 -07:00
Peter Serwylo
da8811eadf Merge branch 'cr-of-download-manager' into 'master'
Resumeable, simultaneous APK downloads in the background using Android's DownloadManager (post code-review)

This is the CR'ed version of !132, ready for merging. Created a MR instead of direct merging because of CI goodness. Will merge when CI passes. Thanks for your work Toby.

See merge request !133
2015-09-09 23:21:07 +00:00
Peter Serwylo
9848816df4 Fix bug introduced when resolving conflicts during rebase.
ApkDownloader now requires an `App` to be passed in.
2015-09-10 08:49:46 +10:00
Daniel Martí
af5836cb09 Bump accesspoint library to try to fix #407 2015-09-09 15:39:21 -07:00
Peter Serwylo
645f9fc5e3 Rename Utils.copy and Utils.symlinkOrCopyFile to indicate exception clobbering
Renamed to Utils.copyQuietly() and Utils.symlinkOrCopyFileQuietly().

The copy(File, File) method gobbles up IOExceptions, whereas the other
copy(InputStream, OupputStream) method doesn't. This could cause confusion,
whereas developers using one may not realise it is is gobblign their
exceptions.
2015-09-10 06:22:29 +10:00
Peter Serwylo
a09587c7e2 Use helper functions where appropriate. 2015-09-10 06:21:12 +10:00
Peter Serwylo
7b773f94f9 Make DownloadManager code file-agnostic, needn't be specific to "Apps"
This is mainly cosmetic, changing the names of variables so that the downloader
can seemingly be used for any type of download into the future.
2015-09-10 06:21:12 +10:00
Peter Serwylo
0a9941d93d Refactor AsyncDownloader to be an interface.
The interface is used by both AsyncDownloadWrapper and
AsyncDownloaderFromAndroid.
2015-09-10 06:21:12 +10:00
Peter Serwylo
d0d287f668 Remove undocumented params from JavaDoc.
Android Studio by default warns about undocumented params, which makes it harder
to identify more problematic warnings to do with actual code problems. This warning could
be toned down in the IDE so that it doesn't complain, but equally, the params are
not neccesary in JavaDoc if they are undocumented, and don't end up adding any more
than the parameters themselves.
2015-09-10 06:21:12 +10:00
Peter Serwylo
69ecaf023f Refactored AsyncDownloader to only ever be constructed by DownloadFactory. 2015-09-10 06:21:12 +10:00
Peter Serwylo
9b7c4c7b4a WIP: CR. 2015-09-10 06:21:11 +10:00
Toby Kurien
ef40b5f3db Now displays a notification when download is complete, unless use is already on the app details screen, in which case it pops up the installer immediately 2015-09-10 06:21:11 +10:00
Toby Kurien
13e54ced07 Display of app name and version in the download title 2015-09-10 06:21:11 +10:00
Toby Kurien
6f8b49c974 proper handling of file resources, implemented progress stats for async downloader 2015-09-10 06:21:11 +10:00
Toby Kurien
d10a56ed44 re-inserted log statement mistakenly removed 2015-09-10 06:21:11 +10:00
Toby Kurien
f3ef78d292 reverted to previous version, for merge request. 2015-09-10 06:21:11 +10:00
Toby Kurien
efd4ebeadf cleaned up code, prevented multiple app details screens popping up, fixed "no such app" toast after install 2015-09-10 06:21:11 +10:00
Toby Kurien
e827be1b5b when user clicks on notification, the app details screen now comes up. If there are multiple downloads, the first one is shown. 2015-09-10 06:21:11 +10:00
Toby Kurien
8a7feba9cc drastically speed up debug build by not minifying and compressing resources. Release builds unaffected. 2015-09-10 06:21:11 +10:00
Toby Kurien
11caf22dc6 wip: app details now reloads details of running downloads 2015-09-10 06:21:11 +10:00
Toby Kurien
f9fee5beb0 wip: when a download is completed, app is woken up and app details screen displayed 2015-09-10 06:21:11 +10:00