diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index e95eec0..466e941 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -603,35 +603,6 @@
                 android:resource="@id/display_settings" />
         </activity-alias>
 
-        <activity android:name="Settings$DockSettingsActivity"
-                android:label="@string/dock_settings_title"
-                android:enabled="@bool/has_dock_settings"
-                android:taskAffinity="com.android.settings"
-                android:parentActivityName="Settings">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <action android:name="com.android.settings.DOCK_SETTINGS" />
-                <category android:name="android.intent.category.DEFAULT" />
-                <category android:name="android.intent.category.VOICE_LAUNCH" />
-            </intent-filter>
-            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.DockSettings" />
-            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
-                android:resource="@id/dock_settings" />
-        </activity>
-
-        <!-- Keep compatibility with old shortcuts. -->
-        <activity-alias android:name="DockSettings"
-                android:label="@string/dock_settings_title"
-                android:enabled="@bool/has_dock_settings"
-                android:exported="true"
-                android:targetActivity="Settings$DockSettingsActivity">
-            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.DockSettings" />
-            <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
-                android:resource="@id/dock_settings" />
-        </activity-alias>
-
         <activity android:name="Settings$DeviceInfoSettingsActivity"
                 android:theme="@android:style/Theme.Holo.DialogWhenLarge"
                 android:label="@string/device_info_settings"
diff --git a/res/xml/dock_settings.xml b/res/xml/dock_settings.xml
deleted file mode 100644
index 177da9f..0000000
--- a/res/xml/dock_settings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<PreferenceScreen
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
-    android:title="@string/dock_settings_title"
-    android:key="parent">
-
-    <PreferenceScreen
-        android:key="dock_audio"
-        android:title="@string/dock_audio_settings_title"
-        android:summary="@string/dock_settings_summary" />
-
-    <CheckBoxPreference
-        android:key="dock_sounds"
-        android:title="@string/dock_sounds_enable_title"
-        android:summaryOn="@string/dock_sounds_enable_summary_on"
-        android:summaryOff="@string/dock_sounds_enable_summary_off"
-        android:defaultValue="false" />
-
-</PreferenceScreen>
diff --git a/res/xml/settings_headers.xml b/res/xml/settings_headers.xml
index c426a0d..6251590 100644
--- a/res/xml/settings_headers.xml
+++ b/res/xml/settings_headers.xml
@@ -161,13 +161,6 @@
     <header android:id="@+id/system_section"
         android:title="@string/header_category_system" />
 
-    <!-- Dock -->
-    <header
-        android:id="@+id/dock_settings"
-        android:fragment="com.android.settings.DockSettings"
-        android:icon="@drawable/ic_settings_dock"
-        android:title="@string/dock_settings" />
-
     <!-- Date & Time -->
     <header
         android:id="@+id/date_time_settings"
diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml
index 6da9734..dda596a 100644
--- a/res/xml/sound_settings.xml
+++ b/res/xml/sound_settings.xml
@@ -88,4 +88,19 @@
             android:entries="@array/emergency_tone_entries"
             android:entryValues="@array/emergency_tone_values" />
 
+    <!-- Dock -->
+    <PreferenceCategory
+        android:key="dock_category"
+        android:title="@string/dock_settings"/>
+
+    <!-- Do not nest these, or removals in code will break -->
+    <PreferenceScreen
+        android:key="dock_audio"
+        android:title="@string/dock_audio_settings_title" />
+
+    <CheckBoxPreference
+        android:key="dock_sounds"
+        android:title="@string/dock_sounds_enable_title"
+        android:defaultValue="false" />
+
 </PreferenceScreen>
diff --git a/src/com/android/settings/DockSettings.java b/src/com/android/settings/DockSettings.java
deleted file mode 100644
index 1d3e2dd..0000000
--- a/src/com/android/settings/DockSettings.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 2010 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;
-
-import com.android.settings.bluetooth.DockEventReceiver;
-
-import android.app.AlertDialog;
-import android.app.Dialog;
-import android.bluetooth.BluetoothDevice;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.preference.CheckBoxPreference;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.provider.Settings;
-
-public class DockSettings extends SettingsPreferenceFragment {
-
-    private static final int DIALOG_NOT_DOCKED = 1;
-    private static final String KEY_AUDIO_SETTINGS = "dock_audio";
-    private static final String KEY_DOCK_SOUNDS = "dock_sounds";
-    private Preference mAudioSettings;
-    private CheckBoxPreference mDockSounds;
-    private Intent mDockIntent;
-
-    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) {
-                handleDockChange(intent);
-            }
-        }
-    };
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        addPreferencesFromResource(R.xml.dock_settings);
-
-        initDockSettings();
-    }
-
-    @Override
-    public void onResume() {
-        super.onResume();
-
-        IntentFilter filter = new IntentFilter(Intent.ACTION_DOCK_EVENT);
-        getActivity().registerReceiver(mReceiver, filter);
-    }
-
-    @Override
-    public void onPause() {
-        super.onPause();
-
-        getActivity().unregisterReceiver(mReceiver);
-    }
-
-    private void initDockSettings() {
-        ContentResolver resolver = getContentResolver();
-
-        mAudioSettings = findPreference(KEY_AUDIO_SETTINGS);
-        if (mAudioSettings != null) {
-            mAudioSettings.setSummary(R.string.dock_audio_summary_none);
-        }
-
-        mDockSounds = (CheckBoxPreference) findPreference(KEY_DOCK_SOUNDS);
-        mDockSounds.setPersistent(false);
-        mDockSounds.setChecked(Settings.System.getInt(resolver,
-                Settings.System.DOCK_SOUNDS_ENABLED, 0) != 0);
-    }
-
-    private void handleDockChange(Intent intent) {
-        if (mAudioSettings != null) {
-            int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);
-
-            boolean isBluetooth = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null;
-
-            if (!isBluetooth) {
-                // No dock audio if not on Bluetooth.
-                mAudioSettings.setEnabled(false);
-                mAudioSettings.setSummary(R.string.dock_audio_summary_unknown);
-            } else {
-                mAudioSettings.setEnabled(true);
-
-                mDockIntent = intent;
-                int resId = R.string.dock_audio_summary_unknown;
-                switch (dockState) {
-                case Intent.EXTRA_DOCK_STATE_CAR:
-                    resId = R.string.dock_audio_summary_car;
-                    break;
-                case Intent.EXTRA_DOCK_STATE_DESK:
-                case Intent.EXTRA_DOCK_STATE_LE_DESK:
-                case Intent.EXTRA_DOCK_STATE_HE_DESK:
-                    resId = R.string.dock_audio_summary_desk;
-                    break;
-                case Intent.EXTRA_DOCK_STATE_UNDOCKED:
-                    resId = R.string.dock_audio_summary_none;
-                }
-                mAudioSettings.setSummary(resId);
-            }
-
-            if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
-                // remove undocked dialog if currently showing.
-                try {
-                    removeDialog(DIALOG_NOT_DOCKED);
-                } catch (IllegalArgumentException iae) {
-                    // Maybe it was already dismissed
-                }
-            }
-        }
-    }
-
-    @Override
-    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
-        if (preference == mAudioSettings) {
-            int dockState = mDockIntent != null
-                    ? mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0)
-                    : Intent.EXTRA_DOCK_STATE_UNDOCKED;
-            if (dockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
-                showDialog(DIALOG_NOT_DOCKED);
-            } else {
-                Intent i = new Intent(mDockIntent);
-                i.setAction(DockEventReceiver.ACTION_DOCK_SHOW_UI);
-                i.setClass(getActivity(), DockEventReceiver.class);
-                getActivity().sendBroadcast(i);
-            }
-        } else if (preference == mDockSounds) {
-            Settings.System.putInt(getContentResolver(), Settings.System.DOCK_SOUNDS_ENABLED,
-                    mDockSounds.isChecked() ? 1 : 0);
-        }
-
-        return true;
-    }
-
-    @Override
-    public Dialog onCreateDialog(int id) {
-        if (id == DIALOG_NOT_DOCKED) {
-            return createUndockedMessage();
-        }
-        return null;
-    }
-
-    private Dialog createUndockedMessage() {
-        final AlertDialog.Builder ab = new AlertDialog.Builder(getActivity());
-        ab.setTitle(R.string.dock_not_found_title);
-        ab.setMessage(R.string.dock_not_found_text);
-        ab.setPositiveButton(android.R.string.ok, null);
-        return ab.create();
-    }
-}
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index b69e648..34209ae 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -388,10 +388,7 @@
             Header header = target.get(i);
             // Ids are integers, so downcasting
             int id = (int) header.id;
-            if (id == R.id.dock_settings) {
-                if (!needsDockSettings())
-                    target.remove(header);
-            } else if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
+            if (id == R.id.operator_settings || id == R.id.manufacturer_settings) {
                 Utils.updateHeaderToSpecificActivityFromMetaDataOrRemove(this, target, header);
             } else if (id == R.id.wifi_settings) {
                 // Remove WiFi Settings if WiFi service is not available.
@@ -503,10 +500,6 @@
         return headerIndex;
     }
 
-    private boolean needsDockSettings() {
-        return getResources().getBoolean(R.bool.has_dock_settings);
-    }
-
     private void getMetaData() {
         try {
             ActivityInfo ai = getPackageManager().getActivityInfo(getComponentName(),
@@ -783,7 +776,6 @@
     public static class SecuritySettingsActivity extends Settings { /* empty */ }
     public static class LocationSettingsActivity extends Settings { /* empty */ }
     public static class PrivacySettingsActivity extends Settings { /* empty */ }
-    public static class DockSettingsActivity extends Settings { /* empty */ }
     public static class RunningServicesActivity extends Settings { /* empty */ }
     public static class ManageAccountsSettingsActivity extends Settings { /* empty */ }
     public static class PowerUsageSummaryActivity extends Settings { /* empty */ }
diff --git a/src/com/android/settings/SoundSettings.java b/src/com/android/settings/SoundSettings.java
index 67557b9..814ea46 100644
--- a/src/com/android/settings/SoundSettings.java
+++ b/src/com/android/settings/SoundSettings.java
@@ -16,9 +16,16 @@
 
 package com.android.settings;
 
+import com.android.settings.bluetooth.DockEventReceiver;
+
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.bluetooth.BluetoothDevice;
+import android.content.BroadcastReceiver;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.database.Cursor;
@@ -47,6 +54,8 @@
         Preference.OnPreferenceChangeListener {
     private static final String TAG = "SoundSettings";
 
+    private static final int DIALOG_NOT_DOCKED = 1;
+
     /** If there is no setting in the provider, use this. */
     private static final int FALLBACK_EMERGENCY_TONE_VALUE = 0;
 
@@ -62,6 +71,9 @@
     private static final String KEY_RINGTONE = "ringtone";
     private static final String KEY_NOTIFICATION_SOUND = "notification_sound";
     private static final String KEY_CATEGORY_CALLS = "category_calls_and_notification";
+    private static final String KEY_DOCK_CATEGORY = "dock_category";
+    private static final String KEY_AUDIO_SETTINGS = "dock_audio";
+    private static final String KEY_DOCK_SOUNDS = "dock_sounds";
 
     private static final String[] NEED_VOICE_CAPABILITY = {
             KEY_RINGTONE, KEY_DTMF_TONE, KEY_CATEGORY_CALLS,
@@ -84,6 +96,10 @@
 
     private AudioManager mAudioManager;
 
+    private Preference mDockAudioSettings;
+    private CheckBoxPreference mDockSounds;
+    private Intent mDockIntent;
+
     private Handler mHandler = new Handler() {
         public void handleMessage(Message msg) {
             switch (msg.what) {
@@ -97,6 +113,15 @@
         }
     };
 
+    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (intent.getAction().equals(Intent.ACTION_DOCK_EVENT)) {
+                handleDockChange(intent);
+            }
+        }
+    };
+
     private PreferenceGroup mSoundSettings;
 
     @Override
@@ -193,6 +218,8 @@
                 }
             }
         };
+
+        initDockSettings();
     }
 
     @Override
@@ -200,6 +227,16 @@
         super.onResume();
 
         lookupRingtoneNames();
+
+        IntentFilter filter = new IntentFilter(Intent.ACTION_DOCK_EVENT);
+        getActivity().registerReceiver(mReceiver, filter);
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+
+        getActivity().unregisterReceiver(mReceiver);
     }
 
     private void updateRingtoneName(int type, Preference preference, int msg) {
@@ -262,8 +299,22 @@
         } else if (preference == mMusicFx) {
             // let the framework fire off the intent
             return false;
+        } else if (preference == mDockAudioSettings) {
+            int dockState = mDockIntent != null
+                    ? mDockIntent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0)
+                    : Intent.EXTRA_DOCK_STATE_UNDOCKED;
+            if (dockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+                showDialog(DIALOG_NOT_DOCKED);
+            } else {
+                Intent i = new Intent(mDockIntent);
+                i.setAction(DockEventReceiver.ACTION_DOCK_SHOW_UI);
+                i.setClass(getActivity(), DockEventReceiver.class);
+                getActivity().sendBroadcast(i);
+            }
+        } else if (preference == mDockSounds) {
+            Settings.System.putInt(getContentResolver(), Settings.System.DOCK_SOUNDS_ENABLED,
+                    mDockSounds.isChecked() ? 1 : 0);
         }
-
         return true;
     }
 
@@ -286,4 +337,68 @@
     protected int getHelpResource() {
         return R.string.help_url_sound;
     }
+
+    private boolean needsDockSettings() {
+        return getResources().getBoolean(R.bool.has_dock_settings);
+    }
+
+    private void initDockSettings() {
+        if (needsDockSettings()) {
+
+            ContentResolver resolver = getContentResolver();
+
+            mDockAudioSettings = findPreference(KEY_AUDIO_SETTINGS);
+
+            mDockSounds = (CheckBoxPreference) findPreference(KEY_DOCK_SOUNDS);
+            mDockSounds.setPersistent(false);
+            mDockSounds.setChecked(Settings.System.getInt(resolver,
+                    Settings.System.DOCK_SOUNDS_ENABLED, 0) != 0);
+        } else {
+            getPreferenceScreen().removePreference(findPreference(KEY_DOCK_CATEGORY));
+            getPreferenceScreen().removePreference(findPreference(KEY_AUDIO_SETTINGS));
+            getPreferenceScreen().removePreference(findPreference(KEY_DOCK_SOUNDS));
+        }
+    }
+
+    private void handleDockChange(Intent intent) {
+        if (mDockAudioSettings != null) {
+            int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);
+
+            boolean isBluetooth = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null;
+
+            if (!isBluetooth) {
+                // No dock audio if not on Bluetooth.
+                mDockAudioSettings.setEnabled(false);
+            } else {
+                mDockAudioSettings.setEnabled(true);
+                mDockIntent = intent;
+            }
+
+            if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
+                // remove undocked dialog if currently showing.
+                try {
+                    removeDialog(DIALOG_NOT_DOCKED);
+                } catch (IllegalArgumentException iae) {
+                    // Maybe it was already dismissed
+                }
+            }
+        }
+    }
+
+    @Override
+    public Dialog onCreateDialog(int id) {
+        if (id == DIALOG_NOT_DOCKED) {
+            return createUndockedMessage();
+        }
+        return null;
+    }
+
+    private Dialog createUndockedMessage() {
+        final AlertDialog.Builder ab = new AlertDialog.Builder(getActivity());
+        ab.setTitle(R.string.dock_not_found_title);
+        ab.setMessage(R.string.dock_not_found_text);
+        ab.setPositiveButton(android.R.string.ok, null);
+        return ab.create();
+    }
 }
+
