Merge "Fix bug #16951566 Switchbar color needs to change to ff37474f" into lmp-dev
diff --git a/res/layout-sw600dp/crypt_keeper_pattern_entry.xml b/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
index 4685ebf..3937008 100644
--- a/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
+++ b/res/layout-sw600dp/crypt_keeper_pattern_entry.xml
@@ -18,26 +18,24 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:layout_marginTop="@dimen/crypt_keeper_pattern_top_margin">
 
     <include layout="@layout/crypt_keeper_status" />
 
-    <RelativeLayout
-        android:layout_width="wrap_content"
-        android:layout_height="0dip"
-        android:layout_weight="1"
-        android:layout_gravity="center_horizontal">
+    <LinearLayout
+        android:layout_width="@dimen/crypt_keeper_pattern_size"
+        android:layout_height="@dimen/crypt_keeper_pattern_size"
+        android:orientation="horizontal"
+        android:layout_gravity="center_horizontal"
+        android:layout_marginTop="@dimen/crypt_keeper_pattern_separator">
 
-        <!-- Password entry field -->
-        <LinearLayout
-            android:layout_height="@dimen/crypt_keeper_pattern_size"
-            android:layout_width="@dimen/crypt_keeper_pattern_size"
-            android:layout_centerVertical="true"
-            android:orientation="horizontal">
-            <include layout="@layout/crypt_keeper_pattern_field" />
-        </LinearLayout>
+        <include layout="@layout/crypt_keeper_pattern_field" />
 
-    </RelativeLayout>
+    </LinearLayout>
+
+    <include layout="@layout/crypt_keeper_emergency_button" />
+
 </LinearLayout>
diff --git a/res/layout/crypt_keeper_emergency_button.xml b/res/layout/crypt_keeper_emergency_button.xml
new file mode 100644
index 0000000..d0004de
--- /dev/null
+++ b/res/layout/crypt_keeper_emergency_button.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+**
+** Copyright 2014, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License")
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<!-- Emergency call button.
+     Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
+<Button
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/emergencyCallButton"
+    android:layout_width="wrap_content"
+    android:layout_height="0dp"
+    android:layout_gravity="center_horizontal"
+    android:textSize="14sp"
+    android:fontFamily="sans-serif"
+    android:textColor="#FFFFFF"
+    android:layout_weight="1"
+    android:gravity="bottom"
+    style="?android:attr/borderlessButtonStyle" />
diff --git a/res/layout/crypt_keeper_password_entry.xml b/res/layout/crypt_keeper_password_entry.xml
index 6e99527..a7fecba 100644
--- a/res/layout/crypt_keeper_password_entry.xml
+++ b/res/layout/crypt_keeper_password_entry.xml
@@ -20,36 +20,23 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:layout_marginTop="@dimen/crypt_keeper_password_top_margin">
 
     <include layout="@layout/crypt_keeper_status" />
 
     <LinearLayout
-        android:layout_height="0dp"
-        android:layout_width="match_parent"
-        android:layout_weight="1"
-        android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
-        android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
-        android:orientation="vertical"
-        android:gravity="center_vertical">
+        android:layout_width="@dimen/crypt_keeper_password_width"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:layout_marginTop="16dip"
+        android:layout_gravity="center_horizontal"
+        android:background="@color/crypt_keeper_password_background">
 
-        <LinearLayout
-            android:background="@color/crypt_keeper_password_background"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-            <include layout="@layout/crypt_keeper_password_field" />
-        </LinearLayout>
+        <include layout="@layout/crypt_keeper_password_field" />
 
     </LinearLayout>
 
-    <!-- Emergency call button.
-         Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
-    <Button android:id="@+id/emergencyCallButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
-        style="?android:attr/borderlessButtonStyle" />
+    <include layout="@layout/crypt_keeper_emergency_button" />
 
 </LinearLayout>
diff --git a/res/layout/crypt_keeper_pattern_entry.xml b/res/layout/crypt_keeper_pattern_entry.xml
index 80e318f..00d3d6e 100644
--- a/res/layout/crypt_keeper_pattern_entry.xml
+++ b/res/layout/crypt_keeper_pattern_entry.xml
@@ -20,35 +20,22 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:layout_marginTop="@dimen/crypt_keeper_pattern_top_margin">
 
     <include layout="@layout/crypt_keeper_status" />
 
     <LinearLayout
-        android:layout_height="0dp"
         android:layout_width="match_parent"
-        android:layout_weight="1"
-        android:orientation="vertical"
-        android:gravity="center_vertical">
+        android:layout_height="wrap_content"
+        android:layout_marginStart="@dimen/crypt_keeper_pattern_margin"
+        android:layout_marginEnd="@dimen/crypt_keeper_pattern_margin"
+        android:orientation="horizontal">
 
-        <LinearLayout
-            android:layout_height="wrap_content"
-            android:layout_width="match_parent"
-            android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
-            android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
-            android:orientation="horizontal" >
-            <include layout="@layout/crypt_keeper_pattern_field" />
-        </LinearLayout>
+        <include layout="@layout/crypt_keeper_pattern_field" />
 
     </LinearLayout>
 
-    <!-- Emergency call button.
-         Text and icon are set by CryptKeeper.updateEmergencyCallButtonState() -->
-    <Button android:id="@+id/emergencyCallButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center"
-        android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
-        style="?android:attr/borderlessButtonStyle" />
+    <include layout="@layout/crypt_keeper_emergency_button" />
 
 </LinearLayout>
diff --git a/res/layout/crypt_keeper_pin_entry.xml b/res/layout/crypt_keeper_pin_entry.xml
index 0bcbec5..3926ab0 100644
--- a/res/layout/crypt_keeper_pin_entry.xml
+++ b/res/layout/crypt_keeper_pin_entry.xml
@@ -20,36 +20,23 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:layout_marginTop="@dimen/crypt_keeper_password_top_margin">
 
     <include layout="@layout/crypt_keeper_status" />
 
     <LinearLayout
-        android:layout_height="0dp"
-        android:layout_width="match_parent"
-        android:layout_weight="1"
-        android:layout_marginStart="@dimen/crypt_keeper_edit_text_margin"
-        android:layout_marginEnd="@dimen/crypt_keeper_edit_text_margin"
-        android:orientation="vertical"
-        android:gravity="center_vertical">
+        android:layout_width="@dimen/crypt_keeper_password_width"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="16dip"
+        android:orientation="horizontal"
+        android:layout_gravity="center_horizontal"
+        android:background="@color/crypt_keeper_password_background">
 
-        <LinearLayout
-            android:background="@color/crypt_keeper_password_background"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-            <include layout="@layout/crypt_keeper_pin_field" />
-        </LinearLayout>
+        <include layout="@layout/crypt_keeper_pin_field" />
 
     </LinearLayout>
 
-    <!-- Emergency call button.
-         Text is set by CryptKeeper.updateEmergencyCallButtonState() -->
-    <Button android:id="@+id/emergencyCallButton"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="center_horizontal"
-        android:layout_marginTop="@dimen/crypt_keeper_emergency_call_space_above"
-        style="?android:attr/borderlessButtonStyle" />
+    <include layout="@layout/crypt_keeper_emergency_button" />
 
 </LinearLayout>
diff --git a/res/layout/crypt_keeper_status.xml b/res/layout/crypt_keeper_status.xml
index c366b57..bddff1a 100644
--- a/res/layout/crypt_keeper_status.xml
+++ b/res/layout/crypt_keeper_status.xml
@@ -31,11 +31,11 @@
         android:id="@+id/status"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginTop="10dip"
         android:layout_marginStart="8dip"
         android:layout_marginEnd="8dip"
-        android:textSize="18sp"
-        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:textSize="16sp"
+        android:fontFamily="sans-serif"
+        android:textColor="@android:color/white"
         android:text="@string/enter_password"
         android:layout_gravity="center_horizontal"
         android:gravity="center_horizontal" />
@@ -51,6 +51,8 @@
         android:ellipsize="marquee"
         android:marqueeRepeatLimit ="marquee_forever"
         android:textSize="16sp"
-        android:textAppearance="?android:attr/textAppearanceMedium" />
+        android:fontFamily="sans-serif"
+        android:textColor="#B3FFFFFF"
+        android:gravity="center_horizontal" />
 
 </LinearLayout>
diff --git a/res/values-sw600dp-land/dimens.xml b/res/values-sw600dp-land/dimens.xml
index c0a79ad..eb37d0f 100755
--- a/res/values-sw600dp-land/dimens.xml
+++ b/res/values-sw600dp-land/dimens.xml
@@ -20,4 +20,11 @@
     <dimen name="screen_margin_bottom">48dip</dimen>
     <dimen name="appwidget_preview_height">80dip</dimen>
     <dimen name="keyguard_appwidget_picker_width">720dip</dimen>
+
+    <!-- CryptKeeper top margin for password/pin screen -->
+    <dimen name="crypt_keeper_password_top_margin">116dip</dimen>
+
+    <!-- CryptKeeper top margin for pattern screen -->
+    <dimen name="crypt_keeper_pattern_top_margin">128dip</dimen>
+
 </resources>
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index e040167..e1bb33e 100755
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -55,6 +55,18 @@
     <dimen name="dashboard_tile_image_margin_start">8dp</dimen>
     <dimen name="dashboard_tile_image_margin_end">32dp</dimen>
 
+    <!-- CryptKeeper top margin for password/pin screen -->
+    <dimen name="crypt_keeper_password_top_margin">256dip</dimen>
+
+    <!-- CryptKeeper top margin for pattern screen -->
+    <dimen name="crypt_keeper_pattern_top_margin">256dip</dimen>
+
+    <!-- CryptKeeper separation between status and pattern -->
+    <dimen name="crypt_keeper_pattern_separator">100dip</dimen>
+
+    <!-- CryptKeeper password/pin width -->
+    <dimen name="crypt_keeper_password_width">512dip</dimen>
+
     <!-- SwitchBar margin start / end -->
     <dimen name="switchbar_margin_start">24dp</dimen>
     <dimen name="switchbar_margin_end">24dp</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index cb87bf0..2b53f96 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -168,8 +168,14 @@
     <dimen name="wifi_assistant_padding">25dp</dimen>
     <dimen name="wifi_assistant_text_padding">16dp</dimen>
 
-    <!-- CryptKeeper edit text margin -->
-    <dimen name="crypt_keeper_edit_text_margin">16dip</dimen>
+    <!-- CryptKeeper top margin for password/pin screen -->
+    <dimen name="crypt_keeper_password_top_margin">88dip</dimen>
+
+    <!-- CryptKeeper top margin for pattern screen -->
+    <dimen name="crypt_keeper_pattern_top_margin">88dip</dimen>
+
+    <!-- CryptKeeper password/pin width -->
+    <dimen name="crypt_keeper_password_width">280dip</dimen>
 
     <!-- CryptKeeper emergency call button dimensions -->
     <dimen name="crypt_keeper_emergency_call_space_above">16dip</dimen>
@@ -177,6 +183,9 @@
     <!-- CryptKeeper edit text ime icon padding -->
     <dimen name="crypt_keeper_edit_text_ime_padding">8dip</dimen>
 
+    <!-- CryptKeeper pattern margin on phone -->
+    <dimen name="crypt_keeper_pattern_margin">8dip</dimen>
+
     <!-- CryptKeeper pattern size for tablet -->
     <dimen name="crypt_keeper_pattern_size">354dip</dimen>
 
diff --git a/res/xml/language_settings.xml b/res/xml/language_settings.xml
index 9d12857..b60dc5e 100644
--- a/res/xml/language_settings.xml
+++ b/res/xml/language_settings.xml
@@ -65,34 +65,6 @@
             android:persistent="false">
         <!-- Additional preference screens are inserted here programmatically
              with low order values to set the key map of each attached keyboard. -->
-
-        <CheckBoxPreference
-                android:key="auto_replace"
-                android:title="@string/auto_replace"
-                android:summaryOn="@string/auto_replace_summary"
-                android:summaryOff="@string/auto_replace_summary"
-                android:order="1000"
-                android:persistent="false"
-                />
-
-        <CheckBoxPreference
-                android:key="auto_caps"
-                android:title="@string/auto_caps"
-                android:summaryOn="@string/auto_caps_summary"
-                android:summaryOff="@string/auto_caps_summary"
-                android:order="1001"
-                android:persistent="false"
-                />
-
-        <CheckBoxPreference
-                android:key="auto_punctuate"
-                android:title="@string/auto_punctuate"
-                android:summaryOn="@string/auto_punctuate_summary"
-                android:summaryOff="@string/auto_punctuate_summary"
-                android:order="1002"
-                android:persistent="false"
-                />
-
     </PreferenceCategory>
 
     <PreferenceCategory
diff --git a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
index b80e42a..4466aea 100644
--- a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java
@@ -92,7 +92,6 @@
             mDeviceNameEdited = savedInstanceState.getBoolean(KEY_NAME_EDITED, false);
         }
         mAlertDialog = new AlertDialog.Builder(getActivity())
-                .setIcon(android.R.drawable.ic_dialog_info)
                 .setTitle(R.string.bluetooth_rename_device)
                 .setView(createDialogView(deviceName))
                 .setPositiveButton(R.string.bluetooth_rename_button,
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 1601cd0..b8ae493 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -88,14 +88,6 @@
     // false: on ICS or later
     private static final boolean SHOW_INPUT_METHOD_SWITCHER_SETTINGS = false;
 
-    private static final String[] sSystemSettingNames = {
-        System.TEXT_AUTO_REPLACE, System.TEXT_AUTO_CAPS, System.TEXT_AUTO_PUNCTUATE,
-    };
-
-    private static final String[] sHardKeyboardKeys = {
-        "auto_replace", "auto_caps", "auto_punctuate",
-    };
-
     private int mDefaultInputMethodSelectorVisibility = 0;
     private ListPreference mShowInputMethodSelectorPref;
     private PreferenceCategory mKeyboardSettingsCategory;
@@ -274,16 +266,6 @@
             }
         }
 
-        // Hard keyboard
-        if (!mHardKeyboardPreferenceList.isEmpty()) {
-            for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
-                CheckBoxPreference chkPref = (CheckBoxPreference)
-                        mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i]);
-                chkPref.setChecked(
-                        System.getInt(getContentResolver(), sSystemSettingNames[i], 1) > 0);
-            }
-        }
-
         updateInputDevices();
 
         // Refresh internal states in mInputMethodSettingValues to keep the latest
@@ -339,15 +321,6 @@
             }
         } else if (preference instanceof CheckBoxPreference) {
             final CheckBoxPreference chkPref = (CheckBoxPreference) preference;
-            if (!mHardKeyboardPreferenceList.isEmpty()) {
-                for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
-                    if (chkPref == mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i])) {
-                        System.putInt(getContentResolver(), sSystemSettingNames[i],
-                                chkPref.isChecked() ? 1 : 0);
-                        return true;
-                    }
-                }
-            }
             if (chkPref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
                 System.putInt(getContentResolver(), Settings.System.VIBRATE_INPUT_DEVICES,
                         chkPref.isChecked() ? 1 : 0);
@@ -564,35 +537,33 @@
 
     private void updateHardKeyboards() {
         mHardKeyboardPreferenceList.clear();
-        if (getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
-            final int[] devices = InputDevice.getDeviceIds();
-            for (int i = 0; i < devices.length; i++) {
-                InputDevice device = InputDevice.getDevice(devices[i]);
-                if (device != null
-                        && !device.isVirtual()
-                        && device.isFullKeyboard()) {
-                    final InputDeviceIdentifier identifier = device.getIdentifier();
-                    final String keyboardLayoutDescriptor =
-                            mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
-                    final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
-                            mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
+        final int[] devices = InputDevice.getDeviceIds();
+        for (int i = 0; i < devices.length; i++) {
+            InputDevice device = InputDevice.getDevice(devices[i]);
+            if (device != null
+                    && !device.isVirtual()
+                    && device.isFullKeyboard()) {
+                final InputDeviceIdentifier identifier = device.getIdentifier();
+                final String keyboardLayoutDescriptor =
+                    mIm.getCurrentKeyboardLayoutForInputDevice(identifier);
+                final KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+                    mIm.getKeyboardLayout(keyboardLayoutDescriptor) : null;
 
-                    final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
-                    pref.setTitle(device.getName());
-                    if (keyboardLayout != null) {
-                        pref.setSummary(keyboardLayout.toString());
-                    } else {
-                        pref.setSummary(R.string.keyboard_layout_default_label);
-                    }
-                    pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
-                        @Override
-                        public boolean onPreferenceClick(Preference preference) {
-                            showKeyboardLayoutDialog(identifier);
-                            return true;
-                        }
-                    });
-                    mHardKeyboardPreferenceList.add(pref);
+                final PreferenceScreen pref = new PreferenceScreen(getActivity(), null);
+                pref.setTitle(device.getName());
+                if (keyboardLayout != null) {
+                    pref.setSummary(keyboardLayout.toString());
+                } else {
+                    pref.setSummary(R.string.keyboard_layout_default_label);
                 }
+                pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
+                    @Override
+                    public boolean onPreferenceClick(Preference preference) {
+                        showKeyboardLayoutDialog(identifier);
+                        return true;
+                    }
+                });
+                mHardKeyboardPreferenceList.add(pref);
             }
         }
 
@@ -795,76 +766,74 @@
             // Hard keyboards
             InputManager inputManager = (InputManager) context.getSystemService(
                     Context.INPUT_SERVICE);
-            if (resources.getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY) {
-                boolean hasHardKeyboards = false;
+            boolean hasHardKeyboards = false;
 
-                final int[] devices = InputDevice.getDeviceIds();
-                for (int i = 0; i < devices.length; i++) {
-                    InputDevice device = InputDevice.getDevice(devices[i]);
-                    if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
-                        continue;
-                    }
-
-                    hasHardKeyboards = true;
-
-                    InputDeviceIdentifier identifier = device.getIdentifier();
-                    String keyboardLayoutDescriptor =
-                            inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
-                    KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
-                            inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
-
-                    String summary;
-                    if (keyboardLayout != null) {
-                        summary = keyboardLayout.toString();
-                    } else {
-                        summary = context.getString(R.string.keyboard_layout_default_label);
-                    }
-
-                    indexable = new SearchIndexableRaw(context);
-                    indexable.key = device.getName();
-                    indexable.title = device.getName();
-                    indexable.summaryOn = summary;
-                    indexable.summaryOff = summary;
-                    indexable.screenTitle = screenTitle;
-                    indexables.add(indexable);
+            final int[] devices = InputDevice.getDeviceIds();
+            for (int i = 0; i < devices.length; i++) {
+                InputDevice device = InputDevice.getDevice(devices[i]);
+                if (device == null || device.isVirtual() || !device.isFullKeyboard()) {
+                    continue;
                 }
 
-                if (hasHardKeyboards) {
-                    // Hard keyboard category.
-                    indexable = new SearchIndexableRaw(context);
-                    indexable.key = "builtin_keyboard_settings";
-                    indexable.title = context.getString(
-                            R.string.builtin_keyboard_settings_title);
-                    indexable.screenTitle = screenTitle;
-                    indexables.add(indexable);
+                hasHardKeyboards = true;
 
-                    // Auto replace.
-                    indexable = new SearchIndexableRaw(context);
-                    indexable.key = "auto_replace";
-                    indexable.title = context.getString(R.string.auto_replace);
-                    indexable.summaryOn = context.getString(R.string.auto_replace_summary);
-                    indexable.summaryOff = context.getString(R.string.auto_replace_summary);
-                    indexable.screenTitle = screenTitle;
-                    indexables.add(indexable);
+                InputDeviceIdentifier identifier = device.getIdentifier();
+                String keyboardLayoutDescriptor =
+                        inputManager.getCurrentKeyboardLayoutForInputDevice(identifier);
+                KeyboardLayout keyboardLayout = keyboardLayoutDescriptor != null ?
+                        inputManager.getKeyboardLayout(keyboardLayoutDescriptor) : null;
 
-                    // Auto caps.
-                    indexable = new SearchIndexableRaw(context);
-                    indexable.key = "auto_caps";
-                    indexable.title = context.getString(R.string.auto_caps);
-                    indexable.summaryOn = context.getString(R.string.auto_caps_summary);
-                    indexable.summaryOff = context.getString(R.string.auto_caps_summary);
-                    indexable.screenTitle = screenTitle;
-                    indexables.add(indexable);
-
-                    // Auto punctuate.
-                    indexable = new SearchIndexableRaw(context);
-                    indexable.key = "auto_punctuate";
-                    indexable.title = context.getString(R.string.auto_punctuate);
-                    indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
-                    indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
-                    indexable.screenTitle = screenTitle;
-                    indexables.add(indexable);
+                String summary;
+                if (keyboardLayout != null) {
+                    summary = keyboardLayout.toString();
+                } else {
+                    summary = context.getString(R.string.keyboard_layout_default_label);
                 }
+
+                indexable = new SearchIndexableRaw(context);
+                indexable.key = device.getName();
+                indexable.title = device.getName();
+                indexable.summaryOn = summary;
+                indexable.summaryOff = summary;
+                indexable.screenTitle = screenTitle;
+                indexables.add(indexable);
+            }
+
+            if (hasHardKeyboards) {
+                // Hard keyboard category.
+                indexable = new SearchIndexableRaw(context);
+                indexable.key = "builtin_keyboard_settings";
+                indexable.title = context.getString(
+                        R.string.builtin_keyboard_settings_title);
+                indexable.screenTitle = screenTitle;
+                indexables.add(indexable);
+
+                // Auto replace.
+                indexable = new SearchIndexableRaw(context);
+                indexable.key = "auto_replace";
+                indexable.title = context.getString(R.string.auto_replace);
+                indexable.summaryOn = context.getString(R.string.auto_replace_summary);
+                indexable.summaryOff = context.getString(R.string.auto_replace_summary);
+                indexable.screenTitle = screenTitle;
+                indexables.add(indexable);
+
+                // Auto caps.
+                indexable = new SearchIndexableRaw(context);
+                indexable.key = "auto_caps";
+                indexable.title = context.getString(R.string.auto_caps);
+                indexable.summaryOn = context.getString(R.string.auto_caps_summary);
+                indexable.summaryOff = context.getString(R.string.auto_caps_summary);
+                indexable.screenTitle = screenTitle;
+                indexables.add(indexable);
+
+                // Auto punctuate.
+                indexable = new SearchIndexableRaw(context);
+                indexable.key = "auto_punctuate";
+                indexable.title = context.getString(R.string.auto_punctuate);
+                indexable.summaryOn = context.getString(R.string.auto_punctuate_summary);
+                indexable.summaryOff = context.getString(R.string.auto_punctuate_summary);
+                indexable.screenTitle = screenTitle;
+                indexables.add(indexable);
             }
 
             // Voice recognizers.
diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java
index e83cb06..5f22146 100644
--- a/src/com/android/settings/wifi/WifiSettings.java
+++ b/src/com/android/settings/wifi/WifiSettings.java
@@ -27,7 +27,6 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.SharedPreferences;
-import android.content.pm.PackageManager;
 import android.content.res.Resources;
 import android.content.res.TypedArray;
 import android.location.LocationManager;
@@ -50,6 +49,7 @@
 import android.util.Log;
 import android.view.ContextMenu;
 import android.view.ContextMenu.ContextMenuInfo;
+import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
@@ -129,7 +129,6 @@
     private WifiManager.ActionListener mConnectListener;
     private WifiManager.ActionListener mSaveListener;
     private WifiManager.ActionListener mForgetListener;
-    private boolean mP2pSupported;
 
     private WifiEnabler mWifiEnabler;
     // An access point being editted is stored here.
@@ -156,7 +155,7 @@
     private boolean mDlgEdit;
     private AccessPoint mDlgAccessPoint;
     private Bundle mAccessPointSavedState;
-    private Preference mWifiAssistantPreference;
+    private View mWifiAssistantCard;
     private NetworkScorerAppData mWifiAssistantApp;
 
     /** verbose logging flag. this flag is set thru developer debugging options
@@ -165,52 +164,6 @@
 
     /* End of "used in Wifi Setup context" */
 
-    /** Holds the Wifi Assistant Card. */
-    private class WifiAssistantPreference extends Preference {
-        public WifiAssistantPreference() {
-            super(getActivity());
-            setLayoutResource(R.layout.wifi_assistant_card);
-        }
-
-        @Override
-        public void onBindView(View view) {
-            super.onBindView(view);
-            Button setup = (Button)view.findViewById(R.id.setup);
-            Button noThanks = (Button)view.findViewById(R.id.no_thanks_button);
-
-            if (setup != null && noThanks != null) {
-                setup.setOnClickListener(new OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        Intent intent = new Intent();
-                        if (mWifiAssistantApp.mConfigurationActivityClassName != null) {
-                            // App has a custom configuration activity; launch that.
-                            // This custom activity will be responsible for launching the system
-                            // dialog.
-                            intent.setClassName(mWifiAssistantApp.mPackageName,
-                                    mWifiAssistantApp.mConfigurationActivityClassName);
-                        } else {
-                            // Fall back on the system dialog.
-                            intent.setAction(NetworkScoreManager.ACTION_CHANGE_ACTIVE);
-                            intent.putExtra(NetworkScoreManager.EXTRA_PACKAGE_NAME,
-                                    mWifiAssistantApp.mPackageName);
-                        }
-                        startActivityForResult(intent, REQUEST_ENABLE_WIFI_ASSISTANT);
-                    }
-                });
-
-                noThanks.setOnClickListener(new OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        setWifiAssistantTimeout();
-                        getPreferenceScreen().removePreference(WifiAssistantPreference.this);
-                        mWifiAssistantApp = null;
-                    }
-                });
-            }
-        }
-    }
-
     /** A restricted multimap for use in constructAccessPoints */
     private static class Multimap<K,V> {
         private final HashMap<K,List<V>> store = new HashMap<K,List<V>>();
@@ -285,7 +238,7 @@
         mReceiver = new BroadcastReceiver() {
             @Override
             public void onReceive(Context context, Intent intent) {
-                handleEvent(context, intent);
+                handleEvent(intent);
             }
         };
 
@@ -296,7 +249,6 @@
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        mP2pSupported = getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_DIRECT);
         mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
 
         mConnectListener = new WifiManager.ActionListener() {
@@ -347,7 +299,7 @@
         if (savedInstanceState != null) {
             mDlgEdit = savedInstanceState.getBoolean(SAVE_DIALOG_EDIT_MODE);
             if (savedInstanceState.containsKey(SAVE_DIALOG_ACCESS_POINT_STATE)) {
-                mAccessPointSavedState = 
+                mAccessPointSavedState =
                     savedInstanceState.getBundle(SAVE_DIALOG_ACCESS_POINT_STATE);
             }
         }
@@ -384,7 +336,7 @@
         if (requestCode == REQUEST_ENABLE_WIFI_ASSISTANT) {
             if (resultCode == Activity.RESULT_OK) {
                 setWifiAssistantTimeout();
-                getPreferenceScreen().removePreference(mWifiAssistantPreference);
+                getListView().removeHeaderView(mWifiAssistantCard);
                 mWifiAssistantApp = null;
             }
         } else {
@@ -706,8 +658,9 @@
                     addMessagePreference(R.string.wifi_empty_list_wifi_on);
                 }
 
+                getListView().removeHeaderView(mWifiAssistantCard);
                 if (mWifiAssistantApp != null) {
-                    getPreferenceScreen().addPreference(mWifiAssistantPreference);
+                    getListView().addHeaderView(mWifiAssistantCard);
                 }
 
                 for (AccessPoint accessPoint : accessPoints) {
@@ -732,38 +685,72 @@
         }
     }
 
-    private boolean prepareWifiAssistantCard() {
-        if (mWifiAssistantPreference == null) {
-            mWifiAssistantPreference = new WifiAssistantPreference();
-        }
-
+    private void prepareWifiAssistantCard() {
         if (getActivity() instanceof WifiPickerActivity) {
-            return false;
+            return;
         }
 
         if (NetworkScorerAppManager.getActiveScorer(getActivity()) != null) {
             // A scorer is already enabled; don't show the card.
-            return false;
+            return;
         }
 
         Collection<NetworkScorerAppData> scorers =
                 NetworkScorerAppManager.getAllValidScorers(getActivity());
         if (scorers.isEmpty()) {
             // No scorers are available to enable; don't show the card.
-            return false;
+            return;
         }
 
         SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();
         long lastTimeoutEndTime = sharedPreferences.getLong(KEY_ASSISTANT_START_TIME, 0);
         long dismissTime = sharedPreferences.getLong(KEY_ASSISTANT_DISMISS_TIME, 0);
 
-        boolean shouldShow = ((System.currentTimeMillis() - lastTimeoutEndTime) > dismissTime);
-        if (shouldShow) {
-            // TODO: b/13780935 - Implement proper scorer selection. Rather than pick the first
-            // scorer on the system, we should allow the user to select one.
-            mWifiAssistantApp = scorers.iterator().next();
+        if ((System.currentTimeMillis() - lastTimeoutEndTime) <= dismissTime) {
+            return;
         }
-        return shouldShow;
+
+        // TODO: b/13780935 - Implement proper scorer selection. Rather than pick the first
+        // scorer on the system, we should allow the user to select one.
+        mWifiAssistantApp = scorers.iterator().next();
+
+        if (mWifiAssistantCard == null) {
+            mWifiAssistantCard = LayoutInflater.from(getActivity())
+                    .inflate(R.layout.wifi_assistant_card, getListView(), false);
+            Button setup = (Button) mWifiAssistantCard.findViewById(R.id.setup);
+            Button noThanks = (Button) mWifiAssistantCard.findViewById(R.id.no_thanks_button);
+
+            if (setup != null && noThanks != null) {
+                setup.setOnClickListener(new OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        Intent intent = new Intent();
+                        if (mWifiAssistantApp.mConfigurationActivityClassName != null) {
+                            // App has a custom configuration activity; launch that.
+                            // This custom activity will be responsible for launching the system
+                            // dialog.
+                            intent.setClassName(mWifiAssistantApp.mPackageName,
+                                    mWifiAssistantApp.mConfigurationActivityClassName);
+                        } else {
+                            // Fall back on the system dialog.
+                            intent.setAction(NetworkScoreManager.ACTION_CHANGE_ACTIVE);
+                            intent.putExtra(NetworkScoreManager.EXTRA_PACKAGE_NAME,
+                                    mWifiAssistantApp.mPackageName);
+                        }
+                        startActivityForResult(intent, REQUEST_ENABLE_WIFI_ASSISTANT);
+                    }
+                });
+
+                noThanks.setOnClickListener(new OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        setWifiAssistantTimeout();
+                        getListView().removeHeaderView(mWifiAssistantCard);
+                        mWifiAssistantApp = null;
+                    }
+                });
+            }
+        }
     }
 
     private void setWifiAssistantTimeout() {
@@ -861,7 +848,7 @@
         return accessPoints;
     }
 
-    private void handleEvent(Context context, Intent intent) {
+    private void handleEvent(Intent intent) {
         String action = intent.getAction();
         if (WifiManager.WIFI_STATE_CHANGED_ACTION.equals(action)) {
             updateWifiState(intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE,