diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 4b311c1..713ba42 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -637,7 +637,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.inputmethod.KeyboardLayoutPickerFragment2" />
+                android:value="com.android.settings.inputmethod.KeyboardLayoutPickerFragment" />
         </activity>
 
         <activity android:name="Settings$PhysicalKeyboardActivity"
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java
index 3813c42..bd00085 100644
--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -101,7 +101,6 @@
 import com.android.settings.inputmethod.AvailableVirtualKeyboardFragment;
 import com.android.settings.inputmethod.InputMethodAndLanguageSettings;
 import com.android.settings.inputmethod.KeyboardLayoutPickerFragment;
-import com.android.settings.inputmethod.KeyboardLayoutPickerFragment2;
 import com.android.settings.inputmethod.PhysicalKeyboardFragment;
 import com.android.settings.inputmethod.SpellCheckersSettings;
 import com.android.settings.inputmethod.UserDictionaryList;
@@ -355,7 +354,6 @@
             TrustedCredentialsSettings.class.getName(),
             PaymentSettings.class.getName(),
             KeyboardLayoutPickerFragment.class.getName(),
-            KeyboardLayoutPickerFragment2.class.getName(),
             PhysicalKeyboardFragment.class.getName(),
             ZenModeSettings.class.getName(),
             SoundSettings.class.getName(),
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
index 1b51c3c..09cc65e 100644
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
+++ b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2016 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.
@@ -16,32 +16,43 @@
 
 package com.android.settings.inputmethod;
 
-import android.content.Context;
+import android.annotation.Nullable;
+import android.app.Activity;
 import android.hardware.input.InputDeviceIdentifier;
 import android.hardware.input.InputManager;
 import android.hardware.input.InputManager.InputDeviceListener;
 import android.hardware.input.KeyboardLayout;
 import android.os.Bundle;
-import android.support.v7.preference.CheckBoxPreference;
 import android.support.v7.preference.Preference;
 import android.support.v7.preference.PreferenceScreen;
 import android.view.InputDevice;
 
+import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodSubtype;
+import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.MetricsProto.MetricsEvent;
+import com.android.internal.util.Preconditions;
+import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
+import com.android.settings.inputmethod.PhysicalKeyboardFragment.KeyboardInfoPreference;
 
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-public class KeyboardLayoutPickerFragment extends SettingsPreferenceFragment
+public final class KeyboardLayoutPickerFragment extends SettingsPreferenceFragment
         implements InputDeviceListener {
+
     private InputDeviceIdentifier mInputDeviceIdentifier;
     private int mInputDeviceId = -1;
     private InputManager mIm;
+    private InputMethodInfo mImi;
+    @Nullable
+    private InputMethodSubtype mSubtype;
     private KeyboardLayout[] mKeyboardLayouts;
-    private HashMap<CheckBoxPreference, KeyboardLayout> mPreferenceMap =
-            new HashMap<CheckBoxPreference, KeyboardLayout>();
+    private Map<Preference, KeyboardLayout> mPreferenceMap = new HashMap<>();
+
+    // TODO: Make these constants public API for b/25752827
 
     /**
      * Intent extra: The input device descriptor of the keyboard whose keyboard
@@ -49,6 +60,16 @@
      */
     public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
 
+    /**
+     * Intent extra: The associated {@link InputMethodInfo}.
+     */
+    public static final String EXTRA_INPUT_METHOD_INFO = "input_method_info";
+
+    /**
+     * Intent extra: The associated {@link InputMethodSubtype}.
+     */
+    public static final String EXTRA_INPUT_METHOD_SUBTYPE = "input_method_subtype";
+
     @Override
     public int getMetricsCategory() {
         return MetricsEvent.INPUTMETHOD_KEYBOARD;
@@ -57,14 +78,18 @@
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
+        Activity activity = Preconditions.checkNotNull(getActivity());
 
-        mInputDeviceIdentifier = getActivity().getIntent().getParcelableExtra(
+        mInputDeviceIdentifier = activity.getIntent().getParcelableExtra(
                 EXTRA_INPUT_DEVICE_IDENTIFIER);
-        if (mInputDeviceIdentifier == null) {
-            getActivity().finish();
+        mImi = activity.getIntent().getParcelableExtra(EXTRA_INPUT_METHOD_INFO);
+        mSubtype = activity.getIntent().getParcelableExtra(EXTRA_INPUT_METHOD_SUBTYPE);
+
+        if (mInputDeviceIdentifier == null || mImi == null) {
+            activity.finish();
         }
 
-        mIm = (InputManager)getSystemService(Context.INPUT_SERVICE);
+        mIm = activity.getSystemService(InputManager.class);
         mKeyboardLayouts = mIm.getKeyboardLayoutsForInputDevice(mInputDeviceIdentifier);
         Arrays.sort(mKeyboardLayouts);
         setPreferenceScreen(createPreferenceHierarchy());
@@ -83,8 +108,6 @@
             return;
         }
         mInputDeviceId = inputDevice.getId();
-
-        updateCheckedState();
     }
 
     @Override
@@ -97,34 +120,21 @@
 
     @Override
     public boolean onPreferenceTreeClick(Preference preference) {
-        if (preference instanceof CheckBoxPreference) {
-            CheckBoxPreference checkboxPref = (CheckBoxPreference)preference;
-            KeyboardLayout layout = mPreferenceMap.get(checkboxPref);
-            if (layout != null) {
-                boolean checked = checkboxPref.isChecked();
-                if (checked) {
-                    mIm.addKeyboardLayoutForInputDevice(mInputDeviceIdentifier,
-                            layout.getDescriptor());
-                } else {
-                    mIm.removeKeyboardLayoutForInputDevice(mInputDeviceIdentifier,
-                            layout.getDescriptor());
-                }
-                return true;
-            }
+        KeyboardLayout layout = mPreferenceMap.get(preference);
+        if (layout != null) {
+            mIm.setKeyboardLayoutForInputDevice(mInputDeviceIdentifier, mImi, mSubtype,
+                    layout.getDescriptor());
+            getActivity().finish();
+            return true;
         }
         return super.onPreferenceTreeClick(preference);
     }
 
     @Override
-    public void onInputDeviceAdded(int deviceId) {
-    }
+    public void onInputDeviceAdded(int deviceId) {}
 
     @Override
-    public void onInputDeviceChanged(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            updateCheckedState();
-        }
-    }
+    public void onInputDeviceChanged(int deviceId) {}
 
     @Override
     public void onInputDeviceRemoved(int deviceId) {
@@ -135,26 +145,16 @@
 
     private PreferenceScreen createPreferenceHierarchy() {
         PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getActivity());
-        Context context = getActivity();
 
         for (KeyboardLayout layout : mKeyboardLayouts) {
-            CheckBoxPreference pref = new CheckBoxPreference(getPrefContext());
+            Preference pref = new Preference(getPrefContext());
             pref.setTitle(layout.getLabel());
             pref.setSummary(layout.getCollection());
             root.addPreference(pref);
             mPreferenceMap.put(pref, layout);
         }
+
+        root.setTitle(KeyboardInfoPreference.getDisplayName(getContext(), mImi, mSubtype));
         return root;
     }
-
-    private void updateCheckedState() {
-        String[] enabledKeyboardLayouts = mIm.getEnabledKeyboardLayoutsForInputDevice(
-                mInputDeviceIdentifier);
-        Arrays.sort(enabledKeyboardLayouts);
-
-        for (Map.Entry<CheckBoxPreference, KeyboardLayout> entry : mPreferenceMap.entrySet()) {
-            entry.getKey().setChecked(Arrays.binarySearch(enabledKeyboardLayouts,
-                    entry.getValue().getDescriptor()) >= 0);
-        }
-    }
 }
diff --git a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment2.java b/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment2.java
deleted file mode 100644
index 2e43a57..0000000
--- a/src/com/android/settings/inputmethod/KeyboardLayoutPickerFragment2.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-package com.android.settings.inputmethod;
-
-import android.annotation.Nullable;
-import android.app.Activity;
-import android.hardware.input.InputDeviceIdentifier;
-import android.hardware.input.InputManager;
-import android.hardware.input.InputManager.InputDeviceListener;
-import android.hardware.input.KeyboardLayout;
-import android.os.Bundle;
-import android.support.v7.preference.Preference;
-import android.support.v7.preference.PreferenceScreen;
-import android.view.InputDevice;
-
-import android.view.inputmethod.InputMethodInfo;
-import android.view.inputmethod.InputMethodSubtype;
-import com.android.internal.logging.MetricsLogger;
-import com.android.internal.logging.MetricsProto.MetricsEvent;
-import com.android.internal.util.Preconditions;
-import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.inputmethod.PhysicalKeyboardFragment.KeyboardInfoPreference;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-public final class KeyboardLayoutPickerFragment2 extends SettingsPreferenceFragment
-        implements InputDeviceListener {
-
-    private InputDeviceIdentifier mInputDeviceIdentifier;
-    private int mInputDeviceId = -1;
-    private InputManager mIm;
-    private InputMethodInfo mImi;
-    @Nullable
-    private InputMethodSubtype mSubtype;
-    private KeyboardLayout[] mKeyboardLayouts;
-    private Map<Preference, KeyboardLayout> mPreferenceMap = new HashMap<>();
-
-    // TODO: Make these constants public API for b/25752827
-
-    /**
-     * Intent extra: The input device descriptor of the keyboard whose keyboard
-     * layout is to be changed.
-     */
-    public static final String EXTRA_INPUT_DEVICE_IDENTIFIER = "input_device_identifier";
-
-    /**
-     * Intent extra: The associated {@link InputMethodInfo}.
-     */
-    public static final String EXTRA_INPUT_METHOD_INFO = "input_method_info";
-
-    /**
-     * Intent extra: The associated {@link InputMethodSubtype}.
-     */
-    public static final String EXTRA_INPUT_METHOD_SUBTYPE = "input_method_subtype";
-
-    @Override
-    public int getMetricsCategory() {
-        return MetricsEvent.INPUTMETHOD_KEYBOARD;
-    }
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        Activity activity = Preconditions.checkNotNull(getActivity());
-
-        mInputDeviceIdentifier = activity.getIntent().getParcelableExtra(
-                EXTRA_INPUT_DEVICE_IDENTIFIER);
-        mImi = activity.getIntent().getParcelableExtra(EXTRA_INPUT_METHOD_INFO);
-        mSubtype = activity.getIntent().getParcelableExtra(EXTRA_INPUT_METHOD_SUBTYPE);
-
-        if (mInputDeviceIdentifier == null || mImi == null) {
-            activity.finish();
-        }
-
-        mIm = activity.getSystemService(InputManager.class);
-        mKeyboardLayouts = mIm.getKeyboardLayoutsForInputDevice(mInputDeviceIdentifier);
-        Arrays.sort(mKeyboardLayouts);
-        setPreferenceScreen(createPreferenceHierarchy());
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
-        mIm.registerInputDeviceListener(this, null);
-
-        InputDevice inputDevice =
-                mIm.getInputDeviceByDescriptor(mInputDeviceIdentifier.getDescriptor());
-        if (inputDevice == null) {
-            getActivity().finish();
-            return;
-        }
-        mInputDeviceId = inputDevice.getId();
-    }
-
-    @Override
-    public void onPause() {
-        mIm.unregisterInputDeviceListener(this);
-        mInputDeviceId = -1;
-
-        super.onPause();
-    }
-
-    @Override
-    public boolean onPreferenceTreeClick(Preference preference) {
-        KeyboardLayout layout = mPreferenceMap.get(preference);
-        if (layout != null) {
-            mIm.setKeyboardLayoutForInputDevice(mInputDeviceIdentifier, mImi, mSubtype,
-                    layout.getDescriptor());
-            getActivity().finish();
-            return true;
-        }
-        return super.onPreferenceTreeClick(preference);
-    }
-
-    @Override
-    public void onInputDeviceAdded(int deviceId) {}
-
-    @Override
-    public void onInputDeviceChanged(int deviceId) {}
-
-    @Override
-    public void onInputDeviceRemoved(int deviceId) {
-        if (mInputDeviceId >= 0 && deviceId == mInputDeviceId) {
-            getActivity().finish();
-        }
-    }
-
-    private PreferenceScreen createPreferenceHierarchy() {
-        PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getActivity());
-
-        for (KeyboardLayout layout : mKeyboardLayouts) {
-            Preference pref = new Preference(getPrefContext());
-            pref.setTitle(layout.getLabel());
-            pref.setSummary(layout.getCollection());
-            root.addPreference(pref);
-            mPreferenceMap.put(pref, layout);
-        }
-
-        root.setTitle(KeyboardInfoPreference.getDisplayName(getContext(), mImi, mSubtype));
-        return root;
-    }
-}
diff --git a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
index bca656a..f0fdc08 100644
--- a/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
+++ b/src/com/android/settings/inputmethod/PhysicalKeyboardFragment.java
@@ -225,10 +225,10 @@
             @Nullable InputMethodSubtype imSubtype) {
         final Intent intent = new Intent(Intent.ACTION_MAIN);
         intent.setClass(getActivity(), Settings.KeyboardLayoutPickerActivity.class);
-        intent.putExtra(KeyboardLayoutPickerFragment2.EXTRA_INPUT_DEVICE_IDENTIFIER,
+        intent.putExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_DEVICE_IDENTIFIER,
                 inputDeviceIdentifier);
-        intent.putExtra(KeyboardLayoutPickerFragment2.EXTRA_INPUT_METHOD_INFO, imi);
-        intent.putExtra(KeyboardLayoutPickerFragment2.EXTRA_INPUT_METHOD_SUBTYPE, imSubtype);
+        intent.putExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_METHOD_INFO, imi);
+        intent.putExtra(KeyboardLayoutPickerFragment.EXTRA_INPUT_METHOD_SUBTYPE, imSubtype);
         startActivity(intent);
     }
 
