Merge "Import some unabbreviated translations for large screens." into honeycomb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c7fcf6a..3a76a9d 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -849,7 +849,7 @@
         <activity android:name=".bluetooth.BluetoothPairingDialog"
                   android:label="@string/bluetooth_pairing_request"
                   android:excludeFromRecents="true"
-                  android:theme="@*android:style/Theme.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Holo.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -873,7 +873,7 @@
                   android:label="@string/bluetooth_permission_request"
                   android:excludeFromRecents="true"
                   android:permission="android.permission.BLUETOOTH"
-                  android:theme="@*android:style/Theme.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Holo.Dialog.Alert">
             <intent-filter>
                 <action android:name="android.bluetooth.adapter.action.REQUEST_DISCOVERABLE" />
                 <action android:name="android.bluetooth.adapter.action.REQUEST_ENABLE" />
@@ -885,7 +885,7 @@
                   android:label="@string/bluetooth_pairing_request"
                   android:excludeFromRecents="true"
                   android:permission="android.permission.BLUETOOTH"
-                  android:theme="@*android:style/Theme.Dialog.Alert">
+                  android:theme="@*android:style/Theme.Holo.Dialog.Alert">
         </activity>
 
         <receiver android:name=".bluetooth.BluetoothPairingRequest">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ee1a805..408ff2e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -763,8 +763,8 @@
     <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>
     <!-- Message when bluetooth incoming pairing request for (2.1 devices) dialog is showing -->
     <string name="bluetooth_incoming_pairing_msg"><xliff:g id="device_name">%1$s</xliff:g>\nwants to pair.</string>
-    <!-- Message when bluetooth dialog when passkey needs to be displayed. -->
-    <string name="bluetooth_display_passkey_msg">Enter <xliff:g id="passkey">%2$s</xliff:g> on \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022 to pair. </string>
+    <!-- Message when bluetooth dialog when passkey or pin needs to be displayed. -->
+    <string name="bluetooth_display_passkey_pin_msg">Enter \u0022<xliff:g id="passkey">%2$s</xliff:g>\u0022 on \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022 to pair followed by return or enter. </string>
     <!-- Button text for accepting an incoming pairing request -->
     <string name="bluetooth_pairing_accept">Pair</string>
     <!-- Button text for declining an incoming pairing request -->
diff --git a/src/com/android/settings/AccessibilitySettings.java b/src/com/android/settings/AccessibilitySettings.java
index 6cc5508..cec62b0 100644
--- a/src/com/android/settings/AccessibilitySettings.java
+++ b/src/com/android/settings/AccessibilitySettings.java
@@ -161,7 +161,7 @@
             if (serviceState == 1) {
                 mToggleAccessibilityCheckBox.setChecked(true);
                 if (savedInstanceState != null) {
-                    restoreInstanceStrate(savedInstanceState);
+                    restoreInstanceState(savedInstanceState);
                 }
             } else {
                 setAccessibilityServicePreferencesState(false);
@@ -200,7 +200,7 @@
     /**
      * Restores the instance state from <code>savedInstanceState</code>.
      */
-    private void restoreInstanceStrate(Bundle savedInstanceState) {
+    private void restoreInstanceState(Bundle savedInstanceState) {
         String key = savedInstanceState.getString(KEY_TOGGLE_ACCESSIBILITY_SERVICE_CHECKBOX);
         if (key != null) {
             Preference preference = findPreference(key);
@@ -230,6 +230,8 @@
             Preference pref = mAccessibilityServicesCategory.getPreference(i);
             pref.setEnabled(isEnabled);
         }
+
+        mToggleScriptInjectionCheckBox.setEnabled(isEnabled);
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index 4b7a0e0..1822e73 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -51,7 +51,7 @@
     private LocalBluetoothManager mLocalManager;
     private BluetoothDevice mDevice;
     private int mType;
-    private String mPasskey;
+    private String mPairingKey;
     private EditText mPairingView;
     private Button mOkButton;
 
@@ -96,24 +96,29 @@
             createUserEntryDialog();
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION){
             int passkey =
-                intent.getIntExtra(BluetoothDevice.EXTRA_PASSKEY, BluetoothDevice.ERROR);
+                intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_KEY, BluetoothDevice.ERROR);
             if (passkey == BluetoothDevice.ERROR) {
                 Log.e(TAG, "Invalid ConfirmationPasskey received, not showing any dialog");
                 return;
             }
-            mPasskey = String.format("%06d", passkey);
+            mPairingKey = String.format("%06d", passkey);
             createConfirmationDialog();
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_CONSENT) {
             createConsentDialog();
-        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
-            int passkey =
-                intent.getIntExtra(BluetoothDevice.EXTRA_PASSKEY, BluetoothDevice.ERROR);
-            if (passkey == BluetoothDevice.ERROR) {
-                Log.e(TAG, "Invalid ConfirmationPasskey received, not showing any dialog");
+        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY ||
+                   mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
+            int pairingKey =
+                intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_KEY, BluetoothDevice.ERROR);
+            if (pairingKey == BluetoothDevice.ERROR) {
+                Log.e(TAG, "Invalid Confirmation Passkey or PIN received, not showing any dialog");
                 return;
             }
-            mPasskey = String.format("%06d", passkey);
-            createDisplayPasskeyDialog();
+            if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
+                mPairingKey = String.format("%06d", pairingKey);
+            } else {
+                mPairingKey = String.format("%04d", pairingKey);
+            }
+            createDisplayPasskeyOrPinDialog();
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT) {
             createConsentDialog();
         } else {
@@ -166,13 +171,15 @@
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION) {
             mPairingView.setVisibility(View.GONE);
             messageView.setText(getString(R.string.bluetooth_confirm_passkey_msg, name,
-                    mPasskey));
+                    mPairingKey));
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_CONSENT) {
             mPairingView.setVisibility(View.GONE);
             messageView.setText(getString(R.string.bluetooth_incoming_pairing_msg, name));
-        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
+        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY ||
+                    mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
             mPairingView.setVisibility(View.GONE);
-            messageView.setText(getString(R.string.bluetooth_display_passkey_msg, name, mPasskey));
+            messageView.setText(getString(R.string.bluetooth_display_passkey_pin_msg, name,
+                    mPairingKey));
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT) {
             mPairingView.setVisibility(View.GONE);
             messageView.setText(getString(R.string.bluetooth_incoming_pairing_msg, name));
@@ -206,18 +213,23 @@
         setupAlert();
     }
 
-    private void createDisplayPasskeyDialog() {
+    private void createDisplayPasskeyOrPinDialog() {
         final AlertController.AlertParams p = mAlertParams;
         p.mIconId = android.R.drawable.ic_dialog_info;
         p.mTitle = getString(R.string.bluetooth_pairing_request);
         p.mView = createView();
-        p.mPositiveButtonText = getString(android.R.string.ok);
-        p.mPositiveButtonListener = this;
+        p.mNegativeButtonText = getString(android.R.string.cancel);
+        p.mNegativeButtonListener = this;
         setupAlert();
 
         // Since its only a notification, send an OK to the framework,
         // indicating that the dialog has been displayed.
-        mDevice.setPairingConfirmation(true);
+        if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
+            mDevice.setPairingConfirmation(true);
+        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
+            byte[] pinBytes = BluetoothDevice.convertPinToBytes(mPairingKey);
+            mDevice.setPin(pinBytes);
+        }
     }
 
     @Override
@@ -252,6 +264,8 @@
             mDevice.setPairingConfirmation(true);
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
             // Do Nothing.
+        } else if (mType == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
+            // Do Nothing
         } else if (mType == BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT) {
             mDevice.setRemoteOutOfBandData();
         } else {
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
index 0000205..6037c82 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -55,9 +55,11 @@
             pairingIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
             pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, type);
             if (type == BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION ||
-                    type == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY) {
-                int passkey = intent.getIntExtra(BluetoothDevice.EXTRA_PASSKEY, BluetoothDevice.ERROR);
-                pairingIntent.putExtra(BluetoothDevice.EXTRA_PASSKEY, passkey);
+                    type == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY ||
+                    type == BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN) {
+                int pairingKey = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_KEY,
+                        BluetoothDevice.ERROR);
+                pairingIntent.putExtra(BluetoothDevice.EXTRA_PAIRING_KEY, pairingKey);
             }
             pairingIntent.setAction(BluetoothDevice.ACTION_PAIRING_REQUEST);
             pairingIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
index c31f49d..46391d3 100644
--- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java
@@ -140,7 +140,7 @@
         if (isConnected()) {
             askDisconnect();
         } else if (bondState == BluetoothDevice.BOND_BONDED) {
-            connect();
+            connect(true);
         } else if (bondState == BluetoothDevice.BOND_NONE) {
             pair();
         }
@@ -264,18 +264,18 @@
         super.finalize();
     }
 
-    public void connect() {
+    public void connect(boolean connectAllProfiles) {
         if (!ensurePaired()) return;
 
         mConnectAttempted = SystemClock.elapsedRealtime();
 
-        connectWithoutResettingTimer(true);
+        connectWithoutResettingTimer(connectAllProfiles);
     }
 
     /*package*/ void onBondingDockConnect() {
         // Attempt to connect if UUIDs are available. Otherwise,
         // we will connect when the ACTION_UUID intent arrives.
-        connect();
+        connect(false);
     }
 
     private void connectWithoutResettingTimer(boolean connectAllProfiles) {
@@ -646,7 +646,7 @@
             if (mDevice.isBluetoothDock()) {
                 onBondingDockConnect();
             } else if (mConnectAfterPairing) {
-                connect();
+                connect(false);
             }
             mConnectAfterPairing = false;
         }
diff --git a/src/com/android/settings/bluetooth/DockService.java b/src/com/android/settings/bluetooth/DockService.java
index d165f9b..8104652 100644
--- a/src/com/android/settings/bluetooth/DockService.java
+++ b/src/com/android/settings/bluetooth/DockService.java
@@ -663,7 +663,7 @@
             }
 
             if (profileManager.getPreferred(device) == auto) {
-                cachedDevice.connect();
+                cachedDevice.connect(false);
                 break;
             }
         }
@@ -735,7 +735,7 @@
 
         if (callConnect) {
             if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting");
-            cachedDevice.connect();
+            cachedDevice.connect(false);
         }
     }