Merge change 6345 into donut

* changes:
  Add header 'blob://' in front of the cert/key names in wpa_supplicant.conf.
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 750b083..a470acc 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -88,10 +88,10 @@
     <!-- Do not translate. -->
     <string-array name="tts_rate_values">
         <item>60</item>
+        <item>80</item>
         <item>100</item>
-        <item>140</item>
-        <item>180</item>
-        <item>220</item>
+        <item>150</item>
+        <item>200</item>
     </string-array>
 
     <!-- Default pitch choices -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1022a2e..8af3c58 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1822,8 +1822,8 @@
     <!-- In VPN connect dialog, for inputing username and password -->
     <string name="vpn_username_colon">Username:</string>
     <string name="vpn_password_colon">Password:</string>
-    <string name="vpn_username">username</string>
-    <string name="vpn_password">password</string>
+    <string name="vpn_a_username">a username</string>
+    <string name="vpn_a_password">a password</string>
 
     <!-- In VPN connect dialog where user may check to remember the username entered -->
     <string name="vpn_save_username">Remember username</string>
@@ -1843,8 +1843,8 @@
     <string name="vpn_menu_delete">Delete network</string>
 
     <!-- VPN error dialog messages -->
-    <string name="vpn_error_miss_entering">You must enter a %s.</string>
-    <string name="vpn_error_miss_selecting">You must select a %s.</string>
+    <string name="vpn_error_miss_entering">You must enter %s.</string>
+    <string name="vpn_error_miss_selecting">You must select %s.</string>
     <string name="vpn_error_duplicate_name">The VPN name \'%s\' already exists. Find another name.</string>
     <string name="vpn_confirm_profile_deletion">Are you sure you want to delete this VPN?</string>
     <string name="vpn_confirm_add_profile_cancellation">Are you sure you don\'t want to create this profile?</string>
@@ -1874,6 +1874,7 @@
 
     <!-- Name of a VPN profile -->
     <string name="vpn_name">VPN name</string>
+    <string name="vpn_a_name">a VPN name</string>
 
     <!-- Toast message shown when a profile is added -->
     <string name="vpn_profile_added">&#39;%s&#39; is added</string>
@@ -1884,30 +1885,30 @@
     <string name="vpn_user_certificate_title">Set user certificate</string>
     <!-- Complete term -->
     <string name="vpn_user_certificate">User certificate</string>
+    <string name="vpn_a_user_certificate">a user certificate</string>
 
     <!-- Preference title -->
     <string name="vpn_ca_certificate_title">Set CA certificate</string>
     <!-- Complete term -->
     <string name="vpn_ca_certificate">Certificate authority (CA) certificate</string>
+    <string name="vpn_a_ca_certificate">a CA certificate</string>
     <!-- Preference title -->
     <string name="vpn_l2tp_secret_string_title">Set L2TP secret</string>
     <!-- Complete term -->
     <string name="vpn_l2tp_secret">L2TP secret</string>
+    <string name="vpn_a_l2tp_secret">an L2TP secret</string>
 
     <!-- Preference title -->
     <string name="vpn_ipsec_presharedkey_title">Set IPSec pre-shared key</string>
     <!-- Complete term -->
     <string name="vpn_ipsec_presharedkey">IPSec pre-shared key</string>
-
-    <!-- Preference title -->
-    <string name="vpn_psk_title">Set IPSec pre-shared key</string>
-    <!-- Complete term -->
-    <string name="vpn_psk">IPSec pre-shared key</string>
+    <string name="vpn_a_ipsec_presharedkey">an IPSec pre-shared key</string>
 
     <!-- Preference title -->
     <string name="vpn_vpn_server_title">Set VPN server</string>
     <!-- Complete term -->
     <string name="vpn_vpn_server">VPN server</string>
+    <string name="vpn_a_vpn_server">a VPN server</string>
     <!-- Dialog title for setting VPN server name -->
     <string name="vpn_vpn_server_dialog_title">VPN server name</string>
 
@@ -1947,7 +1948,7 @@
     <!-- Title of dialog to enable/dislable access to credential storage -->
     <string name="cstor_access_dialog_title">Enter password</string>
     <!-- Description of dialog to enable/dislable access to credential storage from an action that requires the credential storage -->
-    <string name="cstor_access_dialog_hint_from_action">This action requires enabling the credential storage. Please enter the password to enable it.</string>
+    <string name="cstor_access_dialog_hint_from_action">Enter the credential storage password.</string>
 
     <!-- Title of preference to set storage password -->
     <string name="cstor_set_passwd_title">Set password</string>
@@ -1978,9 +1979,9 @@
     <!-- Description for the confirm-new-password input box -->
     <string name="cstor_confirm_password">Confirm new password:</string>
     <!-- Description when user set up the storage for the very first time -->
-    <string name="cstor_first_time_hint">You must set a password for the credential storage.</string>
+    <string name="cstor_first_time_hint">Set a password for the credential storage.</string>
     <!-- Description when user set up the storage for the very first time from an action that requires the credential storage-->
-    <string name="cstor_first_time_hint_from_action">This action requires the credential storage but the storage has not been activated before. To activiate it, you must set a password for the credential storage.</string>
+    <string name="cstor_first_time_hint_from_action">Set a password for the credential storage.</string>
     <string name="cstor_password_error">Please enter the correct password.</string>
     <string name="cstor_password_error_reset_warning">Please enter the correct password. You have one more try to enter the correct password before the credential storage is erased.</string>
     <string name="cstor_password_error_reset_warning_plural">Please enter the correct password. You have %d more tries to enter the correct password before the credential storage is erased.</string>
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java
index ec0fc8c..11998a3 100644
--- a/src/com/android/settings/TextToSpeechSettings.java
+++ b/src/com/android/settings/TextToSpeechSettings.java
@@ -39,6 +39,7 @@
 import android.util.Log;
 
 import java.util.List;
+import java.util.Locale;
 import java.util.StringTokenizer;
 
 public class TextToSpeechSettings extends PreferenceActivity implements
@@ -95,14 +96,14 @@
         initClickers();
         initDefaultSettings();
     }
-    
-    
+
+
     @Override
     protected void onStart() {
         super.onStart();
         // whenever we return to this screen, we don't know the state of the
         // system, so we have to recheck that we can play the demo, or it must be disabled.
-        // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount 
+        // TODO make the TTS service listen to "changes in the system", i.e. sd card un/mount
         initClickers();
         updateWidgetState();
         checkVoiceData();
@@ -174,23 +175,21 @@
         String variant = null;
         mDefaultLocPref = (ListPreference) findPreference(KEY_TTS_DEFAULT_LANG);
         language = Settings.Secure.getString(resolver, TTS_DEFAULT_LANG);
-        if (language != null) {
-            mDefaultLanguage = language;
-        } else {
-            // default language setting not found, initialize it, as well as the country and variant
-            language = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG;
-            country  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
-            variant  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
+        if (language == null) {
+            // the default language property isn't set, use that of the current locale
+            Locale currentLocale = Locale.getDefault();
+            language = currentLocale.getISO3Language();
+            country = currentLocale.getISO3Country();
+            variant = currentLocale.getVariant();
             Settings.Secure.putString(resolver, TTS_DEFAULT_LANG, language);
             Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
             Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
         }
+        mDefaultLanguage = language;
         if (country == null) {
             // country wasn't initialized yet because a default language was found
             country = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_COUNTRY);
-            if (country != null) {
-                mDefaultCountry = country;
-            } else {
+            if (country == null) {
                 // default country setting not found, initialize it, as well as the variant;
                 country  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
                 variant  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
@@ -198,30 +197,19 @@
                 Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
             }
         }
+        mDefaultCountry = country;
         if (variant == null) {
             // variant wasn't initialized yet because a default country was found
             variant = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_VARIANT);
-            if (variant != null) {
-                mDefaultLocVariant = variant;
-            } else {
+            if (variant == null) {
                 // default variant setting not found, initialize it
                 variant = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
                 Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
             }
         }
-        // we now have the default lang/country/variant trio, build a string value from it
-        String localeString = new String(language);
-        if (country.compareTo("") != 0) {
-            localeString += LOCALE_DELIMITER + country;
-        } else {
-            localeString += LOCALE_DELIMITER + " ";
-        }
-        if (variant.compareTo("") != 0) {
-            localeString += LOCALE_DELIMITER + variant;
-        }
-        Log.v(TAG, "In initDefaultSettings: localeString=" + localeString);
-        // TODO handle the case where localeString isn't in the existing entries
-        mDefaultLocPref.setValue(localeString);
+        mDefaultLocVariant = variant;
+
+        setDefaultLocalePref(language, country, variant);
         mDefaultLocPref.setOnPreferenceChangeListener(this);
     }
 
@@ -311,10 +299,10 @@
             // Default rate
             int value = Integer.parseInt((String) objValue);
             try {
-                Settings.Secure.putInt(getContentResolver(), 
+                Settings.Secure.putInt(getContentResolver(),
                         TTS_DEFAULT_RATE, value);
                 if (mTts != null) {
-                    mTts.setSpeechRate(value);
+                    mTts.setSpeechRate((float)(value/100.0f));
                 }
                 Log.i(TAG, "TTS default rate is "+value);
             } catch (NumberFormatException e) {
@@ -330,10 +318,10 @@
             Log.v(TAG, "TTS default lang/country/variant set to "
                     + mDefaultLanguage + "/" + mDefaultCountry + "/" + mDefaultLocVariant);
         }
-        
+
         return true;
     }
-    
+
 
     /**
      * Called when mPlayExample or mInstallData is clicked
@@ -384,4 +372,25 @@
     }
 
 
+    private void setDefaultLocalePref(String language, String country, String variant) {
+        // build a string from the default lang/country/variant trio,
+        String localeString = new String(language);
+        if (country.compareTo("") != 0) {
+            localeString += LOCALE_DELIMITER + country;
+        } else {
+            localeString += LOCALE_DELIMITER + " ";
+        }
+        if (variant.compareTo("") != 0) {
+            localeString += LOCALE_DELIMITER + variant;
+        }
+
+        if (mDefaultLocPref.findIndexOfValue(localeString) > -1) {
+            mDefaultLocPref.setValue(localeString);
+        } else {
+            mDefaultLocPref.setValueIndex(0);
+        }
+
+        Log.v(TAG, "In initDefaultSettings: localeString=" + localeString);
+    }
+
 }
diff --git a/src/com/android/settings/vpn/AuthenticationActor.java b/src/com/android/settings/vpn/AuthenticationActor.java
index af9875c..286064f 100644
--- a/src/com/android/settings/vpn/AuthenticationActor.java
+++ b/src/com/android/settings/vpn/AuthenticationActor.java
@@ -70,9 +70,9 @@
         TextView passwordView = (TextView) d.findViewById(R.id.password_value);
         Context c = mContext;
         if (TextUtils.isEmpty(usernameView.getText().toString())) {
-            return c.getString(R.string.vpn_username);
+            return c.getString(R.string.vpn_a_username);
         } else if (TextUtils.isEmpty(passwordView.getText().toString())) {
-            return c.getString(R.string.vpn_password);
+            return c.getString(R.string.vpn_a_password);
         } else {
             return null;
         }
diff --git a/src/com/android/settings/vpn/L2tpEditor.java b/src/com/android/settings/vpn/L2tpEditor.java
index c518dec..643ba3b 100644
--- a/src/com/android/settings/vpn/L2tpEditor.java
+++ b/src/com/android/settings/vpn/L2tpEditor.java
@@ -57,7 +57,7 @@
 
         return ((result != null)
                 ? result
-                : validate(mSecretString, R.string.vpn_l2tp_secret));
+                : validate(mSecretString, R.string.vpn_a_l2tp_secret));
     }
 
     private Preference createSecretPreference(Context c) {
diff --git a/src/com/android/settings/vpn/L2tpIpsecEditor.java b/src/com/android/settings/vpn/L2tpIpsecEditor.java
index b6b244f..b14feb3 100644
--- a/src/com/android/settings/vpn/L2tpIpsecEditor.java
+++ b/src/com/android/settings/vpn/L2tpIpsecEditor.java
@@ -55,10 +55,10 @@
     public String validate() {
         String result = super.validate();
         if (result == null) {
-            result = validate(mUserCertificate, R.string.vpn_user_certificate);
+            result = validate(mUserCertificate, R.string.vpn_a_user_certificate);
         }
         if (result == null) {
-            result = validate(mCaCertificate, R.string.vpn_ca_certificate);
+            result = validate(mCaCertificate, R.string.vpn_a_ca_certificate);
         }
         return result;
     }
diff --git a/src/com/android/settings/vpn/L2tpIpsecPskEditor.java b/src/com/android/settings/vpn/L2tpIpsecPskEditor.java
index fb67c98..11590da 100644
--- a/src/com/android/settings/vpn/L2tpIpsecPskEditor.java
+++ b/src/com/android/settings/vpn/L2tpIpsecPskEditor.java
@@ -47,7 +47,7 @@
 
         return ((result != null)
                 ? result
-                : validate(mPresharedKey, R.string.vpn_ipsec_presharedkey));
+                : validate(mPresharedKey, R.string.vpn_a_ipsec_presharedkey));
     }
 
     private Preference createPresharedKeyPreference(Context c) {
diff --git a/src/com/android/settings/vpn/VpnProfileEditor.java b/src/com/android/settings/vpn/VpnProfileEditor.java
index a708a8c..a1cdc76 100644
--- a/src/com/android/settings/vpn/VpnProfileEditor.java
+++ b/src/com/android/settings/vpn/VpnProfileEditor.java
@@ -85,10 +85,10 @@
      *      null if all the inputs are valid
      */
     public String validate() {
-        String result = validate(mName, R.string.vpn_name);
+        String result = validate(mName, R.string.vpn_a_name);
         return ((result != null)
                 ? result
-                : validate(mServerName, R.string.vpn_vpn_server));
+                : validate(mServerName, R.string.vpn_a_vpn_server));
     }
 
     /**