diff --git a/res/values/strings.xml b/res/values/strings.xml
index 63b343d..5df6cf5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1457,7 +1457,7 @@
     <string name="quick_launch_no_shortcut">No shortcut</string>
     <!-- On the Quick launch settings screen, summary text under the item for each assigned letter.  -->
     <string name="quick_launch_shortcut">Search + <xliff:g id="shortcut_letter">%1$s</xliff:g></string>
-    <!-- On the Quick launch settings screen, title of "Clear shortcut" confirmation dialog. This is reached by longpressing an item for a shortcut letter.  This allows the user to clear the assigned applicatino for that shortcut letter. -->
+    <!-- On the Quick launch settings screen, title of "Clear shortcut" confirmation dialog. This is reached by longpressing an item for a shortcut letter.  This allows the user to clear the assigned application for that shortcut letter. -->
     <string name="quick_launch_clear_dialog_title">Clear</string>
     <!-- On the Quick launch settings screen, message in the "Clear shortcut" confirmation dialog.  See the title for this dialog for more info. -->
     <string name="quick_launch_clear_dialog_message">Your shortcut for <xliff:g id="shortcut_letter">%1$s</xliff:g> (<xliff:g id="application_name">%2$s</xliff:g>) will be cleared.</string>
@@ -1498,6 +1498,10 @@
     <string name="allow_mock_location">Allow mock locations</string>
     <!-- setting Checkbox summary whether to allow mock locations  -->
     <string name="allow_mock_location_summary">Allow mock locations</string>
+    <!-- Title of warning dialog about the implications of enabling USB debugging -->
+    <string name="adb_warning_title">Enable USB debugging?</string>
+    <!-- Warning text to user about the implications of enabling USB debugging -->
+    <string name="adb_warning_message">USB debugging is intended for development purposes only. It can be used to copy data between your computer and your device, install applications on your device without notification, and read log data.</string>
 
     <!-- Title for the screen that lets the user choose a gadget to add to the home screen
          (or other screens that can host gadgets).  Note to translators: we're still determining
diff --git a/res/xml/tts_settings.xml b/res/xml/tts_settings.xml
index 4ec2a4d..d94d575 100644
--- a/res/xml/tts_settings.xml
+++ b/res/xml/tts_settings.xml
@@ -45,14 +45,6 @@
                 android:persistent="false"
                 android:entries="@array/tts_rate_entries"
                 android:entryValues="@array/tts_rate_values" />
-
-            <ListPreference
-                android:key="tts_default_pitch"
-                android:title="@string/tts_default_pitch_title"
-                android:summary="@string/tts_default_pitch_summary"
-                android:persistent="false"
-                android:entries="@array/tts_pitch_entries"
-                android:entryValues="@array/tts_pitch_values" />
                 
             <ListPreference
                 android:key="tts_default_lang"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 155f085..c1da18a 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -16,6 +16,8 @@
 
 package com.android.settings;
 
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.os.BatteryManager;
 import android.os.Bundle;
 import android.os.SystemProperties;
@@ -29,7 +31,8 @@
 /*
  * Displays preferences for application developers.
  */
-public class DevelopmentSettings extends PreferenceActivity {
+public class DevelopmentSettings extends PreferenceActivity
+        implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
 
     private static final String ENABLE_ADB = "enable_adb";
     private static final String KEEP_SCREEN_ON = "keep_screen_on";
@@ -39,6 +42,9 @@
     private CheckBoxPreference mKeepScreenOn;
     private CheckBoxPreference mAllowMockLocation;
 
+    // To track whether Yes was clicked in the adb warning dialog
+    private boolean mOkClicked;
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -72,8 +78,19 @@
         }
 
         if (preference == mEnableAdb) {
-            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 
-                    mEnableAdb.isChecked() ? 1 : 0);
+            if (mEnableAdb.isChecked()) {
+                mOkClicked = false;
+                new AlertDialog.Builder(this).setMessage(
+                        getResources().getString(R.string.adb_warning_message))
+                        .setTitle(R.string.adb_warning_title)
+                        .setIcon(android.R.drawable.ic_dialog_alert)
+                        .setPositiveButton(android.R.string.yes, this)
+                        .setNegativeButton(android.R.string.no, this)
+                        .show()
+                        .setOnDismissListener(this);
+            } else {
+                Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
+            }
         } else if (preference == mKeepScreenOn) {
             Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, 
                     mKeepScreenOn.isChecked() ? 
@@ -85,4 +102,21 @@
         
         return false;
     }
+
+    public void onClick(DialogInterface dialog, int which) {
+        if (which == DialogInterface.BUTTON_POSITIVE) {
+            mOkClicked = true;
+            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1);
+        } else {
+            // Reset the toggle
+            mEnableAdb.setChecked(false);
+        }
+    }
+
+    public void onDismiss(DialogInterface dialog) {
+        // Assuming that onClick gets called first
+        if (!mOkClicked) {
+            mEnableAdb.setChecked(false);
+        }
+    }
 }
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java
index f77913f..94b256f 100644
--- a/src/com/android/settings/TextToSpeechSettings.java
+++ b/src/com/android/settings/TextToSpeechSettings.java
@@ -18,10 +18,10 @@
 
 import static android.provider.Settings.Secure.TTS_USE_DEFAULTS;
 import static android.provider.Settings.Secure.TTS_DEFAULT_RATE;
-import static android.provider.Settings.Secure.TTS_DEFAULT_PITCH;
 import static android.provider.Settings.Secure.TTS_DEFAULT_LANG;
 import static android.provider.Settings.Secure.TTS_DEFAULT_COUNTRY;
 import static android.provider.Settings.Secure.TTS_DEFAULT_VARIANT;
+import static android.provider.Settings.Secure.TTS_DEFAULT_SYNTH;
 
 import android.content.ContentResolver;
 import android.content.Intent;
@@ -51,7 +51,6 @@
     private static final String KEY_TTS_INSTALL_DATA = "tts_install_data";
     private static final String KEY_TTS_USE_DEFAULT = "toggle_use_default_tts_settings";
     private static final String KEY_TTS_DEFAULT_RATE = "tts_default_rate";
-    private static final String KEY_TTS_DEFAULT_PITCH = "tts_default_pitch";
     private static final String KEY_TTS_DEFAULT_LANG = "tts_default_lang";
     private static final String KEY_TTS_DEFAULT_COUNTRY = "tts_default_country";
     private static final String KEY_TTS_DEFAULT_VARIANT = "tts_default_variant";
@@ -65,7 +64,6 @@
     private Preference         mInstallData = null;
     private CheckBoxPreference mUseDefaultPref = null;
     private ListPreference     mDefaultRatePref = null;
-    private ListPreference     mDefaultPitchPref = null;
     private ListPreference     mDefaultLocPref = null;
     private String             mDefaultLanguage = null;
     private String             mDefaultCountry = null;
@@ -81,6 +79,11 @@
      * startActivityForResult.
      */
     private static final int VOICE_DATA_INTEGRITY_CHECK = 1977;
+    /**
+     * Request code (arbitrary value) for voice data installation through
+     * startActivityForResult.
+     */
+    private static final int VOICE_DATA_INSTALLATION = 1980;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -88,6 +91,7 @@
 
         addPreferencesFromResource(R.xml.tts_settings);
 
+        mEnableDemo = false;
         initClickers();
         initDefaultSettings();
     }
@@ -99,7 +103,6 @@
         // 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 
-        mEnableDemo = false;
         initClickers();
         updateWidgetState();
         checkVoiceData();
@@ -144,7 +147,13 @@
         mUseDefaultPref.setOnPreferenceChangeListener(this);
 
         // Default engine
-        mDefaultEng = FALLBACK_TTS_DEFAULT_SYNTH;
+        String engine = Settings.Secure.getString(resolver, TTS_DEFAULT_SYNTH);
+        if (engine == null) {
+            // TODO move FALLBACK_TTS_DEFAULT_SYNTH to TextToSpeech
+            engine = FALLBACK_TTS_DEFAULT_SYNTH;
+            Settings.Secure.putString(resolver, TTS_DEFAULT_SYNTH, engine);
+        }
+        mDefaultEng = engine;
 
         // Default rate
         mDefaultRatePref = (ListPreference) findPreference(KEY_TTS_DEFAULT_RATE);
@@ -158,26 +167,13 @@
         mDefaultRatePref.setValue(String.valueOf(intVal));
         mDefaultRatePref.setOnPreferenceChangeListener(this);
 
-        // Default pitch
-        mDefaultPitchPref = (ListPreference) findPreference(KEY_TTS_DEFAULT_PITCH);
-        try {
-            intVal = Settings.Secure.getInt(resolver, TTS_DEFAULT_PITCH);
-        } catch (SettingNotFoundException e) {
-            // default pitch setting not found, initialize it
-            intVal = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_PITCH;
-            Settings.Secure.putInt(resolver, TTS_DEFAULT_PITCH, intVal);
-        }
-        mDefaultPitchPref.setValue(String.valueOf(intVal));
-        mDefaultPitchPref.setOnPreferenceChangeListener(this);
-
-
         // Default language / country / variant : these three values map to a single ListPref
         // representing the matching Locale
         String language = null;
         String country = null;
         String variant = null;
         mDefaultLocPref = (ListPreference) findPreference(KEY_TTS_DEFAULT_LANG);
-        language = Settings.Secure.getString(resolver, KEY_TTS_DEFAULT_LANG);
+        language = Settings.Secure.getString(resolver, TTS_DEFAULT_LANG);
         if (language != null) {
             mDefaultLanguage = language;
         } else {
@@ -185,9 +181,9 @@
             language = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG;
             country  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
             variant  = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
-            Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_LANG, language);
-            Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_COUNTRY, country);
-            Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_VARIANT, variant);
+            Settings.Secure.putString(resolver, TTS_DEFAULT_LANG, language);
+            Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
+            Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
         }
         if (country == null) {
             // country wasn't initialized yet because a default language was found
@@ -198,8 +194,8 @@
                 // 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;
-                Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_COUNTRY, country);
-                Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_VARIANT, variant);
+                Settings.Secure.putString(resolver, TTS_DEFAULT_COUNTRY, country);
+                Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
             }
         }
         if (variant == null) {
@@ -210,7 +206,7 @@
             } else {
                 // default variant setting not found, initialize it
                 variant = TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
-                Settings.Secure.putString(resolver, KEY_TTS_DEFAULT_VARIANT, variant);
+                Settings.Secure.putString(resolver, TTS_DEFAULT_VARIANT, variant);
             }
         }
         // we now have the default lang/country/variant trio, build a string value from it
@@ -230,6 +226,10 @@
     }
 
 
+    /**
+     * Ask the current default engine to launch the matching CHECK_TTS_DATA activity
+     * to check the required TTS files are properly installed.
+     */
     private void checkVoiceData() {
         PackageManager pm = getPackageManager();
         Intent intent = new Intent();
@@ -247,6 +247,26 @@
 
 
     /**
+     * Ask the current default engine to launch the matching INSTALL_TTS_DATA activity
+     * so the required TTS files are properly installed.
+     */
+    private void installVoiceData() {
+        PackageManager pm = getPackageManager();
+        Intent intent = new Intent();
+        intent.setAction("android.intent.action.INSTALL_TTS_DATA");
+        List<ResolveInfo> resolveInfos = pm.queryIntentActivities(intent, 0);
+        // query only the package that matches that of the default engine
+        for (int i = 0; i < resolveInfos.size(); i++) {
+            ActivityInfo currentActivityInfo = resolveInfos.get(i).activityInfo;
+            if (mDefaultEng.equals(currentActivityInfo.packageName)) {
+                intent.setClassName(mDefaultEng, currentActivityInfo.name);
+                this.startActivityForResult(intent, VOICE_DATA_INSTALLATION);
+            }
+        }
+    }
+
+
+    /**
      * Called when the TTS engine is initialized.
      */
     public void onInit(int status) {
@@ -273,7 +293,8 @@
                 }
             } else {
                 Log.v(TAG, "Voice data check failed");
-
+                mEnableDemo = false;
+                updateWidgetState();
             }
         }
     }
@@ -299,16 +320,6 @@
             } catch (NumberFormatException e) {
                 Log.e(TAG, "could not persist default TTS rate setting", e);
             }
-        } else if (KEY_TTS_DEFAULT_PITCH.equals(preference.getKey())) {
-            // Default pitch
-            int value = Integer.parseInt((String) objValue);
-            try {
-                Settings.Secure.putInt(getContentResolver(), 
-                        TTS_DEFAULT_PITCH, value);
-                Log.i(TAG, "TTS default pitch is "+value);
-            } catch (NumberFormatException e) {
-                Log.e(TAG, "could not persist default TTS pitch setting", e);
-            }
         } else if (KEY_TTS_DEFAULT_LANG.equals(preference.getKey())) {
             // Default locale
             ContentResolver resolver = getContentResolver();
@@ -337,9 +348,9 @@
             return true;
         }
         if (preference == mInstallData) {
-            // Install data
-            // TODO launch request for installer
-
+            installVoiceData();
+            // quit this activity so it needs to be restarted after installation of the voice data
+            finish();
             return true;
         }
         return false;
@@ -350,7 +361,6 @@
         mPlayExample.setEnabled(mEnableDemo);
         mUseDefaultPref.setEnabled(mEnableDemo);
         mDefaultRatePref.setEnabled(mEnableDemo);
-        mDefaultPitchPref.setEnabled(mEnableDemo);
         mDefaultLocPref.setEnabled(mEnableDemo);
 
         mInstallData.setEnabled(!mEnableDemo);
