From: Tobias Brunner Date: Fri, 24 Jul 2015 09:47:53 +0000 (+0200) Subject: android: Extend GUI so the split tunneling options can be set X-Git-Tag: 5.3.3dr3~8^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ee84fa9762245edc403f56a24f465428c935e41;p=thirdparty%2Fstrongswan.git android: Extend GUI so the split tunneling options can be set --- diff --git a/src/frontends/android/res/layout/profile_detail_view.xml b/src/frontends/android/res/layout/profile_detail_view.xml index 089f0655bc..57d5606ffc 100644 --- a/src/frontends/android/res/layout/profile_detail_view.xml +++ b/src/frontends/android/res/layout/profile_detail_view.xml @@ -179,6 +179,24 @@ android:inputType="number|textNoSuggestions" android:hint="@string/profile_use_default_hint" /> + + + + + + diff --git a/src/frontends/android/res/values-de/strings.xml b/src/frontends/android/res/values-de/strings.xml index 6cdb5b37d1..6cd5ba50a2 100644 --- a/src/frontends/android/res/values-de/strings.xml +++ b/src/frontends/android/res/values-de/strings.xml @@ -67,6 +67,9 @@ MTU: Server Port: (Standardwert verwenden) + Split-Tunneling: + Blockiere IPv4 Verkehr der nicht für das VPN bestimmt ist + Blockiere IPv6 Verkehr der nicht für das VPN bestimmt ist Bitte geben Sie hier die Gateway-Adresse ein Bitte geben Sie hier Ihren Benutzernamen ein diff --git a/src/frontends/android/res/values-pl/strings.xml b/src/frontends/android/res/values-pl/strings.xml index 87c6a2726a..fb2aba0037 100644 --- a/src/frontends/android/res/values-pl/strings.xml +++ b/src/frontends/android/res/values-pl/strings.xml @@ -67,6 +67,9 @@ MTU: Server port: (use default) + Split tunneling: + Block IPv4 traffic not destined for the VPN + Block IPv6 traffic not destined for the VPN Wprowadź adres bramki Wprowadź swoją nazwę użytkownika diff --git a/src/frontends/android/res/values-ru/strings.xml b/src/frontends/android/res/values-ru/strings.xml index 4164f61ca5..eabfc084bb 100644 --- a/src/frontends/android/res/values-ru/strings.xml +++ b/src/frontends/android/res/values-ru/strings.xml @@ -64,6 +64,9 @@ MTU: Server port: (use default) + Split tunneling: + Block IPv4 traffic not destined for the VPN + Block IPv6 traffic not destined for the VPN Пожалуйста введите адрес шлюза Пожалуйста введите имя пользователя diff --git a/src/frontends/android/res/values-ua/strings.xml b/src/frontends/android/res/values-ua/strings.xml index 7e3a73531f..d7c2383703 100644 --- a/src/frontends/android/res/values-ua/strings.xml +++ b/src/frontends/android/res/values-ua/strings.xml @@ -65,6 +65,9 @@ MTU: Server port: (use default) + Split tunneling: + Block IPv4 traffic not destined for the VPN + Block IPv6 traffic not destined for the VPN Введіть адресу шлюза тут Введіть ім\'я користувача тут diff --git a/src/frontends/android/res/values/strings.xml b/src/frontends/android/res/values/strings.xml index 3c067611d8..5c8ebab57a 100644 --- a/src/frontends/android/res/values/strings.xml +++ b/src/frontends/android/res/values/strings.xml @@ -67,6 +67,9 @@ MTU: Server port: (use default) + Split tunneling: + Block IPv4 traffic not destined for the VPN + Block IPv6 traffic not destined for the VPN Please enter the gateway address here Please enter your username here diff --git a/src/frontends/android/src/org/strongswan/android/ui/VpnProfileDetailActivity.java b/src/frontends/android/src/org/strongswan/android/ui/VpnProfileDetailActivity.java index ff1625c625..a8b3daa068 100644 --- a/src/frontends/android/src/org/strongswan/android/ui/VpnProfileDetailActivity.java +++ b/src/frontends/android/src/org/strongswan/android/ui/VpnProfileDetailActivity.java @@ -85,6 +85,8 @@ public class VpnProfileDetailActivity extends Activity private ViewGroup mAdvancedSettings; private EditText mMTU; private EditText mPort; + private CheckBox mBlockIPv4; + private CheckBox mBlockIPv6; @Override public void onCreate(Bundle savedInstanceState) @@ -119,6 +121,8 @@ public class VpnProfileDetailActivity extends Activity mMTU = (EditText)findViewById(R.id.mtu); mPort = (EditText)findViewById(R.id.port); + mBlockIPv4 = (CheckBox)findViewById(R.id.split_tunneling_v4); + mBlockIPv6 = (CheckBox)findViewById(R.id.split_tunneling_v6); mSelectVpnType.setOnItemSelectedListener(new OnItemSelectedListener() { @Override @@ -344,7 +348,8 @@ public class VpnProfileDetailActivity extends Activity boolean show = mShowAdvanced.isChecked(); if (!show && mProfile != null) { - show = mProfile.getMTU() != null || mProfile.getPort() != null; + Integer st = mProfile.getSplitTunneling(); + show = mProfile.getMTU() != null || mProfile.getPort() != null || (st != null && st != 0); } mShowAdvanced.setVisibility(!show ? View.VISIBLE : View.GONE); mAdvancedSettings.setVisibility(show ? View.VISIBLE : View.GONE); @@ -445,6 +450,10 @@ public class VpnProfileDetailActivity extends Activity mProfile.setCertificateAlias(certAlias); mProfile.setMTU(getInteger(mMTU)); mProfile.setPort(getInteger(mPort)); + int st = 0; + st |= mBlockIPv4.isChecked() ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4 : 0; + st |= mBlockIPv6.isChecked() ? VpnProfile.SPLIT_TUNNELING_BLOCK_IPV6 : 0; + mProfile.setSplitTunneling(st == 0 ? null : st); } /** @@ -469,6 +478,8 @@ public class VpnProfileDetailActivity extends Activity mPassword.setText(mProfile.getPassword()); mMTU.setText(mProfile.getMTU() != null ? mProfile.getMTU().toString() : null); mPort.setText(mProfile.getPort() != null ? mProfile.getPort().toString() : null); + mBlockIPv4.setChecked(mProfile.getSplitTunneling() != null ? (mProfile.getSplitTunneling() & VpnProfile.SPLIT_TUNNELING_BLOCK_IPV4) != 0 : false); + mBlockIPv6.setChecked(mProfile.getSplitTunneling() != null ? (mProfile.getSplitTunneling() & VpnProfile.SPLIT_TUNNELING_BLOCK_IPV6) != 0 : false); useralias = mProfile.getUserCertificateAlias(); alias = mProfile.getCertificateAlias(); getActionBar().setTitle(mProfile.getName());