1436 Commits

Author SHA1 Message Date
Peter Serwylo
d13a8c101a Merge branch 'proxy-and-jenkins-script' into 'master'
HTTP Proxy preference for Tor, I2P, etc; add jenkins script

This adds a preference to set the HTTP Proxy so that FDroid can funnel all traffic through Tor, I2P, psiphon, or any other HTTP proxy.

Also, there is a script for jenkins to run before calling `ant clean debug` for the whole setup process.  This script sets the `versionCode` to the UNIX time in seconds, and adds the date/time to the `versionName` so that the debug builds are very clearly marked from real builds, and they will automatically update when included in a debug repo:
https://dev.guardianproject.info/issues/2601
2014-06-16 20:45:30 +00:00
Hans-Christoph Steiner
b7f0195234 add "HTTP Proxy" preference to support Tor, I2P, or any other proxy
This is the most basic support for channeling all downloads through Tor or
I2P.  This does not include Orbot integration, so the use will have to know
to start Orbot before using this.  I don't know anything about I2P.

closes #2367 https://dev.guardianproject.info/issues/2367
https://f-droid.org/repository/issues/?do=view_issue&issue=404
https://f-droid.org/repository/issues/?do=view_issue&issue=424
2014-06-05 17:23:44 -04:00
Hans-Christoph Steiner
ff5d2b571f include script for jenkins to run for setting up the ant build
Jenkins will then call ant directly after running this script.  This then sets
the debug builds made by Jenkins to have a versionCode of the UNIX time in
seconds and adds the data to the versionName.  This clearly marks these as
debug builds and also makes it possible to have an fdroid repo of debug builds
that will automatically update after each build.
2014-06-05 17:23:44 -04:00
Daniel Martí
2f9c3b8056 Switch to java 1.7
Taken from the gradle plugin user guide:

With Android KitKat (buildToolsVersion 19) you can use the diamond operator,
multi-catch, strings in switches, try with resources, etc.

Note that you can use minSdkVersion with a value earlier than 19, for all
language features except try with resources. If you want to use try with
resources, you will need to also use a minSdkVersion of 19.

You also need to make sure that Gradle is using version 1.7 or later of the
JDK. (And version 0.6.1 or later of the Android Gradle plugin.)
2014-06-05 10:32:57 +02:00
Daniel Martí
5dac28f882 Make it explicit that we're using 1.6
Can be bumped to 1.7 if minsdk is bumped to 8
2014-06-05 10:23:55 +02:00
Daniel Martí
67b608e4e5 Set the gradle project name to F-Droid like ant 2014-06-05 10:20:06 +02:00
Daniel Martí
ce42783583 Move support-v4 jars around in ant-prepare 2014-06-05 10:15:26 +02:00
Daniel Martí
4929a8c15d Remove now unnecessary -pre-build from ant 2014-06-05 09:49:41 +02:00
Daniel Martí
5d3372207a Hard-code v7-appcompat target to android-19
Taken from v7/appcompat/build.gradle
2014-06-05 09:47:56 +02:00
Peter Serwylo
5af5306311 Merge branch 'appcompat-on-top-of-pserwylo' into 'master'
Appcompat on top of pserwylo

This is a refactor of @pserwylo's !19 to get appcompat building with `ant` and Eclipse.  I reviewed @pserwylo's commits and they are ready to go as they are in this merge request.
2014-06-05 05:38:53 +00:00
Hans-Christoph Steiner
81cbef82b4 finish ant/gradle build for appcompat-v7
Both preferencefragment and appcompat-v7 submodules need the
android-support-v4.jar to be included in their respective libs/ dirs in
order for ant to build those projects.
2014-06-04 23:19:54 -04:00
Peter Serwylo
208146882e Fixed light theme on API > 11
Forgot that it also needed to go in the values-v11 styles file.
2014-06-04 23:19:54 -04:00
Peter Serwylo
b82be525b9 Rotation of app details with fragments implemented.
This was a bit more complex than all the other views, because it supports
rotation, and different views for when it is rotated. The end result is
that the way in which the views were constructed needed to be completely
redone.

In the process, I also moved the layout of the app summary to a Relative
Layout. This adds more flexibility, and is also the suggested layout
for complex views (as apposed to nested linear layouts). I believe this
is due to the performance of relative vs linear layotus.

It was aprticularly hard to figure out what was going on
when rotating an Activity which had a list fragment
that had another fragment as a header. I don't think fragments
were designed to work like this, but I believe it is all working
as expected now.

Conflicts:
	src/org/fdroid/fdroid/Preferences.java
2014-06-04 23:19:54 -04:00
Peter Serwylo
659b46fd4e Fix to sdkLoc in build. Added light (without dark action bar) theme.
NOTE: I don't know how android will go with adding a new property
to a string-array resource, but not having it translated everywhere.
Will it struggle because the EN version has three values for "theme",
but other translations only have two?
2014-06-04 23:19:54 -04:00
Peter Serwylo
3050e3dbc5 Migrating activities to appcompat-v7
The only remaining activity is the AppDetails acvitity, which will require
a little more than just making it extend ActionBarActivity. Currently,
it extends ListActivity. To support appcompat-v7, it really should have
two fragments - the details one and the list one. Then, when the orientation
is changed, it should load a different layout with the fragments side by side.

Although Google is encouraging people to make old devices run apps
with the action bar (via appcompat-v7), they haven't provided a way
for people to create preference/setting screens with an action bar.

There are plenty of issues in the Android issue tracker relating
to this, but it doesn't yet seem to be on the radar of the Android
devs.

Until there is a native implementation of PreferenceFragment in
the appcompat-v7 support library, this submodule provides is a 3rd
party solution. It is actually a fork of the first repo in github,
though that was a bit of an upload and dump, without accepting MR's.
This fork includes gradle support.
2014-06-04 23:19:37 -04:00
Peter Serwylo
59b9fd6a8c add PreferenceFragment lib since appcompat lacks such a thing
Although Google is encouraging people to make old devices run apps
with the action bar (via appcompat-v7), they haven't provided a way
for people to create preference/setting screens with an action bar.

There are plenty of issues in the Android issue tracker relating
to this, but it doesn't yet seem to be on the radar of the Android
devs.

Until there is a native implementation of PreferenceFragment in
the appcompat-v7 support library, this submodule provides is a 3rd
party solution. It is actually a fork of the first repo in github,
though that was a bit of an upload and dump, without accepting MR's.
This fork includes gradle support.
2014-06-04 23:16:26 -04:00
Peter Serwylo
92421bac05 WIP: Migrating activities to appcompat-v7.
Conflicts:
	src/org/fdroid/fdroid/FDroidApp.java
	src/org/fdroid/fdroid/views/LocalRepoActivity.java
	src/org/fdroid/fdroid/views/QrWizardDownloadActivity.java
2014-06-03 08:13:53 +09:30
Peter Serwylo
58ff02a3f4 Build with dependency on support-appcompat-v7.
Thanks to the awesome work of mvdan, this was mostly ready to roll.
However, I had to wrestle for a while for two reasons:

 1) I forgot to add the dependency in the build.gradle file (it was
    already present in settings.gradle)
 2) My IDE was unable to read the ANDROID_HOME env variable, and
    despite my internet-search-fu, I couldn't figure out how to
    make IntelliJ specify env variables for a gradle build. It took
    a while to figure out, because it was failing silently in weird
    ways.

After slaving away on a nice method to parse both the ANDROID_HOME
and the local.properties file (looking for sdk.dir), and then emmiting
nice error messages if neither were found or pointed to an invalid
location, I discovered it had already be done:

android.plugin.sdkDirectory ends up here:

https://android.googlesource.com/platform/tools/build/+/master/gradle/src/main/groovy/com/android/build/gradle/internal/Sdk.groovy#161

Which does exactly all that and more. So now sdkLoc is initialized to
the value of android.plugin.sdkDirectory.
2014-06-03 08:11:59 +09:30
Daniel Martí
728d1467b9 Prepare for 0.69-test 0.69-test 2014-06-01 18:38:04 +02:00
Peter Serwylo
95180512c7 Merge branch 'jmdns-fixes-and-tor-onion-support' into 'master'
Jmdns fixes and tor onion support

There are three groups of work in this collection of commits:

* improvements to the `WifiStateChangeService` and related activities like JmDNS to eliminate problems that happen when there are a lot of wifi change events.

* add rework the `.net.Downloader` stuff to add Tor support and lay the groundwork for Bluetooth support

* add support for repos on Tor Hidden Service .onion addresses
2014-05-31 02:25:19 +00:00
Hans-Christoph Steiner
c1b5bf5279 implemented IconDownloader for UIL downloads with FDroid classes
This lets UniversalImageLoader (UIL) use FDroid's generic Downloader
infrastucture so that connection configuration all happens based on the URL
in DownloaderFactory.

refs #2598 https://dev.guardianproject.info/issues/2598
refs #2367 https://dev.guardianproject.info/issues/2367
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
d19e77049a rename Downloader.inputStream() to getInputStream()
This follows:
URLConnection.getInputStream()
BaseImageDownloader.getStream()
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
b619716669 add TorHttpDownloader for handling repos on Tor Hidden Services
Tor Hidden Services are on domain names that always end in .onion, so there
is a URL pattern matcher that chooses which Downloader subclass to use
based on testing for .onion.  This is a quick, dumb implementation.  It
does make any attempt to see if Tor is running or even installed.  That
can come once NetCipher is easy to handle in the context of FDroid.

refs #2367 https://dev.guardianproject.info/issues/2367
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
910f9a68a6 make DownloaderFactory for creating any kind of Downloader
This will ultimately be used to create the right Downloader subclass
instance based on the URL of the file to download (i.e. rfcomm://, .onion
address, ssh://, new socket protocols, etc).

Also delete unused constructors, they can trivially be readded if they are
ever used, and they are currently just clutter.
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
91e06b8496 new Wifi event cancels active processing of previous event
If a new "wifi connected" event comes in while a previous one is still
being processed, then cancel the current one as soon as possible.  This
prevents the events from being processed in an interleaved manner, causing
chaos and crashes.  Hopefully this will fix the jmdns crashes, since that
is triggered by onPostExecute() via FDroidApp.restartLocalRepoService().

java.lang.IllegalStateException: A service information can only be registered with a single instamce of JmDNS.
   at javax.jmdns.impl.JmDNSImpl.registerService(JmDNSImpl.java:1005)
   at org.fdroid.fdroid.localrepo.LocalRepoService$5.run(LocalRepoService.java:239)
   at java.lang.Thread.run(Thread.java:856)
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
f51d192e13 move all mDNS service creation into the Thread
Upon looking at this, ServiceInfo.create() also might take a while to run
so might as well run it in the Thread with the other JmDNS stuff.
2014-05-30 15:23:33 -04:00
Hans-Christoph Steiner
ba028408a1 registerMDNSService() overwrites any existing registration
There is only ever a single service to advertise via mDNS, so when a new
registration is requested, remove any existing ones.  This should eliminate
these stacktraces:

java.lang.IllegalStateException: A service information can only be registered with a single instamce of JmDNS.
    at javax.jmdns.impl.JmDNSImpl.registerService(JmDNSImpl.java:1005)
    at org.fdroid.fdroid.localrepo.LocalRepoService$5.run(LocalRepoService.java:239)
    at java.lang.Thread.run(Thread.java:856)
2014-05-30 15:23:32 -04:00
Hans-Christoph Steiner
fdaa2ad106 update IP-related settings whenever the HTTPS pref changes
WifiStateChangeService handles updating lots of IP-related things, then
things that depend on it listen to the broadcast from that Service. The
most straightforward way to update HTTPS or HTTP throughout the app is to
trigger this Service.  It runs its stuff in an AsyncTask so it is all low
priority.
2014-05-30 15:23:32 -04:00
Hans-Christoph Steiner
c4b059502c better LocalRepoService singleton enforcement
We only ever want a single LocalRepoService.  Use the values returned by
the standard methods for start/stop and bind/unbind as the test for whether
the Service is indeed running.
2014-05-30 15:23:32 -04:00
Hans-Christoph Steiner
2c594cae5d Eclipse: hide warnings from submodules
There are about 4000 warnings from all the included submodules included as
symlinks.  This hides them all so Eclipse only shows the warnings for
FDroid itself.
2014-05-28 19:24:43 -04:00
Daniel Martí
ed630454a5 Update UIL 2014-05-28 22:17:38 +02:00
Daniel Martí
a085515b3d Add the rest of the srcDirs to UIL 2014-05-28 09:07:15 +02:00
Daniel Martí
9ea7959dc1 Fix typo in UIL config 2014-05-27 23:14:01 +02:00
Daniel Martí
a08963f0e5 Merge branch 'feature/refactor-downloaders-async' of https://gitlab.com/pserwylo/fdroidclient 2014-05-27 19:20:10 +02:00
Daniel Martí
bfb04648f8 Fix extra android namespaces in layout/about.xml 2014-05-27 17:59:19 +02:00
Daniel Martí
7351584697 Fix inconsistency in local_repo_https default state
+mvdan | _hc: you put https to default true in preferences.xml, but false in Preferences.java
   _hc | mvdan:  it should be off/false by default
2014-05-27 17:53:56 +02:00
Daniel Martí
4cbf97b499 Merge branch 'implement-signed-repos-and-https' of https://gitlab.com/eighthave/fdroidclient 2014-05-27 16:17:27 +02:00
Hans-Christoph Steiner
09db3524cf use getApplicationContext() when storing a passed in Context
getApplicationContext() returns the Context of the application, which is
guaranteed to have the same life as the app itself.  Other Contexts, like
an Activity, might go away during runtime.
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
09fb7969b4 do not include URL in index.xml because it will get out of date
As far as I can tell, the 'url' metadata in index.xml is not used at all by
the client.  In order to keep it up-to-date in the local repo, it would
have to regenerate index.xml and index.jar each time the IP address
changed.  That would mean a decent amount of work happening in the
background, all the update an unused field in index.xml.
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
0c039a6b5e make writeIndexJar() call writeIndexXML(): only create signed repos!
There is no longer a reason to expose writeIndexXML() since FDroid should
always generate a signed repo.  So make writeIndexXML() be called as part
of writeIndexJar().
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
91fc0f5383 generate HTTPS certificate after wifi change
Since the HTTPS certificate includes the current IP address in it, it needs
to be regenerated each time that the IP address changes.  It also can take
a long time to run, especially on the first time, since it had to do things
like create a key pair and make the certificate.  Therefore it should be in
a Service/AsyncTask.
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
b70986ef16 LocalRepoKeyStore.setupHTTPSCertificate() handles all exceptions itself
Since there is nothing happening with the Exceptions anyway, they should be
handled in this method so that this method is easy to use elsewhere.
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
d5488fc5f1 LocalRepoKeyStore move all creation logic to the constructor
This just makes the code clearer, and the get() method dead simple.
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
b7aad893a3 convert LocalRepoManager to a proper singleton
This gives us lazy initialization that happens the first time an instance
is needed.  And Peter asked to have this more this way :)
2014-05-25 22:53:19 -04:00
Hans-Christoph Steiner
ab165a4d7b omit unused spongycastle packages from eclipse/ant build
Many of the classes in spongycastle are entirely unused in FDroid and
dependencies.  So remove them from the Eclipse/Ant build to speed things up
and make the binaries smaller.
2014-05-25 22:53:18 -04:00
Hans-Christoph Steiner
36de588497 add Bazaar/Kerplapp work to the changelog 2014-05-25 22:53:18 -04:00
Hans-Christoph Steiner
568e82c07e if LocalHTTPD fails to instantiate, log error and stop trying 2014-05-25 22:53:18 -04:00
Hans-Christoph Steiner
b7339e9423 support HTTPS:// for local repo in a preference
Allow the local repo to use HTTPS:// instead of HTTP://.  This is currently
default off since handling the self-signed certificate is not currently
graceful.  In the future, the SPKI that AndroidPinning uses should be
included in the repo meta data, then when someone marks a repo as trusted,
that local repo's SPKI should be added to the list of trusted keys in
AndroidPinning.

fixes #2960 https://dev.guardianproject.info/issues/2960
2014-05-25 22:53:18 -04:00
Hans-Christoph Steiner
5f2efbb72a sign local repo based on key generated using spongycastle
This makes it so the local repo is always signed by a locally generated and
stored key.  That key will become the unique ID that represents a given
local repo.  It should seamlessly upgrade any existing unsigned local repo
next time that the user makes any changes to their local repo.

fixes #3380 https://dev.guardianproject.info/issues/3380
2014-05-25 22:53:18 -04:00
Hans-Christoph Steiner
22fb0337b9 clean up LocalRepoKeyStore code format
Make it match standard Java style.
2014-05-25 22:53:18 -04:00