From 2fa9eade41144094ef743cc5a3faf4f1ce7209af Mon Sep 17 00:00:00 2001 From: Chia-chi Yeh Date: Thu, 30 Jun 2011 23:34:53 -0700 Subject: [PATCH] VpnSettings: rename some fields. Change-Id: I999b773192d167f21c4a684c1864c37b9a433390 --- res/layout/vpn_dialog.xml | 4 +- res/values/strings.xml | 4 +- src/com/android/settings/vpn2/VpnDialog.java | 8 ++-- src/com/android/settings/vpn2/VpnProfile.java | 41 ++++++++++--------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/res/layout/vpn_dialog.xml b/res/layout/vpn_dialog.xml index 3e4b4413048..a4bb2163c0e 100644 --- a/res/layout/vpn_dialog.xml +++ b/res/layout/vpn_dialog.xml @@ -93,8 +93,8 @@ android:prompt="@string/vpn_ipsec_ca_cert" /> - - + diff --git a/res/values/strings.xml b/res/values/strings.xml index 93a7720d861..7a6d5aef4b1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3509,7 +3509,7 @@ found in the list of installed applications. IPSec CA certificate - DNS search domains + DNS search domains Forwarding routes @@ -3517,7 +3517,7 @@ found in the list of installed applications. Password - Save this information + Save account information (not used) diff --git a/src/com/android/settings/vpn2/VpnDialog.java b/src/com/android/settings/vpn2/VpnDialog.java index 92ad3629b32..2914b1be283 100644 --- a/src/com/android/settings/vpn2/VpnDialog.java +++ b/src/com/android/settings/vpn2/VpnDialog.java @@ -60,7 +60,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen private TextView mServer; private TextView mUsername; private TextView mPassword; - private TextView mDomains; + private TextView mSearchDomains; private TextView mRoutes; private CheckBox mMppe; private TextView mL2tpSecret; @@ -92,7 +92,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen mServer = (TextView) mView.findViewById(R.id.server); mUsername = (TextView) mView.findViewById(R.id.username); mPassword = (TextView) mView.findViewById(R.id.password); - mDomains = (TextView) mView.findViewById(R.id.domains); + mSearchDomains = (TextView) mView.findViewById(R.id.search_domains); mRoutes = (TextView) mView.findViewById(R.id.routes); mMppe = (CheckBox) mView.findViewById(R.id.mppe); mL2tpSecret = (TextView) mView.findViewById(R.id.l2tp_secret); @@ -108,7 +108,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen mServer.setText(mProfile.server); mUsername.setText(mProfile.username); mPassword.setText(getDummy(mProfile.password)); - mDomains.setText(mProfile.domains); + mSearchDomains.setText(mProfile.searchDomains); mRoutes.setText(mProfile.routes); mMppe.setChecked(mProfile.mppe); mL2tpSecret.setText(getDummy(mProfile.l2tpSecret)); @@ -288,7 +288,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen profile.server = mServer.getText().toString().trim(); profile.username = mUsername.getText().toString(); profile.password = getSecret(mProfile.password, mPassword); - profile.domains = mDomains.getText().toString().trim(); + profile.searchDomains = mSearchDomains.getText().toString().trim(); profile.routes = mRoutes.getText().toString().trim(); // Then, save type-specific fields. diff --git a/src/com/android/settings/vpn2/VpnProfile.java b/src/com/android/settings/vpn2/VpnProfile.java index 9e4c5284947..24c2f5fad4a 100644 --- a/src/com/android/settings/vpn2/VpnProfile.java +++ b/src/com/android/settings/vpn2/VpnProfile.java @@ -42,14 +42,15 @@ class VpnProfile implements Cloneable { String server = ""; // 2 String username = ""; // 3 String password = ""; // 4 - String domains = ""; // 5 - String routes = ""; // 6 - boolean mppe = false; // 7 - String l2tpSecret = ""; // 8 - String ipsecIdentifier = "";// 9 - String ipsecSecret = ""; // 10 - String ipsecUserCert = ""; // 11 - String ipsecCaCert = ""; // 12 + String dnsServers = ""; // 5 + String searchDomains = ""; // 6 + String routes = ""; // 7 + boolean mppe = false; // 8 + String l2tpSecret = ""; // 9 + String ipsecIdentifier = "";// 10 + String ipsecSecret = ""; // 11 + String ipsecUserCert = ""; // 12 + String ipsecCaCert = ""; // 13 // Helper fields. boolean saveLogin = false; @@ -65,8 +66,8 @@ class VpnProfile implements Cloneable { } String[] values = new String(value, Charsets.UTF_8).split("\0", -1); - // Currently it always has 13 fields. - if (values.length < 13) { + // Currently it always has 14 fields. + if (values.length < 14) { return null; } @@ -79,14 +80,15 @@ class VpnProfile implements Cloneable { profile.server = values[2]; profile.username = values[3]; profile.password = values[4]; - profile.domains = values[5]; - profile.routes = values[6]; - profile.mppe = Boolean.valueOf(values[7]); - profile.l2tpSecret = values[8]; - profile.ipsecIdentifier = values[9]; - profile.ipsecSecret = values[10]; - profile.ipsecUserCert = values[11]; - profile.ipsecCaCert = values[12]; + profile.dnsServers = values[5]; + profile.searchDomains = values[6]; + profile.routes = values[7]; + profile.mppe = Boolean.valueOf(values[8]); + profile.l2tpSecret = values[9]; + profile.ipsecIdentifier = values[10]; + profile.ipsecSecret = values[11]; + profile.ipsecUserCert = values[12]; + profile.ipsecCaCert = values[13]; profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty(); return profile; @@ -102,7 +104,8 @@ class VpnProfile implements Cloneable { builder.append('\0').append(server); builder.append('\0').append(saveLogin ? username : ""); builder.append('\0').append(saveLogin ? password : ""); - builder.append('\0').append(domains); + builder.append('\0').append(dnsServers); + builder.append('\0').append(searchDomains); builder.append('\0').append(routes); builder.append('\0').append(mppe); builder.append('\0').append(l2tpSecret);