From: Chia-chi Yeh Date: Thu, 1 Mar 2012 00:12:35 +0000 (-0800) Subject: VpnSettings: show more error messages when VPN fails. X-Git-Tag: android-x86-4.4-r1~1724 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=94cc1bbf3218a020548a90032ec34f608f4cefdb;p=android-x86%2Fpackages-apps-Settings.git VpnSettings: show more error messages when VPN fails. Bug: 6032883 Change-Id: Idc49e1b611fd0c01f199bfde984084a8e4c62e17 --- diff --git a/res/values/strings.xml b/res/values/strings.xml index 170e84e63c..5a43f4d188 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3744,6 +3744,11 @@ Delete profile + + There is no network connection. Please try again later. + + A certificate is missing. Please edit the profile. + System diff --git a/src/com/android/settings/vpn2/VpnSettings.java b/src/com/android/settings/vpn2/VpnSettings.java index 655306aac4..975f807109 100644 --- a/src/com/android/settings/vpn2/VpnSettings.java +++ b/src/com/android/settings/vpn2/VpnSettings.java @@ -38,6 +38,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView.AdapterContextMenuInfo; +import android.widget.Toast; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; @@ -324,10 +325,12 @@ public class VpnSettings extends SettingsPreferenceFragment implements private String[] getDefaultNetwork() throws Exception { LinkProperties network = mService.getActiveLinkProperties(); if (network == null) { + Toast.makeText(getActivity(), R.string.vpn_no_network, Toast.LENGTH_LONG).show(); throw new IllegalStateException("Network is not available"); } String interfaze = network.getInterfaceName(); if (interfaze == null) { + Toast.makeText(getActivity(), R.string.vpn_no_network, Toast.LENGTH_LONG).show(); throw new IllegalStateException("Cannot get the default interface"); } String gateway = null; @@ -339,6 +342,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements } } if (gateway == null) { + Toast.makeText(getActivity(), R.string.vpn_no_network, Toast.LENGTH_LONG).show(); throw new IllegalStateException("Cannot get the default gateway"); } return new String[] {interfaze, gateway}; @@ -370,7 +374,7 @@ public class VpnSettings extends SettingsPreferenceFragment implements serverCert = (value == null) ? null : new String(value, Charsets.UTF_8); } if (privateKey == null || userCert == null || caCert == null || serverCert == null) { - // TODO: find out a proper way to handle this. Delete these keys? + Toast.makeText(getActivity(), R.string.vpn_missing_cert, Toast.LENGTH_LONG).show(); throw new IllegalStateException("Cannot load credentials"); }