diff options
52 files changed, 115 insertions, 137 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index d549ad6a..89af1568 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -22,9 +22,13 @@ <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> - <!-- if you want to run the unit test for Dashboard you will need that you uncomment the following line --> - <!-- <uses-permission android:name="android.permission.WRITE_SETTINGS" /> --> - + + <!-- if you want to run test, this permissions are needed. Gradle will get rid of them once we implement it. --> + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> + <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- <uses-permission android:name="com.android.vending.BILLING" /> --> @@ -27,7 +27,7 @@ signed with a different key. Manually uninstall Bitmask Android from your devic you will then be able to install your own built version. To uninstall it, do: adb uninstall se.leap.bitmaskclient -See [here](https://github.com/parmegv/bitmask_android/blob/feature/docs/Building_from_eclipse.md) for +See [here](https://github.com/leapcode/bitmask_android/blob/develop/Building_from_eclipse.md) for instructions on building from [Eclipse](http://eclipse.org). ## Acknowledgements diff --git a/assets/urls/bitmask demo.url b/assets/urls/bitmask demo.url new file mode 100644 index 00000000..1a412055 --- /dev/null +++ b/assets/urls/bitmask demo.url @@ -0,0 +1,3 @@ +{
+ "main_url" : "https://demo.bitmask.net/"
+}
diff --git a/assets/urls/bitmask.url b/assets/urls/bitmask.url deleted file mode 100644 index f924301e..00000000 --- a/assets/urls/bitmask.url +++ /dev/null @@ -1,3 +0,0 @@ -{
- "main_url" : "https://bitmask.net/"
-}
\ No newline at end of file diff --git a/res/layout/about.xml b/res/layout/about.xml index 875bba64..ce57564d 100644 --- a/res/layout/about.xml +++ b/res/layout/about.xml @@ -36,11 +36,29 @@ android:autoLink="all" android:text="@string/repository_url_text" /> + <Space + android:layout_width="match_parent" + android:layout_height="10sp" /> + + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:autoLink="all" + android:text="@string/translation_project_text" /> + + <Space + android:layout_width="match_parent" + android:layout_height="10sp" /> + <TextView - android:id="@+id/translation" android:layout_width="match_parent" android:layout_height="wrap_content" - android:autoLink="all" /> + android:autoLink="all" + android:text="@string/translationby" /> + + <Space + android:layout_width="match_parent" + android:layout_height="10sp" /> <TextView android:layout_width="match_parent" diff --git a/res/values-ca/arrays.xml b/res/values-ca/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-ca/arrays.xml +++ b/res/values-ca/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml index abef84cc..2b250da1 100755 --- a/res/values-ca/strings.xml +++ b/res/values-ca/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Cancel·la</string> <string name="about">Quan a</string> diff --git a/res/values-cs/arrays.xml b/res/values-cs/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-cs/arrays.xml +++ b/res/values-cs/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml index cfb27325..68c5aeaf 100755 --- a/res/values-cs/strings.xml +++ b/res/values-cs/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Storno</string> <string name="repository_url_text">Zdrojové kódy a seznam problémů je na https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-de/arrays.xml b/res/values-de/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-de/arrays.xml +++ b/res/values-de/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml index 17b398a0..84d93cfe 100755 --- a/res/values-de/strings.xml +++ b/res/values-de/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Abbrechen</string> <string name="repository_url_text">Quellcode und Issue Tracker sind verfügbar unter https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-es/arrays.xml b/res/values-es/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-es/arrays.xml +++ b/res/values-es/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml index 1c5ea231..f8046a3f 100755 --- a/res/values-es/strings.xml +++ b/res/values-es/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Cancelar</string> <string name="repository_url_text">Codigo fuente y sistema de reporte de errores disponibles en https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-et/arrays.xml b/res/values-et/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-et/arrays.xml +++ b/res/values-et/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-et/strings.xml b/res/values-et/strings.xml index c4aadd0f..04dc9572 100755 --- a/res/values-et/strings.xml +++ b/res/values-et/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Tühista</string> <string name="repository_url_text">Lähtetekst ja probleemihaldur asuvad veebilehel https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-fr/arrays.xml b/res/values-fr/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-fr/arrays.xml +++ b/res/values-fr/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-fr/strings.xml b/res/values-fr/strings.xml index 4b822aff..79e4d70c 100755 --- a/res/values-fr/strings.xml +++ b/res/values-fr/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">"Annuler"</string> <string name="repository_url_text">"Le code source et le tracker de bugs est disponible ici: https://github.com/leapcode/bitmask_android/ "</string> diff --git a/res/values-id/arrays.xml b/res/values-id/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-id/arrays.xml +++ b/res/values-id/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-id/strings.xml b/res/values-id/strings.xml index 61f753e9..ad893b75 100755 --- a/res/values-id/strings.xml +++ b/res/values-id/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Batal</string> <string name="repository_url_text">Kode program dan perekam masalah tersedia di</string> diff --git a/res/values-it/arrays.xml b/res/values-it/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-it/arrays.xml +++ b/res/values-it/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml index 2eb6515d..788dbcc5 100755 --- a/res/values-it/strings.xml +++ b/res/values-it/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">Annulla</string> <string name="repository_url_text">Il codice sorgente e il bug tracker sono disponibili all\'indirizzo https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-ja/arrays.xml b/res/values-ja/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-ja/arrays.xml +++ b/res/values-ja/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-ja/strings.xml b/res/values-ja/strings.xml index fa62b669..4503c227 100755 --- a/res/values-ja/strings.xml +++ b/res/values-ja/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="cancel">キャンセル</string> <string name="repository_url_text">ソースコードと問題管理は以下で: https://github.com/leapcode/bitmask_android/</string> diff --git a/res/values-ko/arrays.xml b/res/values-ko/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-ko/arrays.xml +++ b/res/values-ko/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-ko/strings.xml b/res/values-ko/strings.xml index fe5db09b..8a725bad 100755 --- a/res/values-ko/strings.xml +++ b/res/values-ko/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="repository_url_text">소스 코드와 문제 추적기는 https://github.com/leapcode/bitmask_android/에서 사용할 수 있습니다</string> <string name="copyright_others">프로그램은 다음 구성 요소를 사용합니다. 라이선스에 대 한 자세한 내용은 소스를 참조 하십시오</string> diff --git a/res/values-nl/arrays.xml b/res/values-nl/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-nl/arrays.xml +++ b/res/values-nl/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml index 8dc13847..0442b054 100755 --- a/res/values-nl/strings.xml +++ b/res/values-nl/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="about">Over</string> <string name="no_error_found">Geen fout.</string> diff --git a/res/values-no/arrays.xml b/res/values-no/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-no/arrays.xml +++ b/res/values-no/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-no/strings.xml b/res/values-no/strings.xml index 728b2fca..a363b2f9 100755 --- a/res/values-no/strings.xml +++ b/res/values-no/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="about">Om</string> <string name="no_error_found">Ingen feil funnet</string> diff --git a/res/values-ro/arrays.xml b/res/values-ro/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-ro/arrays.xml +++ b/res/values-ro/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-ro/strings.xml b/res/values-ro/strings.xml index 91d9c0e0..22496320 100755 --- a/res/values-ro/strings.xml +++ b/res/values-ro/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="repository_url_text">Cod sursă şi tracker probleme disponibile la https://github.com/leapcode/bitmask_android/</string> <string name="copyright_others">Acest program utilizează următoarele componente; a se vedea codul sursă pentru mai multe detalii despre licente</string> diff --git a/res/values-ru/arrays.xml b/res/values-ru/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-ru/arrays.xml +++ b/res/values-ru/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-ru/strings.xml b/res/values-ru/strings.xml index 4ecf881a..aaa42690 100755 --- a/res/values-ru/strings.xml +++ b/res/values-ru/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="copyright_others">Данная программа использует следующие компоненты; смотрите исходный код для получения подробной информации о лицензии</string> <string name="about">О программе</string> diff --git a/res/values-uk/arrays.xml b/res/values-uk/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-uk/arrays.xml +++ b/res/values-uk/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-uk/strings.xml b/res/values-uk/strings.xml index 354f50ed..dab28b48 100755 --- a/res/values-uk/strings.xml +++ b/res/values-uk/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="repository_url_text">Початковий код і відстеження проблем доступні по https://github.com/leapcode/bitmask_android/</string> <string name="copyright_others">Ця програма використовує такі компоненти; перегляньте вихідний код для повної інформації про ліцензії</string> diff --git a/res/values-zh-rCN/arrays.xml b/res/values-zh-rCN/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-zh-rCN/arrays.xml +++ b/res/values-zh-rCN/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 5610e8d9..ae57d277 100755 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="repository_url_text">请前往 https://github.com/leapcode/bitmask_android/ 源码或提供问题反馈</string> <string name="copyright_others">本程序使用以下组件,请在 Licenses 查看源码获取更详细内容。</string> diff --git a/res/values-zh-rTW/arrays.xml b/res/values-zh-rTW/arrays.xml index 03dcda8c..045e125f 100755 --- a/res/values-zh-rTW/arrays.xml +++ b/res/values-zh-rTW/arrays.xml @@ -1,4 +1,3 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> </resources> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index 05056f07..880fb4ad 100755 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -1,5 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> -<!--Generated by crowdin.net--> <resources> <string name="repository_url_text">取得原始碼與個案追蹤,可上 https://github.com/leapcode/bitmask_android/</string> <string name="copyright_others">本程序使用了以下元件,其作者和授權資訊如下</string> diff --git a/res/values/strings.xml b/res/values/strings.xml index bfdf5acd..bcb6ecc9 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Generated by crowdin.net --> <resources> <string name="cancel">Cancel</string> <string name="ok">OK</string> <string name="retry">Retry</string> <string name="repository_url_text">Source code and issue tracker available at https://github.com/leapcode/bitmask_android/</string> + <string name="translation_project_text">Translations welcome and appreciated. See our Transifex project at https://www.transifex.com/projects/p/bitmask-android/</string> <string name="copyright_others">This program uses the following components; see the source code for full details on the licenses</string> <string name="about">About Bitmask</string> <string name="switch_provider_menu_option">Switch provider</string> @@ -54,10 +54,10 @@ <string name="building_configration">Building configuration…</string> <string name="cert_from_keystore">Got certificate \'%s\' from Keystore</string> <string name="netstatus">Network Status: %s</string> - <string name="keychain_nocacert">No CA Certificate returned while reading from Android keystore. Auhtentication will probably fail.</string> + <string name="keychain_nocacert">No CA Certificate returned while reading from Android keystore. Authentication will probably fail.</string> <string name="mobile_info">Running on %1$s (%2$s) %3$s, Android API %4$d</string> <string name="error_rsa_sign">Error signing with Android keystore key %1$s: %2$s</string> - <string name="translationby">English translation by Arne Schwabe<arne@rfc2549.org></string> + <string name="translationby">English translation by Arne Schwabe <arne@rfc2549.org></string> <string name="warn_no_dns">No DNS servers being used. Name resolution may not work. Consider setting custom DNS Servers</string> <string name="dns_add_error">Could not add DNS Server \"%1$s\", rejected by the system: %2$s</string> <string name="getproxy_error">Error getting proxy settings: %s</string> @@ -94,7 +94,6 @@ <string name="authed_secured_status">Connection secure using your own certificate.</string> <string name="eip_service_label">Encrypted Internet</string> <string name="title_activity_configuration_wizard">Select a service provider</string> - <string name="top_padding">Top padding</string> <string name="new_provider_button">Add new Provider</string> <string name="introduce_new_provider">Add a new service provider</string> <string name="save">Save</string> @@ -122,7 +121,7 @@ <string name="setup_error_configure_button">Configure</string> <string name="setup_error_close_button">Exit</string> <string name="setup_error_text">There was an error configuring Bitmask with your chosen provider.\n\nYou may choose to reconfigure, or exit and configure a provider upon next launch.</string> - <string name="server_is_down_message">Server is down.</string> + <string name="server_unreachable_message">Server is unreachable, please try again.</string> <string name="malformed_url">It doesn\'t seem to be a Bitmask provider.</string> <string name="certificate_error">This is not a trusted Bitmask provider.</string> <string name="configuring_provider">Configuring provider</string> diff --git a/src/se/leap/bitmaskclient/AboutActivity.java b/src/se/leap/bitmaskclient/AboutActivity.java index a3320c81..6d025422 100644 --- a/src/se/leap/bitmaskclient/AboutActivity.java +++ b/src/se/leap/bitmaskclient/AboutActivity.java @@ -18,7 +18,7 @@ public class AboutActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(savedInstanceState); setContentView(R.layout.about); TextView ver = (TextView) findViewById(R.id.version); @@ -34,15 +34,7 @@ public class AboutActivity extends Activity { ver.setText(getString(R.string.version_info,name,version)); - - TextView translation = (TextView) findViewById(R.id.translation); - - // Don't print a text for myself - if ( getString(R.string.translationby).contains("Arne Schwabe")) - translation.setVisibility(TextView.INVISIBLE); - else - translation.setText(R.string.translationby); - setResult(VIEWED); + setResult(VIEWED); } } diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java index e5ad5b3d..1c5f6048 100644 --- a/src/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java @@ -137,9 +137,9 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD public void refreshProviderList(int top_padding) {
ProviderListFragment new_provider_list_fragment = new ProviderListFragment();
Bundle top_padding_bundle = new Bundle();
- top_padding_bundle.putInt(getResources().getString(R.string.top_padding), top_padding);
+ top_padding_bundle.putInt(ProviderListFragment.TOP_PADDING, top_padding);
new_provider_list_fragment.setArguments(top_padding_bundle);
-
+
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.configuration_wizard_layout, new_provider_list_fragment, ProviderListFragment.TAG)
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java index b4d06f23..65fd2d5b 100644 --- a/src/se/leap/bitmaskclient/Dashboard.java +++ b/src/se/leap/bitmaskclient/Dashboard.java @@ -110,7 +110,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf updateEIP.setAction(EIP.ACTION_UPDATE_EIP_SERVICE); startService(updateEIP); buildDashboard(); - + invalidateOptionsMenu(); if(data != null && data.hasExtra(LogInDialog.VERB)) { View view = ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0); logInDialog(view, Bundle.EMPTY); diff --git a/src/se/leap/bitmaskclient/EIP.java b/src/se/leap/bitmaskclient/EIP.java index 169178d1..e773e3b9 100644 --- a/src/se/leap/bitmaskclient/EIP.java +++ b/src/se/leap/bitmaskclient/EIP.java @@ -280,9 +280,9 @@ public final class EIP extends IntentService { if(parsedEipSerial == 0) { // Delete all vpn profiles ProfileManager vpl = ProfileManager.getInstance(context); - Collection<VpnProfile> profiles = vpl.getProfiles(); - for (VpnProfile profile : profiles){ - vpl.removeProfile(context, profile); + VpnProfile[] profiles = (VpnProfile[]) vpl.getProfiles().toArray(new VpnProfile[vpl.getProfiles().size()]); + for (int current_profile = 0; current_profile < profiles.length; current_profile++){ + vpl.removeProfile(context, profiles[current_profile]); } } if (eipDefinition.optInt("serial") > parsedEipSerial) @@ -332,14 +332,15 @@ public final class EIP extends IntentService { } } - String closestLocation = offsets.firstEntry().getValue().iterator().next(); + + String closestLocation = offsets.isEmpty() ? "" : offsets.firstEntry().getValue().iterator().next(); JSONArray gateways = null; String chosenHost = null; try { gateways = eipDefinition.getJSONArray("gateways"); for (int i = 0; i < gateways.length(); i++) { JSONObject gw = gateways.getJSONObject(i); - if ( gw.getString("location").equalsIgnoreCase(closestLocation) ){ + if ( gw.getString("location").equalsIgnoreCase(closestLocation) || closestLocation.isEmpty()){ chosenHost = gw.getString("host"); break; } diff --git a/src/se/leap/bitmaskclient/LeapSRPSession.java b/src/se/leap/bitmaskclient/LeapSRPSession.java index 0849f777..a317d95e 100644 --- a/src/se/leap/bitmaskclient/LeapSRPSession.java +++ b/src/se/leap/bitmaskclient/LeapSRPSession.java @@ -41,7 +41,8 @@ public class LeapSRPSession { final public static String M1 = "M1"; final public static String M2 = "M2"; final public static String TOKEN = "token"; - + final public static String AUTHORIZATION_HEADER= "Authorization"; + private SRPParameters params; private String username; private String password; diff --git a/src/se/leap/bitmaskclient/ProviderAPI.java b/src/se/leap/bitmaskclient/ProviderAPI.java index 5344e471..7aafa2e3 100644 --- a/src/se/leap/bitmaskclient/ProviderAPI.java +++ b/src/se/leap/bitmaskclient/ProviderAPI.java @@ -601,12 +601,12 @@ public class ProviderAPI extends IntentService { URLConnection url_connection = provider_url.openConnection(); url_connection.setConnectTimeout(seconds_of_timeout*1000); if(!LeapSRPSession.getToken().isEmpty()) - url_connection.addRequestProperty(LeapSRPSession.TOKEN, LeapSRPSession.getToken()); + url_connection.addRequestProperty(LeapSRPSession.AUTHORIZATION_HEADER, "Token token = " + LeapSRPSession.getToken()); json_file_content = new Scanner(url_connection.getInputStream()).useDelimiter("\\A").next(); } catch (MalformedURLException e) { json_file_content = formatErrorMessage(R.string.malformed_url); } catch(SocketTimeoutException e) { - json_file_content = formatErrorMessage(R.string.server_is_down_message); + json_file_content = formatErrorMessage(R.string.server_unreachable_message); } catch (IOException e) { if(provider_url != null) { json_file_content = downloadWithProviderCA(string_url, danger_on); @@ -638,13 +638,13 @@ public class ProviderAPI extends IntentService { (HttpsURLConnection)url.openConnection(); urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory()); if(!LeapSRPSession.getToken().isEmpty()) - urlConnection.addRequestProperty(LeapSRPSession.TOKEN, LeapSRPSession.getToken()); + urlConnection.addRequestProperty(LeapSRPSession.AUTHORIZATION_HEADER, "Token token=" + LeapSRPSession.getToken()); json_file_content = new Scanner(urlConnection.getInputStream()).useDelimiter("\\A").next(); } catch (CertificateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnknownHostException e) { - json_file_content = formatErrorMessage(R.string.server_is_down_message); + json_file_content = formatErrorMessage(R.string.server_unreachable_message); } catch (IOException e) { // The downloaded certificate doesn't validate our https connection. if(danger_on) { @@ -727,7 +727,7 @@ public class ProviderAPI extends IntentService { System.out.println("String ignoring certificate = " + string); } catch (FileNotFoundException e) { e.printStackTrace(); - string = formatErrorMessage(R.string.server_is_down_message); + string = formatErrorMessage(R.string.server_unreachable_message); } catch (IOException e) { // The downloaded certificate doesn't validate our https connection. e.printStackTrace(); diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java index 45047982..f35cf739 100644 --- a/src/se/leap/bitmaskclient/ProviderListFragment.java +++ b/src/se/leap/bitmaskclient/ProviderListFragment.java @@ -39,7 +39,7 @@ public class ProviderListFragment extends ListFragment { public static String TAG = "provider_list_fragment";
public static String SHOW_ALL_PROVIDERS = "show_all_providers";
-
+ public static String TOP_PADDING = "top padding from providerlistfragment";
private ProviderListAdapter<ProviderItem> content_adapter;
/**
@@ -120,9 +120,8 @@ public class ProviderListFragment extends ListFragment { && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
}
- String top_padding_key = getResources().getString(R.string.top_padding);
- if(getArguments() != null && getArguments().containsKey(top_padding_key)) {
- int topPadding = getArguments().getInt(top_padding_key);
+ if(getArguments() != null && getArguments().containsKey(TOP_PADDING)) {
+ int topPadding = getArguments().getInt(TOP_PADDING);
View current_view = getView();
getView().setPadding(current_view.getPaddingLeft(), topPadding, current_view.getPaddingRight(), current_view.getPaddingBottom());
}
diff --git a/src/se/leap/openvpn/ConfigParser.java b/src/se/leap/openvpn/ConfigParser.java index 36585d29..df4eae1b 100644 --- a/src/se/leap/openvpn/ConfigParser.java +++ b/src/se/leap/openvpn/ConfigParser.java @@ -357,7 +357,7 @@ public class ConfigParser { } // Parse remote config - Vector<String> location = getOption("location",1,2); + Vector<String> location = getOption("location",0,2); if(location != null && location.size() == 2){ np.mLocation = location.get(1).replace("__", ", "); } diff --git a/tests/libs/android-support-v4.jar b/tests/libs/android-support-v4.jar Binary files differnew file mode 100644 index 00000000..96644edb --- /dev/null +++ b/tests/libs/android-support-v4.jar diff --git a/tests/src/se/leap/bitmaskclient/test/ConnectionManager.java b/tests/src/se/leap/bitmaskclient/test/ConnectionManager.java new file mode 100644 index 00000000..f1cbff19 --- /dev/null +++ b/tests/src/se/leap/bitmaskclient/test/ConnectionManager.java @@ -0,0 +1,33 @@ +package se.leap.bitmaskclient.test; + +import android.content.Context; +import android.net.ConnectivityManager; +import android.net.wifi.WifiManager; +import android.util.Log; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class ConnectionManager { + static void setMobileDataEnabled(boolean enabled, Context context) { + final ConnectivityManager conman = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + Method[] methods = conman.getClass().getMethods(); + for (Method method : methods) { + if (method.getName().equals("setMobileDataEnabled")) { + method.setAccessible(true); + try { + method.invoke(conman, enabled); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + } + } + + static void setWifiEnabled(boolean enabled, Context context) { + WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + wifiManager.setWifiEnabled(enabled); + } +} diff --git a/tests/src/se/leap/bitmaskclient/test/testConfigurationWizard.java b/tests/src/se/leap/bitmaskclient/test/testConfigurationWizard.java index 55fd87ae..847d8cdd 100644 --- a/tests/src/se/leap/bitmaskclient/test/testConfigurationWizard.java +++ b/tests/src/se/leap/bitmaskclient/test/testConfigurationWizard.java @@ -1,15 +1,14 @@ package se.leap.bitmaskclient.test; +import android.test.ActivityInstrumentationTestCase2; +import android.widget.ListView; +import com.jayway.android.robotium.solo.Solo; import java.io.IOException; - import se.leap.bitmaskclient.AboutActivity; import se.leap.bitmaskclient.ConfigurationWizard; import se.leap.bitmaskclient.ProviderDetailFragment; import se.leap.bitmaskclient.R; -import android.test.ActivityInstrumentationTestCase2; -import android.widget.ListView; - -import com.jayway.android.robotium.solo.Solo; +import se.leap.bitmaskclient.test.ConnectionManager; public class testConfigurationWizard extends ActivityInstrumentationTestCase2<ConfigurationWizard> { @@ -24,6 +23,7 @@ public class testConfigurationWizard extends ActivityInstrumentationTestCase2<Co protected void setUp() throws Exception { super.setUp(); solo = new Solo(getInstrumentation(), getActivity()); + ConnectionManager.setMobileDataEnabled(true, solo.getCurrentActivity().getApplicationContext()); } @Override diff --git a/tests/src/se/leap/bitmaskclient/test/testDashboard.java b/tests/src/se/leap/bitmaskclient/test/testDashboard.java index b6c23084..269f1d18 100644 --- a/tests/src/se/leap/bitmaskclient/test/testDashboard.java +++ b/tests/src/se/leap/bitmaskclient/test/testDashboard.java @@ -1,8 +1,5 @@ package se.leap.bitmaskclient.test; -import se.leap.bitmaskclient.ConfigurationWizard; -import se.leap.bitmaskclient.Dashboard; -import se.leap.bitmaskclient.R; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -10,8 +7,11 @@ import android.content.IntentFilter; import android.provider.Settings; import android.test.ActivityInstrumentationTestCase2; import android.util.Log; - import com.jayway.android.robotium.solo.Solo; +import se.leap.bitmaskclient.ConfigurationWizard; +import se.leap.bitmaskclient.Dashboard; +import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.test.ConnectionManager; public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { @@ -25,7 +25,7 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { protected void setUp() throws Exception { super.setUp(); solo = new Solo(getInstrumentation(), getActivity()); - setAirplaneMode(false); + ConnectionManager.setMobileDataEnabled(true, solo.getCurrentActivity().getApplicationContext()); } @Override @@ -39,30 +39,28 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { */ public void testOnOffOpenVpn() { solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText("Initiating connection")) + if(!solo.waitForText(getActivity().getString(R.string.eip_status_start_pending))) fail(); - if(!solo.waitForText("Authenticating")) + if(!solo.waitForText(getActivity().getString(R.string.state_auth))) fail(); - if(!solo.waitForText("Connection Secure", 1, 30*1000)) + if(!solo.waitForText(getActivity().getString(R.string.eip_state_connected), 1, 30*1000)) fail(); solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText("Not running! Connection not secure")) - fail(); - /* setAirplaneMode isn't working right now. - setAirplaneMode(true); - if(!solo.waitForLogMessage("Service state changed")) - fail(); + if(!solo.waitForText(getActivity().getString(R.string.eip_state_not_connected))) + fail(); + + ConnectionManager.setMobileDataEnabled(false, solo.getCurrentActivity().getApplicationContext()); solo.clickOnView(solo.getView(R.id.eipSwitch)); - if(!solo.waitForText("Initiating connection")) + if(!solo.waitForText(getActivity().getString(R.string.eip_status_start_pending))) fail(); - if(!solo.waitForText("Waiting for usable network")) + if(!solo.waitForText(getActivity().getString(R.string.state_nonetwork))) fail(); - */ + } - public void testLogInAndOut() { + public void testLogInAndOut() { long miliseconds_to_log_in = 40 * 1000; solo.clickOnActionBarItem(R.id.login_button); solo.enterText(0, "parmegvtest1"); @@ -70,7 +68,7 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { solo.clickOnText("Log In"); solo.waitForDialogToClose(); solo.waitForDialogToClose(miliseconds_to_log_in); - if(!solo.waitForText("Your own cert has been correctly downloaded.")) + if(!solo.waitForText(getActivity().getString(R.string.succesful_authentication_message))) fail(); solo.clickOnActionBarItem(R.string.logout_button); @@ -78,52 +76,19 @@ public class testDashboard extends ActivityInstrumentationTestCase2<Dashboard> { fail(); } - public void testShowSettings() { - solo.clickOnActionBarItem(R.id.menu_settings); - } - public void testShowAbout() { - solo.clickOnMenuItem("About"); + solo.clickOnMenuItem(getActivity().getString(R.string.about)); solo.waitForText(getActivity().getString(R.string.repository_url_text)); solo.goBack(); - solo.clickOnMenuItem("About"); + solo.clickOnMenuItem(getActivity().getString(R.string.about)); solo.waitForText(getActivity().getString(R.string.repository_url_text)); solo.goBack(); } public void testSwitchProvider() { - solo.clickOnMenuItem("Switch provider"); - solo.waitForActivity(ConfigurationWizard.class); - solo.goBack(); - - solo.clickOnMenuItem("Switch provider"); + solo.clickOnMenuItem(getActivity().getString(R.string.switch_provider_menu_option)); solo.waitForActivity(ConfigurationWizard.class); solo.goBack(); } - - private void setAirplaneMode(boolean airplane_mode) { - Context context = solo.getCurrentActivity().getApplicationContext(); - boolean isEnabled = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1; - Log.d("AirplaneMode", "Service state: " + isEnabled); - Settings.System.putInt(context.getContentResolver(),Settings.System.AIRPLANE_MODE_ON, airplane_mode ? 1 : 0); - - // Post an intent to reload - Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED); - intent.putExtra("state", airplane_mode); - Log.d("AirplaneMode", "New Service state: " + !isEnabled); - solo.getCurrentActivity().sendBroadcast(intent); - - IntentFilter intentFilter = new IntentFilter("android.intent.action.SERVICE_STATE"); - - BroadcastReceiver receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - boolean isEnabled = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1; - Log.d("AirplaneMode", "Service state changed: " + isEnabled); - } - }; - - context.registerReceiver(receiver, intentFilter); - } } |