Merge change 24555 into eclair

* changes:
  Allow setting a silent ringtone (bug 1600056).
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9043dba..847e879 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -513,9 +513,9 @@
     <!-- Title for the bluetooth device info screen. -->
     <string name="bluetooth_device_info">Bluetooth device info</string>
     <!-- Message when bluetooth dialog for pin entry is showing -->
-    <string name="bluetooth_enter_pin_msg"><xliff:g id="device_name">%1$s</xliff:g>\nType PIN to pair.\n(Try 0000 or 1234.)</string>
+    <string name="bluetooth_enter_pin_msg">\nType PIN to pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022. (Try 0000 or 1234.)</string>
     <!-- Message when bluetooth dialog for passkey entry is showing -->
-    <string name="bluetooth_enter_passkey_msg"><xliff:g id="device_name">%1$s</xliff:g>\nType passkey to pair.\n</string>
+    <string name="bluetooth_enter_passkey_msg">\nType passkey to pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022.</string>
     <!-- Message when bluetooth dialog for confirmation of passkey is showing -->
     <string name="bluetooth_confirm_passkey_msg">To pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022, confirm that it is showing the passkey: <xliff:g id="passkey">%2$s</xliff:g>.</string>
     <!-- Button text for accepting an incoming pairing request -->
@@ -2012,6 +2012,10 @@
     <!-- 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">Enter the credential storage password.</string>
 
+    <!-- Title of preference to install p12 cert from SD card -->
+    <string name="cstor_cert_install_title">Install from SD card</string>
+    <!-- Summary of preference to install p12 cert from SD card -->
+    <string name="cstor_cert_install_summary">Install encrypted certificates from SD card</string>
     <!-- Title of preference to set storage password -->
     <string name="cstor_set_passwd_title">Set password</string>
     <!-- Summary of preference to set storage password -->
@@ -2052,7 +2056,7 @@
     <string name="cstor_passwords_error">Passwords do not match.</string>
     <string name="cstor_passwords_empty_error">You must enter and confirm a password.</string>
     <string name="cstor_password_empty_error">Please enter the password.</string>
-    <string name="cstor_password_verification_error">Please enter the password again. The password must have at least 8 characters and must not contain spaces.</string>
+    <string name="cstor_password_verification_error">Please enter the password again. The password must have at least 8 characters.</string>
     <string name="cstor_name_empty_error">Please enter a name.</string>
     <string name="cstor_name_char_error">Please enter a name that contains only letters and numbers.</string>
     <string name="cstor_storage_error">Unable to save the certificate. Click OK to retry.</string>
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 677432c..f3c53ce 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -87,10 +87,6 @@
     private static final String ASSISTED_GPS = "assisted_gps";
 
     // Credential storage
-    public static final String ACTION_ADD_CREDENTIAL =
-            "android.security.ADD_CREDENTIAL";
-    public static final String ACTION_UNLOCK_CREDENTIAL_STORAGE =
-            "android.security.UNLOCK_CREDENTIAL_STORAGE";
     private static final String KEY_CSTOR_TYPE_NAME = "typeName";
     private static final String KEY_CSTOR_ITEM = "item";
     private static final String KEY_CSTOR_NAMESPACE = "namespace";
@@ -240,10 +236,10 @@
         PreferenceCategory credStoreCat = new PreferenceCategory(this);
         credStoreCat.setTitle(R.string.cstor_settings_category);
         root.addPreference(credStoreCat);
-        int s = mCstorHelper.getCstorState();
-        credStoreCat.addPreference(mCstorHelper.createAccessCheckBox(s));
+        credStoreCat.addPreference(mCstorHelper.createAccessCheckBox());
+        credStoreCat.addPreference(mCstorHelper.createCertInstallPreference());
         credStoreCat.addPreference(mCstorHelper.createSetPasswordPreference());
-        credStoreCat.addPreference(mCstorHelper.createResetPreference(s));
+        credStoreCat.addPreference(mCstorHelper.createResetPreference());
 
         return root;
     }
@@ -269,6 +265,8 @@
         mShowPassword
                 .setChecked(Settings.System.getInt(getContentResolver(),
                 Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
+
+        mCstorHelper.resumeStates();
     }
 
     @Override
@@ -504,10 +502,12 @@
             if (intent == null) return;
             String action = intent.getAction();
 
-            if (ACTION_ADD_CREDENTIAL.equals(action)) {
-                mCstorAddCredentialHelper = new CstorAddCredentialHelper(intent);
+            if (CertTool.ACTION_ADD_CREDENTIAL.equals(action)) {
+                mCstorAddCredentialHelper =
+                        new CstorAddCredentialHelper(intent);
                 showCstorDialog(CSTOR_NAME_CREDENTIAL_DIALOG);
-            } else if (ACTION_UNLOCK_CREDENTIAL_STORAGE.equals(action)) {
+            } else if (Keystore.ACTION_UNLOCK_CREDENTIAL_STORAGE.equals(
+                    action)) {
                 mSpecialIntent = intent;
                 showCstorDialog(mCstorHelper.isCstorInitialized()
                         ? CSTOR_UNLOCK_DIALOG
@@ -515,6 +515,13 @@
             }
         }
 
+        void resumeStates() {
+            int state = mCstorHelper.getCstorState();
+            mAccessCheckBox.setEnabled(state != Keystore.UNINITIALIZED);
+            mAccessCheckBox.setChecked(state == Keystore.UNLOCKED);
+            mResetButton.setEnabled(state != Keystore.UNINITIALIZED);
+        }
+
         private void showCstorDialog(int dialogId) {
             mDialogId = dialogId;
             showDialog(dialogId);
@@ -732,8 +739,7 @@
             if (passwd == null) {
                 showError(R.string.cstor_passwords_empty_error);
                 return false;
-            } else if ((passwd.length() < CSTOR_MIN_PASSWORD_LENGTH)
-                    || passwd.contains(" ")) {
+            } else if (passwd.length() < CSTOR_MIN_PASSWORD_LENGTH) {
                 showError(R.string.cstor_password_verification_error);
                 return false;
             } else {
@@ -803,6 +809,11 @@
             }
         }
 
+        private void installCertFromSdCard() {
+            // TODO: uncomment this when the feature is ready
+            //startActivity(new Intent(CertTool.ACTION_INSTALL_CERT_FROM_SDCARD));
+        }
+
         private TextView showError(int messageId) {
             TextView v = (TextView) mView.findViewById(R.id.cstor_error);
             v.setText(messageId);
@@ -838,13 +849,11 @@
             mResetButton.setEnabled(enabled);
         }
 
-        private Preference createAccessCheckBox(int state) {
+        private Preference createAccessCheckBox() {
             CheckBoxPreference pref = new CheckBoxPreference(
                     SecuritySettings.this);
             pref.setTitle(R.string.cstor_access_title);
             pref.setSummary(R.string.cstor_access_summary);
-            pref.setEnabled(state != Keystore.UNINITIALIZED);
-            pref.setChecked(state == Keystore.UNLOCKED);
             pref.setOnPreferenceChangeListener(
                     new Preference.OnPreferenceChangeListener() {
                         public boolean onPreferenceChange(
@@ -861,6 +870,20 @@
             return pref;
         }
 
+        private Preference createCertInstallPreference() {
+            Preference pref = new Preference(SecuritySettings.this);
+            pref.setTitle(R.string.cstor_cert_install_title);
+            pref.setSummary(R.string.cstor_cert_install_summary);
+            pref.setOnPreferenceClickListener(
+                    new Preference.OnPreferenceClickListener() {
+                        public boolean onPreferenceClick(Preference pref) {
+                            installCertFromSdCard();
+                            return true;
+                        }
+                    });
+            return pref;
+        }
+
         private Preference createSetPasswordPreference() {
             Preference pref = new Preference(SecuritySettings.this);
             pref.setTitle(R.string.cstor_set_passwd_title);
@@ -877,7 +900,7 @@
             return pref;
         }
 
-        private Preference createResetPreference(int state) {
+        private Preference createResetPreference() {
             Preference pref = new Preference(SecuritySettings.this);
             pref.setTitle(R.string.cstor_reset_title);
             pref.setSummary(R.string.cstor_reset_summary);
@@ -888,7 +911,6 @@
                             return true;
                         }
                     });
-            pref.setEnabled(state != Keystore.UNINITIALIZED);
             mResetButton = pref;
             return pref;
         }
diff --git a/src/com/android/settings/SoundAndDisplaySettings.java b/src/com/android/settings/SoundAndDisplaySettings.java
index 5f4f358..75090ee 100644
--- a/src/com/android/settings/SoundAndDisplaySettings.java
+++ b/src/com/android/settings/SoundAndDisplaySettings.java
@@ -221,8 +221,8 @@
         CharSequence[] summaries = getResources().getTextArray(R.array.animations_summaries);
         CharSequence[] values = mAnimations.getEntryValues();
         for (int i=0; i<values.length; i++) {
-            Log.i("foo", "Comparing entry "+ values[i] + " to current "
-                    + mAnimations.getValue());
+            //Log.i("foo", "Comparing entry "+ values[i] + " to current "
+            //        + mAnimations.getValue());
             if (values[i].equals(value)) {
                 mAnimations.setSummary(summaries[i]);
                 break;
diff --git a/src/com/android/settings/TextToSpeechSettings.java b/src/com/android/settings/TextToSpeechSettings.java
index d4ffe65..f60d0f2 100644
--- a/src/com/android/settings/TextToSpeechSettings.java
+++ b/src/com/android/settings/TextToSpeechSettings.java
@@ -90,11 +90,6 @@
      * 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) {
@@ -218,13 +213,14 @@
         PackageManager pm = getPackageManager();
         Intent intent = new Intent();
         intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         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);
+                this.startActivity(intent);
             }
         }
     }
diff --git a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
index 17e5105..98d387c 100644
--- a/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothDiscoverableEnabler.java
@@ -19,7 +19,6 @@
 import com.android.settings.R;
 
 import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothIntent;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -55,9 +54,10 @@
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            if (BluetoothIntent.SCAN_MODE_CHANGED_ACTION.equals(intent.getAction())) {
-                int mode = intent.getIntExtra(BluetoothIntent.SCAN_MODE, BluetoothError.ERROR);
-                if (mode != BluetoothError.ERROR) {
+            if (BluetoothAdapter.ACTION_SCAN_MODE_CHANGED.equals(intent.getAction())) {
+                int mode = intent.getIntExtra(BluetoothAdapter.EXTRA_SCAN_MODE,
+                        BluetoothAdapter.ERROR);
+                if (mode != BluetoothAdapter.ERROR) {
                     handleModeChanged(mode);
                 }
             }
@@ -89,7 +89,7 @@
             return;
         }
 
-        IntentFilter filter = new IntentFilter(BluetoothIntent.SCAN_MODE_CHANGED_ACTION);
+        IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
         mContext.registerReceiver(mReceiver, filter);
         mCheckBoxPreference.setOnPreferenceChangeListener(this);
 
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 2808ce3..c1b6de3 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -19,7 +19,6 @@
 import com.android.settings.R;
 
 import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothIntent;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -49,8 +48,7 @@
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
-                    BluetoothError.ERROR);
+            int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
             handleStateChanged(state);
         }
     };
@@ -76,13 +74,13 @@
         
         int state = mLocalManager.getBluetoothState();
         // This is the widget enabled state, not the preference toggled state
-        mCheckBoxPreference.setEnabled(state == BluetoothAdapter.BLUETOOTH_STATE_ON ||
-                state == BluetoothAdapter.BLUETOOTH_STATE_OFF);
+        mCheckBoxPreference.setEnabled(state == BluetoothAdapter.STATE_ON ||
+                state == BluetoothAdapter.STATE_OFF);
         // BT state is not a sticky broadcast, so set it manually
         handleStateChanged(state);
         
         mContext.registerReceiver(mReceiver, 
-                new IntentFilter(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION));
+                new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED));
         mCheckBoxPreference.setOnPreferenceChangeListener(this);
     }
     
@@ -112,18 +110,18 @@
     
     private void handleStateChanged(int state) {
 
-        if (state == BluetoothAdapter.BLUETOOTH_STATE_OFF ||
-                state == BluetoothAdapter.BLUETOOTH_STATE_ON) {
-            mCheckBoxPreference.setChecked(state == BluetoothAdapter.BLUETOOTH_STATE_ON);
-            mCheckBoxPreference.setSummary(state == BluetoothAdapter.BLUETOOTH_STATE_OFF ?
+        if (state == BluetoothAdapter.STATE_OFF ||
+                state == BluetoothAdapter.STATE_ON) {
+            mCheckBoxPreference.setChecked(state == BluetoothAdapter.STATE_ON);
+            mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_OFF ?
                                            mOriginalSummary :
                                            null);
             
             mCheckBoxPreference.setEnabled(isEnabledByDependency());
             
-        } else if (state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON ||
-                state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_OFF) {
-            mCheckBoxPreference.setSummary(state == BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON
+        } else if (state == BluetoothAdapter.STATE_TURNING_ON ||
+                state == BluetoothAdapter.STATE_TURNING_OFF) {
+            mCheckBoxPreference.setSummary(state == BluetoothAdapter.STATE_TURNING_ON
                     ? R.string.wifi_starting
                     : R.string.wifi_stopping);
             
diff --git a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
index fdc217a..6459950 100644
--- a/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
+++ b/src/com/android/settings/bluetooth/BluetoothEventRedirector.java
@@ -17,9 +17,9 @@
 package com.android.settings.bluetooth;
 
 import android.bluetooth.BluetoothA2dp;
+import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothClass;
 import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothHeadset;
 import android.bluetooth.BluetoothIntent;
 import android.content.BroadcastReceiver;
@@ -51,9 +51,9 @@
             String action = intent.getAction();
             BluetoothDevice device = intent.getParcelableExtra(BluetoothIntent.DEVICE);
 
-            if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
-                int state = intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
-                                        BluetoothError.ERROR);
+            if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
+                int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE,
+                                        BluetoothAdapter.ERROR);
                 mManager.setBluetoothStateInt(state);
             } else if (action.equals(BluetoothIntent.DISCOVERY_STARTED_ACTION)) {
                 mManager.onScanningStateChanged(true);
@@ -75,10 +75,10 @@
 
             } else if (action.equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)) {
                 int bondState = intent.getIntExtra(BluetoothIntent.BOND_STATE,
-                                                   BluetoothError.ERROR);
+                                                   BluetoothDevice.ERROR);
                 mManager.getCachedDeviceManager().onBondingStateChanged(device, bondState);
                 if (bondState == BluetoothDevice.BOND_NOT_BONDED) {
-                    int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR);
+                    int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothDevice.ERROR);
                     if (reason == BluetoothDevice.UNBOND_REASON_AUTH_REJECTED ||
                             reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED ||
                             reason == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN) {
@@ -123,7 +123,7 @@
         IntentFilter filter = new IntentFilter();
 
         // Bluetooth on/off broadcasts
-        filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
 
         // Discovery broadcasts
         filter.addAction(BluetoothIntent.DISCOVERY_STARTED_ACTION);
diff --git a/src/com/android/settings/bluetooth/BluetoothNamePreference.java b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
index 1e79704..4a2358f 100644
--- a/src/com/android/settings/bluetooth/BluetoothNamePreference.java
+++ b/src/com/android/settings/bluetooth/BluetoothNamePreference.java
@@ -20,7 +20,6 @@
 import android.app.Dialog;
 
 import android.bluetooth.BluetoothAdapter;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothIntent;
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -49,9 +48,9 @@
             String action = intent.getAction();
             if (action.equals(BluetoothIntent.NAME_CHANGED_ACTION)) {
                 setSummaryToName();
-            } else if (action.equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION) &&
-                    (intent.getIntExtra(BluetoothIntent.BLUETOOTH_STATE,
-                    BluetoothError.ERROR) == BluetoothAdapter.BLUETOOTH_STATE_ON)) {
+            } else if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) &&
+                    (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR) ==
+                            BluetoothAdapter.STATE_ON)) {
                 setSummaryToName();
             }
         }
@@ -67,7 +66,7 @@
 
     public void resume() {
         IntentFilter filter = new IntentFilter();
-        filter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+        filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
         filter.addAction(BluetoothIntent.NAME_CHANGED_ACTION);
         getContext().registerReceiver(mReceiver, filter);
 
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index ac5dfba..091ad27 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -223,7 +223,7 @@
             }
             mDevice.setPin(pinBytes);
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY) {
-            int passkey = Integer.getInteger(value);
+            int passkey = Integer.parseInt(value);
             mDevice.setPasskey(passkey);
         } else {
             mDevice.setPairingConfirmation(true);
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 0525ec7..0d2ebd7 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -26,7 +26,6 @@
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothIntent;
-import android.bluetooth.BluetoothError;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -87,12 +86,12 @@
         public void onReceive(Context context, Intent intent) {
             // TODO: put this in callback instead of receiving
 
-            if (intent.getAction().equals(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION)) {
+            if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
                 onBluetoothStateChanged(mLocalManager.getBluetoothState());
             } else if (intent.getAction().equals(BluetoothIntent.BOND_STATE_CHANGED_ACTION)
                     && mScreenType == SCREEN_TYPE_DEVICEPICKER) {
                 int bondState = intent
-                        .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothError.ERROR);
+                        .getIntExtra(BluetoothIntent.BOND_STATE, BluetoothDevice.ERROR);
                 if (bondState == BluetoothDevice.BOND_BONDED) {
                     BluetoothDevice device = intent.getParcelableExtra(BluetoothIntent.DEVICE);
                     sendDevicePickedIntent(device);
@@ -175,7 +174,7 @@
         mLocalManager.startScanning(false);
 
         IntentFilter intentFilter = new IntentFilter();
-        intentFilter.addAction(BluetoothIntent.BLUETOOTH_STATE_CHANGED_ACTION);
+        intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
         intentFilter.addAction(BluetoothIntent.BOND_STATE_CHANGED_ACTION);
         registerReceiver(mReceiver, intentFilter);
         mLocalManager.setForegroundActivity(this);
@@ -339,9 +338,9 @@
     private void onBluetoothStateChanged(int bluetoothState) {
         // When bluetooth is enabled (and we are in the activity, which we are),
         // we should start a scan
-        if (bluetoothState == BluetoothAdapter.BLUETOOTH_STATE_ON) {
+        if (bluetoothState == BluetoothAdapter.STATE_ON) {
             mLocalManager.startScanning(false);
-        } else if (bluetoothState == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+        } else if (bluetoothState == BluetoothAdapter.STATE_OFF) {
             mDeviceList.setProgress(false);
         }
     }
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index d13f77c..9ee2f36 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -321,8 +321,7 @@
                 LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
         int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
         if (SettingsBtStatus.isConnectionStatusConnected(status)) {
-            if (profileManager.disconnect(cachedDevice.mDevice) ==
-                        BluetoothAdapter.RESULT_SUCCESS) {
+            if (profileManager.disconnect(cachedDevice.mDevice)) {
                 return true;
             }
         }
@@ -407,7 +406,7 @@
                 LocalBluetoothProfileManager.getProfileManager(mLocalManager, profile);
         int status = profileManager.getConnectionStatus(cachedDevice.mDevice);
         if (!SettingsBtStatus.isConnectionStatusConnected(status)) {
-            if (profileManager.connect(cachedDevice.mDevice) == BluetoothAdapter.RESULT_SUCCESS) {
+            if (profileManager.connect(cachedDevice.mDevice)) {
                 return true;
             }
             Log.i(TAG, "Failed to connect " + profile.toString() + " to " + cachedDevice.mName);
@@ -690,7 +689,7 @@
 
     public void onCreateContextMenu(ContextMenu menu) {
         // No context menu if it is busy (none of these items are applicable if busy)
-        if (mLocalManager.getBluetoothState() != BluetoothAdapter.BLUETOOTH_STATE_ON || isBusy()) {
+        if (mLocalManager.getBluetoothState() != BluetoothAdapter.STATE_ON || isBusy()) {
             return;
         }
 
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
index d4b55c1..a5a0140 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java
@@ -27,7 +27,6 @@
 import android.bluetooth.BluetoothA2dp;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothIntent;
 import android.content.Context;
 import android.content.Intent;
@@ -64,7 +63,7 @@
     private BluetoothEventRedirector mEventRedirector;
     private BluetoothA2dp mBluetoothA2dp;
 
-    private int mState = BluetoothError.ERROR;
+    private int mState = BluetoothAdapter.ERROR;
 
     private List<Callback> mCallbacks = new ArrayList<Callback>();
 
@@ -187,7 +186,7 @@
 
     public int getBluetoothState() {
 
-        if (mState == BluetoothError.ERROR) {
+        if (mState == BluetoothAdapter.ERROR) {
             syncBluetoothState();
         }
 
@@ -196,10 +195,10 @@
 
     void setBluetoothStateInt(int state) {
         mState = state;
-        if (state == BluetoothAdapter.BLUETOOTH_STATE_ON ||
-            state == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+        if (state == BluetoothAdapter.STATE_ON ||
+            state == BluetoothAdapter.STATE_OFF) {
             mCachedDeviceManager.onBluetoothStateChanged(state ==
-                    BluetoothAdapter.BLUETOOTH_STATE_ON);
+                    BluetoothAdapter.STATE_ON);
         }
     }
 
@@ -208,10 +207,10 @@
 
         if (mAdapter != null) {
             bluetoothState = mAdapter.isEnabled()
-                    ? BluetoothAdapter.BLUETOOTH_STATE_ON
-                    : BluetoothAdapter.BLUETOOTH_STATE_OFF;
+                    ? BluetoothAdapter.STATE_ON
+                    : BluetoothAdapter.STATE_OFF;
         } else {
-            bluetoothState = BluetoothError.ERROR;
+            bluetoothState = BluetoothAdapter.ERROR;
         }
 
         setBluetoothStateInt(bluetoothState);
@@ -224,8 +223,8 @@
 
         if (wasSetStateSuccessful) {
             setBluetoothStateInt(enabled
-                ? BluetoothAdapter.BLUETOOTH_STATE_TURNING_ON
-                : BluetoothAdapter.BLUETOOTH_STATE_TURNING_OFF);
+                ? BluetoothAdapter.STATE_TURNING_ON
+                : BluetoothAdapter.STATE_TURNING_OFF);
         } else {
             if (V) {
                 Log.v(TAG,
diff --git a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
index 2a52a8b..6f343c1 100644
--- a/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothProfileManager.java
@@ -19,7 +19,6 @@
 import android.bluetooth.BluetoothA2dp;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothClass;
-import android.bluetooth.BluetoothError;
 import android.bluetooth.BluetoothHeadset;
 import android.os.Handler;
 import android.text.TextUtils;
@@ -102,9 +101,9 @@
         mLocalManager = localManager;
     }
     
-    public abstract int connect(BluetoothDevice device);
+    public abstract boolean connect(BluetoothDevice device);
     
-    public abstract int disconnect(BluetoothDevice device);
+    public abstract boolean disconnect(BluetoothDevice device);
     
     public abstract int getConnectionStatus(BluetoothDevice device);
 
@@ -145,7 +144,7 @@
         }
 
         @Override
-        public int connect(BluetoothDevice device) {
+        public boolean connect(BluetoothDevice device) {
             Set<BluetoothDevice> sinks = mService.getConnectedSinks();
             if (sinks != null) {
                 for (BluetoothDevice sink : sinks) {
@@ -156,7 +155,7 @@
         }
 
         @Override
-        public int disconnect(BluetoothDevice device) {
+        public boolean disconnect(BluetoothDevice device) {
             return mService.disconnectSink(device);
         }
         
@@ -240,20 +239,19 @@
         }
 
         @Override
-        public int connect(BluetoothDevice device) {
+        public boolean connect(BluetoothDevice device) {
             // Since connectHeadset fails if already connected to a headset, we
             // disconnect from any headset first
             mService.disconnectHeadset();
-            return mService.connectHeadset(device)
-                    ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+            return mService.connectHeadset(device);
         }
 
         @Override
-        public int disconnect(BluetoothDevice device) {
+        public boolean disconnect(BluetoothDevice device) {
             if (mService.getCurrentHeadset().equals(device)) {
-                return mService.disconnectHeadset() ? BluetoothError.SUCCESS : BluetoothError.ERROR;
+                return mService.disconnectHeadset();
             } else {
-                return BluetoothError.SUCCESS;
+                return false;
             }
         }
 
@@ -312,13 +310,13 @@
         }
 
         @Override
-        public int connect(BluetoothDevice device) {
-            return -1;
+        public boolean connect(BluetoothDevice device) {
+            return false;
         }
 
         @Override
-        public int disconnect(BluetoothDevice device) {
-            return -1;
+        public boolean disconnect(BluetoothDevice device) {
+            return false;
         }
 
         @Override
diff --git a/src/com/android/settings/vpn/VpnSettings.java b/src/com/android/settings/vpn/VpnSettings.java
index 61b2701..eea0aca 100644
--- a/src/com/android/settings/vpn/VpnSettings.java
+++ b/src/com/android/settings/vpn/VpnSettings.java
@@ -652,7 +652,7 @@
         if (isKeystoreUnlocked()) return true;
         mUnlockAction = action;
         startActivity(
-                new Intent(SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
+                new Intent(Keystore.ACTION_UNLOCK_CREDENTIAL_STORAGE));
         return false;
     }
 
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index 2e3f305..eddeb63 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -379,9 +379,9 @@
             }
         }
         int state = mLocalBluetoothManager.getBluetoothState();
-        if (state == BluetoothAdapter.BLUETOOTH_STATE_OFF) {
+        if (state == BluetoothAdapter.STATE_OFF) {
             return STATE_DISABLED;
-        } else if (state == BluetoothAdapter.BLUETOOTH_STATE_ON) {
+        } else if (state == BluetoothAdapter.STATE_ON) {
             return STATE_ENABLED;
         } else {
             return STATE_INTERMEDIATE;
diff --git a/src/com/android/settings/wifi/AccessPointDialog.java b/src/com/android/settings/wifi/AccessPointDialog.java
index c4984cd..ce7ce92 100644
--- a/src/com/android/settings/wifi/AccessPointDialog.java
+++ b/src/com/android/settings/wifi/AccessPointDialog.java
@@ -17,7 +17,6 @@
 package com.android.settings.wifi;
 
 import com.android.settings.R;
-import com.android.settings.SecuritySettings;
 
 import android.app.AlertDialog;
 import android.content.Context;
@@ -802,7 +801,7 @@
                 // Unlock the keystore if it is not unlocked yet.
                 if (Keystore.getInstance().getState() != Keystore.UNLOCKED) {
                     getContext().startActivity(new Intent(
-                            SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
+                            Keystore.ACTION_UNLOCK_CREDENTIAL_STORAGE));
                     return;
                 }
                 enableEnterpriseFields();
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index adf4519..4aa5dc3 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -18,7 +18,6 @@
 
 import com.android.settings.ProgressCategory;
 import com.android.settings.R;
-import com.android.settings.SecuritySettings;
 
 import android.app.Dialog;
 import android.content.DialogInterface;
@@ -376,7 +375,7 @@
         if (state.isEnterprise() &&
                 Keystore.getInstance().getState() != Keystore.UNLOCKED) {
             startActivity(new Intent(
-                    SecuritySettings.ACTION_UNLOCK_CREDENTIAL_STORAGE));
+                    Keystore.ACTION_UNLOCK_CREDENTIAL_STORAGE));
             mResumeState = state;
             mResumeMode = mode;
             return;