android: Show an error if VPN fails due to lock down mode in Android 4.2

This commit is contained in:
Tobias Brunner 2012-11-15 18:52:18 +01:00
parent be2e7ecc2f
commit 2e50a8e751
4 changed files with 14 additions and 1 deletions

View File

@ -25,6 +25,7 @@
<string name="search">Suchen</string>
<string name="vpn_not_supported_title">VPN nicht unterstützt</string>
<string name="vpn_not_supported">Ihr Gerät unterstützt keine VPN Anwendungen.\nBitte kontaktieren Sie den Hersteller.</string>
<string name="vpn_not_supported_during_lockdown">VPN Verbindungen sind nicht möglich im abgeriegelten Modus.</string>
<string name="loading">Laden&#8230;</string>
<!-- Log view -->

View File

@ -27,6 +27,7 @@
<string name="search">Szukaj</string>
<string name="vpn_not_supported_title">Nie obsługiwany VPN</string>
<string name="vpn_not_supported">Urządzenie nie obsługuje aplikacji VPN.\nProszę skontaktować się z producentem.</string>
<string name="vpn_not_supported_during_lockdown">Polączenia nie sa możliwe w trybie zamkniętym</string>
<string name="loading">Wczytywanie&#8230;</string>
<!-- Log view -->

View File

@ -25,6 +25,7 @@
<string name="search">Search</string>
<string name="vpn_not_supported_title">VPN not supported</string>
<string name="vpn_not_supported">Your device does not support VPN applications.\nPlease contact the manufacturer.</string>
<string name="vpn_not_supported_during_lockdown">VPN connections are not supported in lockdown mode.</string>
<string name="loading">Loading&#8230;</string>
<!-- Log view -->

View File

@ -95,7 +95,17 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
*/
protected void prepareVpnService(Bundle profileInfo)
{
Intent intent = VpnService.prepare(this);
Intent intent;
try
{
intent = VpnService.prepare(this);
}
catch (IllegalStateException ex)
{
/* this happens if the always-on VPN feature (Android 4.2+) is activated */
VpnNotSupportedError.showWithMessage(this, R.string.vpn_not_supported_during_lockdown);
return;
}
/* store profile info until the user grants us permission */
mProfileInfo = profileInfo;
if (intent != null)