From eed0070d4b50a0139f82a542cd86ad63f65c550f Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 10:54:34 +0100 Subject: [PATCH 1/5] do not bail out of wifi settings if there is no DhcpInfo There is still much useful information to be had without DhcpInfo. --- .../org/fdroid/fdroid/net/WifiStateChangeService.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java index ccf162460..8c3e3ef69 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java +++ b/F-Droid/src/org/fdroid/fdroid/net/WifiStateChangeService.java @@ -87,12 +87,11 @@ public class WifiStateChangeService extends Service { wifiInfo = wifiManager.getConnectionInfo(); FDroidApp.ipAddressString = formatIpAddress(wifiInfo.getIpAddress()); DhcpInfo dhcpInfo = wifiManager.getDhcpInfo(); - if (dhcpInfo == null) { - return null; - } - String netmask = formatIpAddress(dhcpInfo.netmask); - if (!TextUtils.isEmpty(FDroidApp.ipAddressString) && netmask != null) { - FDroidApp.subnetInfo = new SubnetUtils(FDroidApp.ipAddressString, netmask).getInfo(); + if (dhcpInfo != null) { + String netmask = formatIpAddress(dhcpInfo.netmask); + if (!TextUtils.isEmpty(FDroidApp.ipAddressString) && netmask != null) { + FDroidApp.subnetInfo = new SubnetUtils(FDroidApp.ipAddressString, netmask).getInfo(); + } } } else if (wifiState == WifiManager.WIFI_STATE_DISABLED || wifiState == WifiManager.WIFI_STATE_DISABLING) { From 38e4b38602d54591185bcf2e1dd73e90364606bb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 26 Feb 2016 19:48:07 +0100 Subject: [PATCH 2/5] 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 --- CHANGELOG.md | 5 +++ F-Droid/build.gradle | 2 + F-Droid/proguard-rules.pro | 4 ++ F-Droid/res/values/strings.xml | 2 + F-Droid/res/xml/preferences.xml | 4 ++ F-Droid/src/org/fdroid/fdroid/FDroid.java | 1 + F-Droid/src/org/fdroid/fdroid/FDroidApp.java | 28 +++++++++++++ .../src/org/fdroid/fdroid/Preferences.java | 13 +++++++ .../fdroid/fdroid/net/DownloaderFactory.java | 3 -- .../org/fdroid/fdroid/net/HttpDownloader.java | 39 +++++++++++++------ .../fdroid/fdroid/net/TorHttpDownloader.java | 28 ------------- .../fdroid/views/ManageReposActivity.java | 1 + .../views/fragments/PreferencesFragment.java | 32 +++++++++++++++ 13 files changed, 120 insertions(+), 42 deletions(-) delete mode 100644 F-Droid/src/org/fdroid/fdroid/net/TorHttpDownloader.java diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b668f57..f67c07974 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ + +* add simple "Use Tor" preference + +* Enable TLS v1.2 for officials repo on all devices that support it + ### 0.98.1 (2016-02-14) * Fix crash when entering only a space into the search dialog diff --git a/F-Droid/build.gradle b/F-Droid/build.gradle index 1ad545715..92cabd569 100644 --- a/F-Droid/build.gradle +++ b/F-Droid/build.gradle @@ -17,6 +17,7 @@ dependencies { compile 'com.google.zxing:core:3.2.1' compile 'eu.chainfire:libsuperuser:1.0.0.201602011018' compile 'cc.mvdan.accesspoint:library:0.1.3' + compile 'info.guardianproject.netcipher:netcipher:1.2.1' compile 'commons-net:commons-net:3.4' compile 'org.openhab.jmdns:jmdns:3.4.2' compile('ch.acra:acra:4.8.2') { @@ -71,6 +72,7 @@ if (!hasProperty('sourceDeps')) { 'eu.chainfire:libsuperuser:952c5fc82f9c31d31d2b6a7054ee267dac1685fb037a254888c73c48de661eaf', 'cc.mvdan.accesspoint:library:dc89a085d6bc40381078b8dd7776b12bde0dbaf8ffbcddb17ec4ebc3edecc7ba', 'commons-net:commons-net:38cf2eca826b8bcdb236fc1f2e79e0c6dd8e7e0f5c44a3b8e839a1065b2fbe2e', + 'info.guardianproject.netcipher:netcipher:611ec5bde9d799fd57e1efec5c375f9f460de2cdda98918541decc9a7d02f2ad', 'org.openhab.jmdns:jmdns:7a4b34b5606bbd2aff7fdfe629edcb0416fccd367fb59a099f210b9aba4f0bce', 'com.madgag.spongycastle:pkix:6aba9b2210907a3d46dd3dcac782bb3424185290468d102d5207ebdc9796a905', 'com.madgag.spongycastle:prov:029f26cd6b67c06ffa05702d426d472c141789001bcb15b7262ed86c868e5643', diff --git a/F-Droid/proguard-rules.pro b/F-Droid/proguard-rules.pro index 4784add4a..65c2e1e09 100644 --- a/F-Droid/proguard-rules.pro +++ b/F-Droid/proguard-rules.pro @@ -10,6 +10,10 @@ -dontnote android.support.** -dontnote **ILicensingService +# StrongHttpsClient and its support classes are totally unused, so the +# ch.boye.httpclientandroidlib.** classes are also unneeded +-dontwarn info.guardianproject.netcipher.client.** + # These libraries are known to break if minification is enabled on them. They # use reflection to instantiate classes, for example. If the keep flags are # removed, proguard will strip classes which are required, which may result in diff --git a/F-Droid/res/values/strings.xml b/F-Droid/res/values/strings.xml index bd55734cb..e60b30152 100644 --- a/F-Droid/res/values/strings.xml +++ b/F-Droid/res/values/strings.xml @@ -166,6 +166,8 @@ Next Skip + Use Tor + Force download traffic through Tor for increased privacy Proxy Enable HTTP Proxy Configure HTTP Proxy for all network requests diff --git a/F-Droid/res/xml/preferences.xml b/F-Droid/res/xml/preferences.xml index 165b05864..43cb8b184 100644 --- a/F-Droid/res/xml/preferences.xml +++ b/F-Droid/res/xml/preferences.xml @@ -48,6 +48,10 @@ android:title="@string/local_repo_name" /> + Date: Fri, 26 Feb 2016 20:35:31 +0100 Subject: [PATCH 3/5] 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 --- F-Droid/src/org/fdroid/fdroid/FDroid.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/F-Droid/src/org/fdroid/fdroid/FDroid.java b/F-Droid/src/org/fdroid/fdroid/FDroid.java index 5d6e8b1a0..eea6abf93 100644 --- a/F-Droid/src/org/fdroid/fdroid/FDroid.java +++ b/F-Droid/src/org/fdroid/fdroid/FDroid.java @@ -28,6 +28,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.database.ContentObserver; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -290,6 +291,10 @@ public class FDroid extends AppCompatActivity implements SearchView.OnQueryTextL MenuItem btItem = menu.findItem(R.id.action_bluetooth_apk); btItem.setVisible(false); } + if (Build.VERSION.SDK_INT < 10) { + MenuItem menuItem = menu.findItem(R.id.action_swap); + menuItem.setVisible(false); + } SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchMenuItem = menu.findItem(R.id.action_search); From 26b35723d30b5d9e5b7fddfdacbcb475db2da0bb Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 26 Feb 2016 21:03:25 +0100 Subject: [PATCH 4/5] 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. --- .../fdroid/localrepo/type/SwapType.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/F-Droid/src/org/fdroid/fdroid/localrepo/type/SwapType.java b/F-Droid/src/org/fdroid/fdroid/localrepo/type/SwapType.java index 1a2ee1a78..8e45aafc8 100644 --- a/F-Droid/src/org/fdroid/fdroid/localrepo/type/SwapType.java +++ b/F-Droid/src/org/fdroid/fdroid/localrepo/type/SwapType.java @@ -2,6 +2,7 @@ package org.fdroid.fdroid.localrepo.type; import android.content.Context; import android.content.Intent; +import android.os.AsyncTask; import android.support.annotation.NonNull; import android.support.v4.content.LocalBroadcastManager; @@ -70,12 +71,13 @@ public abstract class SwapType { } public void startInBackground() { - new Thread() { + new AsyncTask() { @Override - public void run() { - SwapType.this.start(); + protected Void doInBackground(Void... params) { + start(); + return null; } - }.start(); + }.execute(); } private void ensureRunning() { @@ -85,21 +87,23 @@ public abstract class SwapType { } public void ensureRunningInBackground() { - new Thread() { + new AsyncTask() { @Override - public void run() { + protected Void doInBackground(Void... params) { ensureRunning(); + return null; } - }.start(); + }.execute(); } public void stopInBackground() { - new Thread() { + new AsyncTask() { @Override - public void run() { - SwapType.this.stop(); + protected Void doInBackground(Void... params) { + stop(); + return null; } - }.start(); + }.execute(); } } From fd03ebd764576f16f2f71b91af70fd8240d947d1 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 26 Feb 2016 22:22:10 +0100 Subject: [PATCH 5/5] annotate swap methods that require android-10 swap only works on >= android-10 anyway closes #581 https://gitlab.com/fdroid/fdroidclient/issues/581 --- .../src/org/fdroid/fdroid/net/bluetooth/BluetoothClient.java | 2 ++ .../src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothClient.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothClient.java index 44ec1a0d3..ccb907c8d 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothClient.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothClient.java @@ -1,5 +1,6 @@ package org.fdroid.fdroid.net.bluetooth; +import android.annotation.TargetApi; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; @@ -21,6 +22,7 @@ public class BluetoothClient { device = BluetoothAdapter.getDefaultAdapter().getRemoteDevice(macAddress); } + @TargetApi(10) public BluetoothConnection openConnection() throws IOException { BluetoothSocket socket = null; diff --git a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java index 3c39917f9..848192731 100644 --- a/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java +++ b/F-Droid/src/org/fdroid/fdroid/net/bluetooth/BluetoothServer.java @@ -1,5 +1,6 @@ package org.fdroid.fdroid.net.bluetooth; +import android.annotation.TargetApi; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothServerSocket; import android.bluetooth.BluetoothSocket; @@ -61,6 +62,7 @@ public class BluetoothServer extends Thread { } } + @TargetApi(10) @Override public void run() {