678 Commits

Author SHA1 Message Date
Peter Serwylo
41b3eab1fd WIP: Bluetooth successfully sending entire HTTP responses to GET requests.
Now to move the code into a BluetoothDownloader and decide how best
to handle connections, error handling, multiple downloads over one
socket, etc.
2015-05-13 16:54:16 +10:00
Peter Serwylo
7dff9a9499 WIP: Bluetooth communication between devices is up and running (not finished).
Devices now make themselves discoverable, and the client sends a test ping.
They UI is not styles properly though, and it doesn't handle the case where
somebody chooses to make their device not-discoverable (because the desired
peer is already paired and it is unneccesary). It also doesn't handle failure
anywhere.
2015-05-13 16:53:10 +10:00
Peter Serwylo
fba02e32b5 WIP: Bluetooth list of paired devices. 2015-05-13 16:39:10 +10:00
Peter Serwylo
92e4d99c1c Added material icons from CC licensed "Google material icons" set.
Fixes #240.

To make this easier, I added a script to aid in downloading icons.
Checkout F-Droid/tools/download-material-icon.sh for more details.

The icons are licensed under the CCv4 attribution license, which I
added a shout out to under "License" in the README.md.
2015-05-12 01:26:31 +10:00
Peter Serwylo
c33cacedaf Merge branch 'master' into 'master'
improved, but still rudimentary, hotspot handling in swap

My previous merge request fdroid/fdroidclient!78 was based on one broken assumption: `WIFI_STATE_UNKNOWN` means that the hotspot is active.  Apparently, that's not always the case.  Also, sometimes when the hotspot is active, its `WIFI_STATE_DISABLED`.  Even worse, there is no broadcast message sent on final config of the hotspot.  There is only a `WIFI_STATE_DISABLING` from turning off the wifi, but then never a broadcast for `WIFI_STATE_UNKNOWN` and/or `WIFI_STATE_DISABLED`.  But I found some tricks that seem to work for now.  We'll need to use your library, @mvdan, to really get good support of hotspots.

This also includes some basic UI tweaks to represent the hotspot mode in the swap wifi screen.

See merge request !79
2015-05-10 22:39:12 +00:00
Daniel Martí
da9396fff1 Remove unnecessary and confusing import 2015-05-10 16:08:43 +02:00
Peter Serwylo
3df03bbb1e Fix #250. Fix #251. Normalize URLs before saving, and disallow invalid URLs.
Removes trailing slashes from URLs, replaces multiple consecutive forward
slashes in the path with a single slash. Canonicalizes the URL.

If the URL is invalid, display a message to the user and don't let it get
added.

NOTE: This does *not* normalize existing URLs in the database.
2015-05-10 23:22:35 +10:00
Peter Serwylo
93339cbbfb Fix issue 246: Rewrite process for verifying existing repos.
Previously it would only compare the details of a new repo to existing
ones if the new repo came via an intent. Now it does it whenever you
change the text in the new repo dialog (shouldn't be too much of a
performance hit, it isn't doing very much).

The things it (still) doesn't do is:
 * verify that the url looks like a url
 * sanitize the newly input uri and compare it to sanitized saved repos

The second point means that you can end up with:
 http://10.0.1.50/ and
 http://10.0.1.50

both in the list. I'm going to log an issue for this, because it should
be fixed, but doesn't need to hold this up.
2015-05-10 21:56:40 +10:00
Hans-Christoph Steiner
12b3a5af12 initial sketch of how to display hotspot mode on the swap wifi screen
This is really just a placeholder, there is lots of work to be done here.
Really, this screen should have the SSID of the hotspot, but we need to use
a private API to get that.  Coming soon...

The icon is free software from:
https://commons.wikimedia.org/wiki/File:Wifi.svg
2015-05-10 00:37:05 -04:00
Hans-Christoph Steiner
962a2fb3d6 improve detection of hotspot mode
hotspot mode is not well represented with the WifiState stuff.  It can be
active when the WifiState is DISABLED or UNKNOWN.  Also, when switching
from active wifi to hotspot mode, WIFI_STATE_DISABLING broadcasts will be
sent, but WIFI_STATE_DISABLED/WIFI_STATE_UNKNOWN will not.
2015-05-10 00:37:05 -04:00
Daniel Martí
05332409be Suppress fallthrough java warning 2015-05-09 22:24:41 +02:00
Hans-Christoph Steiner
96b7c35a2a rework WifiStateChangeService to support hotspots (aka WiFi AP on device)
When a device is setup as a WiFi Access Point aka "hotspot", the standard
API for getting the WiFi settings returns nothing.  We have to use a
separate API to get the IP address of the WiFi AP.  As far as I could tell,
there is no public API for getting the SSID/BSSID of the WiFi AP, so for
now that is left blank.  That means the wifi screen in swap is confusing
because it will say it is not attached when the device is a hotspot

@mvdan's https://github.com/mvdan/libaccesspoint should help there

#193 https://gitlab.com/fdroid/fdroidclient/issues/193
2015-05-09 13:41:30 -04:00
Hans-Christoph Steiner
edb3564e29 unified IP/Wifi state handling in WifiStateChangeService
To handle hotspots, this code will become more complicated.  Therefore,
first simplify things by putting all of the logic into one place, rather
than spread out across FDroidApp, the receiver, and the service
2015-05-09 13:41:30 -04:00
Hans-Christoph Steiner
2b59644e02 eliminate nested try/catch blocks for clearer code 2015-05-09 13:41:30 -04:00
Hans-Christoph Steiner
6703fa3652 rename to FDroidApp.restartLocalRepoServiceIfRunning() for clarity
This method handles checking if the service is running, and only restarts
it if it was running.
2015-05-09 13:41:30 -04:00
Hans-Christoph Steiner
c1b0b854fc on launch, check wifi if WIFI_STATE_ENABLED, the receiver handles the rest
On launch, we need to get the current state of the Wifi.  We only need to
start the WifiStateChangeService on WIFI_STATE_ENABLED, since any other
wifi state will be received by WifiStateChangeReceiver, which will launch
WifiStateChangeService when appropriate.

This reduces the chance that WifiStateChangeService will start when it is
not needed.
2015-05-09 13:41:29 -04:00
Hans-Christoph Steiner
bdc190a7d6 reset swap wifi info if it is not connected
Before, it was keeping the last active wifi, which is confusing when you
are not connected.
2015-05-09 13:41:29 -04:00
Daniel Martí
29b78df530 Remove "fdroid." from TAGs, add a comment on filtering by packagename 2015-05-08 23:28:32 +02:00
Hans-Christoph Steiner
0702183210 merge Fragment into ConnectSwapActivity to fix crash on rotate
I was getting frequent crash-on-rotate NullPointerExceptions after scanning
QR Codes.  This fixes it for me.

ConfirmReceiveSwapFragment is only ever used once in ConnectSwapActivity,
so it is a pointless abstraction.  It makes the code a lot more complicated
and also creates very complicated situations to handle when the screen is
rotated.  All of this gets much easier when everything is just included in
the Activity, since there is no problem being solved by the Fragments.
Fragments are for reusing chunks of UI in multiple places, or for showing
multiple chunks of UI in the same Activity.  Both of those cases can also
be handled, arguably better, without using Fragments:
https://corner.squareup.com/2014/10/advocating-against-android-fragments.html
2015-05-08 15:44:11 -04:00
Hans-Christoph Steiner
6e5912a633 move RepoUpdater from .updater package next to RepoXMLHandler
This gets rid of the .updater package, which now only contains RepoUpdater
2015-05-07 22:11:05 -04:00
Hans-Christoph Steiner
157b1e242f remove support for unsigned repos
This has been discussed quite a bit now.  It is very easy to generate a
signed repo on the server, and supporting unsigned repos adds complexity
and security issues, including "BZ-01-002 TOFU Requests too easy to
recognize and intercept" from the audit.

https://gitlab.com/fdroid/fdroidserver/merge_requests/48
closes #12 https://gitlab.com/fdroid/fdroidclient/issues/12
2015-05-07 22:11:05 -04:00
Hans-Christoph Steiner
1c5256a5d7 remove importRepo() method, it is very short and only used in one place 2015-05-07 22:11:05 -04:00
Hans-Christoph Steiner
4820ab3694 add forgotten import (I'm better at merge requests than direct pulls) 2015-05-07 22:10:38 -04:00
Hans-Christoph Steiner
a32154cacb don't operate on null string :( fixes previous commit 2015-05-07 18:23:04 -04:00
Hans-Christoph Steiner
281b2ce450 support market: search links that contain pname: and pub: in the query
* pub: is for searching by "Publisher Name":
  market://search?q=pub:Guardian%20Project

* pname: is an old way to specify "Package Name":
  market://search?q=pname:org.torproject.android

https://developer.android.com/distribute/tools/promote/linking.html
2015-05-07 18:15:19 -04:00
Peter Serwylo
b57a122ac1 Made category Spinner style correctly.
Signed-off-by: Nico Alt <nicoalt@posteo.org>
2015-05-07 22:06:01 +02:00
Nico Alt
315265fbb4 fix #91: Material Design
- use 'com.android.support:appcompat-v7:22.0.0' instead of version 20.0.0
- ActionBar color: "F-Droid Blue" (also option for "F-Droid Green")
- fix invisible swap button with Material Design
- remove "Light + dark action bar" theme (as of Action Bar is always blue/green)
2015-05-07 22:06:01 +02:00
Hans-Christoph Steiner
c23d4e1988 get versionName from AndroidManifest.xml, remove duplicate strings field
No need to have the version set it more than one place!
2015-05-07 15:51:09 -04:00
Hans-Christoph Steiner
e543895940 fix adding repos via incoming URLs
This fixes bad logic introduced in c52262a4057f8a86a1082e4cfbab4e70ff195daf
2015-05-07 15:15:17 -04:00
Daniel Martí
1d225912f4 Remove a few unused variables 2015-05-04 00:14:40 +02:00
Daniel Martí
4a007698a6 Run dos2unix on all external source files 2015-05-04 00:08:36 +02:00
Daniel Martí
939efa5b17 Run "code cleanup" in Android Studio
This basically removes public, static and final from interfaces since it's
always that way.
2015-05-04 00:06:32 +02:00
Nico Alt
054ac8b3fa add missing import 2015-05-03 12:18:39 +02:00
Daniel Martí
45137f2f8e Also apply fixes to custom zxing code 2015-05-01 00:38:06 +02:00
Daniel Martí
e314c401e7 Fix possible NPE when using a TextView 2015-05-01 00:38:06 +02:00
Daniel Martí
bc98fd69b1 Apply a few android studio fixes 2015-05-01 00:38:06 +02:00
Daniel Martí
869662152a Fix regression in 9c6a652a02e
String.replaceAll(String, String) isn't in-place!
2015-05-01 00:16:18 +02:00
Daniel Martí
45ab80bb29 Make CommaSeparatedList.make() also take String[] 2015-04-30 20:51:19 +02:00
Daniel Martí
7b4cee35c7 Throw some more final keywords in 2015-04-30 20:42:30 +02:00
Peter Serwylo
1b114b6bae Merge branch 'fix-202' into 'master'
Fix issue #202 - crash due to sqlite parameter limit being hit.

*NOTE: Queuing here for merge after next stable.*

The queries which have the potential to cause crashes due to too many parameters in the `ApkProvider` are now encapsulated in `ApkProvider` and can only be accessed by safe helper methods, which alleviate the problem by breaking big requests down into many smaller requests.

This will probably have to be done for the `ApkProvider`, but leaving for now because the limit is twice as big.

See merge request !70
2015-04-28 21:35:46 +00:00
Peter Serwylo
833db3b5ce Merge branch 'fix-220' into 'master'
Cache files to SD card again (if preference set).

**NOTE: Queueing here to be merged after next stable**

A previous security fix meant we no longer stored apk files on the
SD card. However, this should still be a feature that people can opt
for if they want, without being insecure. As such the process is now:

 * First download: put in internal storage (to ensure it can't be
   modified before installing)

 * After download: also copy to SD card for caching.

 * On starting F-Droid:

    + Always delete internal storage apks.

    + Only delete other, cached apks if cache preference is false.

To make the code simpler and less prone to bugs, I had to consider
the fact that if people did not have an accessible SD card, then the
path to a cached apk and a "downloaded but transient" apk cannot be
the same. While possible, it means many checks to see if they are
the same, thorough permission management to prevent security issues,
and makes it harder to clear transient apks when F-Droid starts.

See merge request !71
2015-04-28 21:34:05 +00:00
Daniel Martí
3ab6bd84f9 Fix copy/paste error in 14ae586
This led to devices incorrectly flagging packages as non-compatible. With this
fix everything works as before.
2015-04-24 01:16:56 +02:00
Daniel Martí
e367265396 Some style/format fixes suggested by AS 2015-04-21 19:27:10 +02:00
Daniel Martí
14ae58690c Simplify compat.SupportedArchitectures 2015-04-21 19:27:03 +02:00
Daniel Martí
a3c78e4d02 "updated" bools in App and Apk are now unused 2015-04-21 19:09:30 +02:00
Daniel Martí
76a489c492 Don't hardcode tab indexes in multiple places 2015-04-21 19:09:14 +02:00
Daniel Martí
7945c0dead Rename ignored catched exceptions to "ignored" as per AS 2015-04-21 18:59:41 +02:00
Daniel Martí
ab8a180141 Optimize imports via Android Studio 2015-04-21 18:56:52 +02:00
Daniel Martí
ec4b2bf331 Slightly simplify declarations in Utils.java 2015-04-21 17:33:52 +02:00
Daniel Martí
b84e8ef7d6 Add some more final keywords 2015-04-21 17:24:19 +02:00