3231 Commits

Author SHA1 Message Date
Daniel Martí
90e64badf3 Merge branch 'ci-image' into 'master'
CI: Use our docker image, print out test coverage



See merge request !220
2016-02-29 21:45:27 +00:00
Daniel Martí
26ce365c22 Enable test coverage for Gitlab CI 2016-02-29 20:11:29 +00:00
Daniel Martí
d6de4eb58b CI: Use our docker image 2016-02-29 14:35:16 +00:00
Daniel Martí
4aa44cb150 Bump to 0.99 v0.99 2016-02-28 22:46:53 +00:00
F-Droid Translatebot
91482e05f0 Pull translation updates from Weblate
Translators:

Adrià García-Alzórriz    Catalan
Adrià García-Alzórriz    Spanish
Ajeje Brazorf            Sardinian
Alberto Moshpirit        Spanish
Alex Kalles              Greek
jetamkadlec              Czech
Ldm Public               French
Licaon Kter              Romanian
Mladen Pejaković         Serbian
naofum                   Japanese
Olexandr Nesterenko      Ukrainian
Verdulo                  Esperanto
Verdulo                  Polish
2016-02-28 22:41:02 +00:00
Hans-Christoph Steiner
b22c20ece3 Merge branch 'lint-checkstyle' into 'master'
Lint fixes and checkstyle update



See merge request !219
2016-02-28 22:25:15 +00:00
Daniel Martí
a203545e48 Bump checkstyle to 6.16
Due to fixes and improvements, some new checkstyle changes are due.
2016-02-28 16:44:44 +00:00
Daniel Martí
d061dafcd7 Remove a few extra spaces that checkstyle missed
There's also a change in a SQL string, but it should be safe.
2016-02-28 14:29:51 +00:00
Daniel Martí
3af5f55abd Remove unused repo field
Found by Android Studio.
2016-02-28 14:22:27 +00:00
Daniel Martí
9c86655af0 Make some declaration accesses weaker
As suggested by Android Studio.
2016-02-28 14:19:02 +00:00
Daniel Martí
982bf42a4b Remove unused resources from old search screen
We didn't remove the search results class until after reworking the
feature, which is probably why this was kept around.
2016-02-28 14:04:15 +00:00
Hans-Christoph Steiner
d43c6b326f Merge branch 'cleanup-swap-code' into 'master'
Cleanup swap code when returning to start swap view.

This change cleans up some code around how the `StartSwapView` attaches and detaches listeners/broadcast receivers/etc. There are two things that occured which were undesirable, one causing observable bugs, the other having the potential to.

The first is that when the swap process is stopped (e.g. by hitting the cross in the top left of the action bar) then it would trigger an event to be broadcast. This would hit the `StartSwapView`, and then that view would change the UI widgets to match the state of the swap process (i.e. "Stopping" == Disabled and unchecked switch, "Stopped" == Enabled and unchecked switch). When the UI was updated, it was inadvertantly sending further requests to stop swap, because `Switch` widgets _always_ notify their listeners, even if they are explicitly set via `setChecked()`. Now it temporarily removes listeners while brining the UI in line with what the swap service is doing, then reattaches them afterwards.

The later is due to `BroadcastReceivers` being added each time the `StartSwapView` is shown, and never unregistered. Now they are unregistered when the view is detached. Note that because we are not using the convoluted but well documented `Fragment` API, I'm not 100% certain this is the right time to detach listeners, but it seems suitable.

FYI, here is a logcat of me starting hitting the "Cancel swap" X button on master:

```
            SwapManager  I  Asked to stop swapping, will stop bluetooth, wifi, and move service to BG for GC.
                         D  Moving SwapService to background so that it can be GC'ed if required.
               SwapType  D  Sending broadcast STOPPING from WifiSwap
               WifiSwap  D  Sending message to swap webserver to stop it.
       BonjourBroadcast  D  Unregistering MDNS service...
               WifiSwap  I  we've been asked to stop the webserver: Thread-622 says stop
            SwapManager  D  Remembering that Bluetooth swap is NOT connected and WiFi swap IS connected.
          StartSwapView  D  WiFi service is stopping (setting toggle to unchecked and disabled).
                         D  Received onCheckChanged(false) for WiFi swap, disabling WiFi swap in background thread.
  AvailableAppsFragment  D  Category 'What's New' selected.
         OpenGLRenderer  D  endAllStagingAnimators on 0xb8c007e8 (RippleDrawable) with handle 0xb8cef7e8
        BluetoothFinder  D  Stopping bluetooth discovery.
       BluetoothAdapter  D  235158966: getState() :  mService = null. Returning STATE_OFF
          BonjourFinder  D  Cancelling BonjourFinder, releasing multicast lock, removing jmdns service listeners
                    art  I  WaitForGcToComplete blocked for 7.385ms for cause DisableMovingGc
Manager.CallbackHandler  D  CM callback handler got msg 524290
                         D  CM callback handler got msg 524290
               SwapType  D  Sending broadcast STOPPED from BonjourBroadcast
                         D  Sending broadcast STOPPED from WifiSwap
                         D  Sending broadcast STOPPING from WifiSwap
            SwapManager  D  Moving SwapService to background so that it can be GC'ed if required.
               WifiSwap  D  Sending message to swap webserver to stop it.
           MessageQueue  W  Handler (org.fdroid.fdroid.localrepo.type.WifiSwap$5$1$1) {29eeaaee} sending message to a Handler on a dead thread
                         W  java.lang.IllegalStateException: Handler (org.fdroid.fdroid.localrepo.type.WifiSwap$5$1$1) {29eeaaee} sending message to a Handler on a dead
                             thread
                         W      at android.os.MessageQueue.enqueueMessage(MessageQueue.java:325)
                         W      at android.os.Handler.enqueueMessage(Handler.java:631)
                         W      at android.os.Handler.sendMessageAtTime(Handler.java:600)
                         W      at android.os.Handler.sendMessageDelayed(Handler.java:570)
                         W      at android.os.Handler.sendMessage(Handler.java:507)
                         W      at org.fdroid.fdroid.localrepo.type.WifiSwap.stop(WifiSwap.java:167)
                         W      at org.fdroid.fdroid.localrepo.type.SwapType$3.doInBackground(SwapType.java:103)
                         W      at org.fdroid.fdroid.localrepo.type.SwapType$3.doInBackground(SwapType.java:100)
                         W      at android.os.AsyncTask$2.call(AsyncTask.java:288)
                         W      at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                         W      at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
                         W      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                         W      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                         W      at java.lang.Thread.run(Thread.java:818)
       BonjourBroadcast  D  Unregistering MDNS service...
               SwapType  D  Sending broadcast STOPPED from BonjourBroadcast
                         D  Sending broadcast STOPPED from WifiSwap
            SwapManager  D  Remembering that Bluetooth swap is NOT connected and WiFi swap is NOT connected.
          StartSwapView  D  WiFi service has stopped (setting toggle to not-visible).
            SwapManager  D  Remembering that Bluetooth swap is NOT connected and WiFi swap is NOT connected.
          StartSwapView  D  WiFi service is stopping (setting toggle to unchecked and disabled).
            SwapManager  D  Moving SwapService to background so that it can be GC'ed if required.
                         D  Remembering that Bluetooth swap is NOT connected and WiFi swap is NOT connected.
          StartSwapView  D  WiFi service has stopped (setting toggle to not-visible).
```

And also on this branch:

```
            SwapService  I  Asked to stop swapping, will stop bluetooth, wifi, and move service to BG for GC.
                         D  Moving SwapService to background so that it can be GC'ed if required.
               SwapType  D  Sending broadcast STOPPING from WifiSwap
               WifiSwap  D  Sending message to swap webserver to stop it.
       BonjourBroadcast  D  Unregistering MDNS service...
               WifiSwap  I  we've been asked to stop the webserver: Thread-646 says stop
            SwapService  D  Remembering that Bluetooth swap is NOT connected and WiFi swap IS connected.
          StartSwapView  D  WiFi service is stopping (setting toggle to unchecked and disabled).
  AvailableAppsFragment  D  Category 'What's New' selected.
         OpenGLRenderer  D  endAllStagingAnimators on 0xb8b1bb70 (RippleDrawable) with handle 0xb8cec7c0
          BonjourFinder  D  Cancelling BonjourFinder, releasing multicast lock, removing jmdns service listeners
        BluetoothFinder  D  Stopping bluetooth discovery.
       BluetoothAdapter  D  93224770: getState() :  mService = null. Returning STATE_OFF
Manager.CallbackHandler  D  CM callback handler got msg 524290
                         D  CM callback handler got msg 524290
               SwapType  D  Sending broadcast STOPPED from BonjourBroadcast
                         D  Sending broadcast STOPPED from WifiSwap
            SwapService  D  Moving SwapService to background so that it can be GC'ed if required.
                         D  Remembering that Bluetooth swap is NOT connected and WiFi swap is NOT connected.
          StartSwapView  D  WiFi service has stopped (setting toggle to not-visible).
Manager.CallbackHandler  D  CM callback handler got msg 524290
```

One of the most notable things that can be seen is the lack of the following message in the second (fixed) logcat.

> Received onCheckChanged(false) for WiFi swap, disabling WiFi swap in background thread.

See merge request !218
2016-02-28 10:14:29 +00:00
Peter Serwylo
ad63e52e50 Extract BroadcastReceivers to member variables, so they can be unregistered correctly.
Previously, they were registered, then forgotten. This means that each time
the start swap view was run, another receiver was registered. As a result,
they were being invoked multiple times.

It doesn't appear that this had any specific side effects which were terrible,
but they definitely have the potential to going forward.

Note that because we are not using `Fragments` with their convoluted, but at
least well documented API, I'm not 100% certain that I've unregistered the
receivers at the right location.
2016-02-28 13:58:49 +11:00
Peter Serwylo
1323e800b7 Temporarily disable listeners when updating switch state in response to background process.
Previously, something like this would happen:
 * Swap service is cancelled
 * WiFi swap is asked to stop
 * Event is broadcast when done
 * UI listens to this event
 * Upon receiving the event, it updates the UI
 * Updating the UI triggers an event, causing the process to happen again

An alternative solution to this would have been for the UI to stop listening
to listeners before WiFi swap is shut down, but that is then only specific
to the case when the swap view is being destroyed/removed. This could also
happen in other situations however, such as when the swap service times out.
2016-02-28 13:43:07 +11:00
Peter Serwylo
209afd6bf2 Extract switch change listeners to member variables, so that they can be unregistered.
When the view is detached, then the listeners will be unregistered.
This will also help in the future so that they can be temporarily
unregistered when manually changing the state of the switches.
2016-02-28 12:49:50 +11:00
Peter Serwylo
62b080a8d9 Rename logging tag to make logcat debugging clearer. 2016-02-28 12:36:06 +11:00
Hans-Christoph Steiner
94c0c391da Merge branch 'faster-ci' into 'master'
CI: Install SDK only if necessary



See merge request !217
2016-02-27 19:45:25 +00:00
Daniel Martí
affa569a79 CI: Install SDK only if necessary 2016-02-27 18:33:34 +00:00
Daniel Martí
1eedf66d66 Bump to 0.99-alpha2 v0.99-alpha2 2016-02-27 13:02:24 +00:00
Daniel Martí
d7827a3f07 CHANGELOG: prepare for upcoming release 2016-02-27 13:01:56 +00:00
Daniel Martí
4ec9cee143 Merge branch 'smooth-tor' into 'master'
Smooth Tor setup

This is a big reworking of the Tor support to make it really easy to setup, and to make .onion addresses work automatically even when "Use Tor" is off.

I needed to make the NetCipher v1.2.1 release to support this, hence it was originally WIP:.

See merge request !216
2016-02-27 12:42:20 +00:00
Hans-Christoph Steiner
fd03ebd764 annotate swap methods that require android-10
swap only works on >= android-10 anyway

closes #581 https://gitlab.com/fdroid/fdroidclient/issues/581
2016-02-27 11:05:16 +01:00
Hans-Christoph Steiner
26b35723d3 use AsyncTask for SwapType operations to run in background
Thread runs at normal priority by default.  AsyncTasks are integrated into
Android for handling things running in the background while keeping the UI
responsive.

This reverts most of commit 828cc272ee5235f868104b009349cc7e835e144f.
2016-02-27 11:05:16 +01:00
Hans-Christoph Steiner
96fe1f9584 do not show "Swap" as an option on less than android-10
Swap requires lots of APIs that are only all available in android-10, so
hide the menu item on older platforms.

closes #581 https://gitlab.com/fdroid/fdroidclient/issues/581
closes #575 https://gitlab.com/fdroid/fdroidclient/issues/575
2016-02-27 11:04:08 +01:00
Hans-Christoph Steiner
38e4b38602 Re-enable NetCipher to provide decent TLS on all Android versions
Revert "Revert netcipher to fix SNI regression"
This reverts commit 6c8e726aadbe6714d6295882c5be87a7bf81a9f0.

NetCipher is important for making sure that the client running on older
versions of Android is not using extremely crappy default TLS settings.  It
also streamlines the Tor support.

closes #431 https://gitlab.com/fdroid/fdroidclient/issues/431
closes #576 https://gitlab.com/fdroid/fdroidclient/issues/576
2016-02-27 11:04:08 +01:00
Hans-Christoph Steiner
eed0070d4b do not bail out of wifi settings if there is no DhcpInfo
There is still much useful information to be had without DhcpInfo.
2016-02-27 11:04:08 +01:00
Hans-Christoph Steiner
c5688dcdbf Merge branch 'cleanup-swap-stuff' into 'master'
Cleanup swap stuff, make more robust

While we're discussing the merits or otherwise of !208, here is some fixes to the swap workflow cherry-picked (and cleaned up) from that branch.

Although not directly reproducible, I'm confident this should fix #556 and #557.

The original assumption was that we can start the wifi local repo server, then tell the user it is connected while JmDNS is starting. The plan was for it to be very snappy, so the user could continue using the UI while bonjour was doing its stuff. However, in realtity this results in the possibility of turning swap on and off again while bonjour is still getting ready.

This now makes the user wait both when starting swap, and also when stopping swap. It will provide proper feedback to the user, do it on a background thread (properly) and update the UI when done.

Added some other misc cleanups while there.

See merge request !213
2016-02-27 09:59:52 +00:00
Peter Serwylo
db120133b9 Don't try to start bonjour without an IP.
Although not reproduced, it looks very much like this would be related
to, and should subsequently fix #556.
2016-02-27 09:28:17 +11:00
Peter Serwylo
3dd0589b08 Don't say wifi is connected until both wifi + bonjour are ready.
Although I can't reproduce reliably, I am hopeful that this will resolve
a lot of the errors such as #557.
2016-02-27 09:28:17 +11:00
Peter Serwylo
cd3a064a5a Don't call unregisterService(...) then unregisterAllSerivces().
The later will unregister the service we were explicitly unregistering anyway.
2016-02-27 09:28:17 +11:00
Peter Serwylo
1505d21781 Set connected status after disconnecting from wifi swap. 2016-02-27 09:28:17 +11:00
Peter Serwylo
2ed6110ae5 Cleanup looper after shutting down. 2016-02-27 09:28:17 +11:00
Peter Serwylo
18f97602e8 Don't start swap wifi when there is no network.
Not sure if we should be here or not in this situation, so this is
a little bit defensive. Can't bind to an IP address of `null`, so
don't bother starting LocalHTTP server unless we have an IP.
2016-02-27 09:28:17 +11:00
Peter Serwylo
ddbd9e2ea9 Actually run thread in background.
`Thread.run()` is not the correct call, changed to the correct `Thread.start()`.
Also, explicitly indicate that we want the stopping of wifi to happen in the
background.
2016-02-27 09:28:17 +11:00
Peter Serwylo
1eae135929 Add user feedback for when WiFi is being disabled.
On some devices this can take some time (i.e. a second) and the UI needs
to be disabled for that time. This should stop users quickly stopping and
starting regularly, queuing up many "start jmdns, stop jmdns, start jmdns"
calls.
2016-02-27 09:28:17 +11:00
Peter Serwylo
8364aa15f1 Don't try to start swap again if we have gone from network -> no network. 2016-02-27 09:27:57 +11:00
Hans-Christoph Steiner
94e3cf85ba Merge branch 'lint-errors-2' into 'master'
Lint errors round 2

There are only a few errors left, which I've either logged as issues or reported upstream:

* #580
* #581
* #582
* https://github.com/rtyley/spongycastle/issues/7#issuecomment-189299020

I've also done a bunch of warnings that were just too easy to leave alone.

See merge request !215
2016-02-26 21:15:56 +00:00
Daniel Martí
b08b97466f Fix a single rogue ellipsis 2016-02-26 15:00:50 +00:00
Daniel Martí
91c3278920 Take RTL suggestions from lint (warnings) 2016-02-26 14:57:42 +00:00
Daniel Martí
e390561c7c install_confirm: remove useless lines
These are already in its layout-v11 version. And as lint points out,
these need v11:

	?android:attr/buttonBarStyle requires API level 11 (current min is 8)
	?android:attr/buttonBarButtonStyle requires API level 11 (current min is 8)
2016-02-26 14:48:45 +00:00
Daniel Martí
1b6fc3da7c Move app_permission_item_money to layout-v17
Since it's only ever used on android-17 or later, move it there to keep
lint happy with all the NewApi errors.
2016-02-26 14:47:09 +00:00
Daniel Martí
5179e032db Fix NewApi bug introduced in 8e193cec 2016-02-26 14:39:02 +00:00
Daniel Martí
43a3c2b042 Remove useless app:backgroundTint from layouts
app:backgroundTint only works on AppCompatButton from v7-appcompat.
We're using a regular Button in these, so this attribute is useless and
makes lint error.

More info:

	https://stackoverflow.com/questions/27735890/lollipops-backgroundtint-has-no-effect-on-a-button
2016-02-26 14:26:05 +00:00
Hans-Christoph Steiner
d1b758147b Merge branch 'lint-errors' into 'master'
Fix first chunk of lint errors

These are easy, but numerous.

See merge request !212
2016-02-25 19:34:08 +00:00
Daniel Martí
cdecc1604c Add all missing Left/Right attributes in RTL
This improves support on older Android releases.
2016-02-25 16:56:23 +00:00
Daniel Martí
073052f5cc Move app_description to donottranslate.xml
As lint points out, only the original string is used in the
AndroidManifest.xml. So having it translated is useless.
2016-02-25 16:40:58 +00:00
Hans-Christoph Steiner
153a6bdbe7 Merge branch 'tools' into 'master'
Pull translation updates and make CI check more stuff via tools/



See merge request !210
2016-02-25 16:31:29 +00:00
Daniel Martí
99f930663d CI: Also check language list and string formats 2016-02-25 14:25:45 +00:00
Daniel Martí
54c4714b9d Fix string format issues 2016-02-25 13:56:06 +00:00
Daniel Martí
6b9d6b6be5 Add a py script to check for bad string formats
Lint finds these, but it's very slow and currently we're not taking lint
errors as fatal. So for now this script will be useful, as nearly every
time I pull from weblate there are at least a couple of these.
2016-02-25 13:56:01 +00:00