diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 66c9bfd..4729785 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -457,7 +457,7 @@
         <!-- Provide direct entry into manage apps showing running services. -->
         <activity-alias android:name=".RunningServices"
                 android:label="@string/runningservices_settings_title"
-            android:targetActivity=".applications.ManageApplications">
+                android:targetActivity="Settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -470,7 +470,7 @@
         <!-- Provide direct entry into manage apps showing running services. -->
         <activity-alias android:name=".applications.StorageUse"
                 android:label="@string/storageuse_settings_title"
-            android:targetActivity=".applications.ManageApplications">
+                android:targetActivity="Settings">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.DEFAULT" />
@@ -480,11 +480,6 @@
             </intent-filter>
         </activity-alias>
 
-        <activity android:name=".applications.RunningServiceDetails"
-                android:theme="@android:style/Theme.NoTitleBar"
-                android:label="@string/runningservicedetails_settings_title">
-        </activity>
-
         <activity-alias android:name="SecuritySettings"
                 android:label="@string/location_security_settings_title"
                 android:configChanges="orientation|keyboardHidden"
@@ -686,15 +681,17 @@
             </intent-filter>
         </activity>
 
-        <activity android:name="DevelopmentSettings"
-                android:label="@string/development_settings_title">
+        <activity-alias android:name="DevelopmentSettings"
+                android:label="@string/development_settings_title"
+                android:targetActivity="Settings"
+                android:clearTaskOnLaunch="true"
+                >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-        </activity>
-
+        </activity-alias>
 
 
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d510018..2d1a599 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -999,14 +999,6 @@
     <!-- Wi-Fi Advanced Settings --> <skip />
     <!-- Wi-Fi settings screen, advanced, settings section.  This is a header shown above advanced wifi settings. -->
     <string name="wifi_advanced_titlebar">Advanced</string>
-    <!-- Wi-Fi settings screen, setting title for choosing the number of channels to be used -->
-    <string name="wifi_setting_num_channels_title">Regulatory domain</string>
-    <!-- Wi-Fi settings screen, setting summary for choosing the number of channels to be used -->
-    <string name="wifi_setting_num_channels_summary">Set the number of channels to use</string>
-    <!-- Wi-Fi settings screen, generic error message when the regulatory domain could not be set. -->
-    <string name="wifi_setting_num_channels_error">There was a problem setting the regulatory domain.</string>
-    <!-- Wi-Fi settings screen, label to be appended to the count in displaying the list of valid channel counts -->
-    <string name="wifi_setting_num_channels_channel_phrase"><xliff:g id="num_channels">%1$d</xliff:g> channels</string>
     <!-- Wi-Fi settings screen, setting title for setting the wifi sleep policy -->
     <string name="wifi_setting_sleep_policy_title">Wi-Fi sleep policy</string>
     <!-- Wi-Fi settings screen, setting summary for setting the wifi sleep policy -->
diff --git a/res/xml/application_settings.xml b/res/xml/application_settings.xml
index 6cd0b62..76fa0bc 100644
--- a/res/xml/application_settings.xml
+++ b/res/xml/application_settings.xml
@@ -44,25 +44,24 @@
     </PreferenceScreen>
         
     <PreferenceScreen
-        android:fragment="com.android.settings.applications.ManageApplications"
-        android:title="@string/manageapplications_settings_title"
-        android:summary="@string/manageapplications_settings_summary">
+            android:fragment="com.android.settings.applications.ManageApplications"
+            android:title="@string/manageapplications_settings_title"
+            android:summary="@string/manageapplications_settings_summary">
     </PreferenceScreen>
 
     <PreferenceScreen
+            android:fragment="com.android.settings.applications.ManageApplications"
             android:title="@string/runningservices_settings_title"
             android:summary="@string/runningservices_settings_summary">
-        <intent android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.RunningServices" />
+        <extra android:name="classname" android:value="com.android.settings.RunningServices" />
     </PreferenceScreen>
 
     <PreferenceScreen
+            android:fragment="com.android.settings.applications.ManageApplications"
             android:title="@string/storageuse_settings_title"
             android:summary="@string/storageuse_settings_summary">
-        <intent android:action="android.intent.action.MAIN"
-                android:targetPackage="com.android.settings"
-                android:targetClass="com.android.settings.applications.StorageUse" />
+        <extra android:name="classname"
+                android:value="com.android.settings.applications.StorageUse" />
     </PreferenceScreen>
 
     <PreferenceScreen
diff --git a/res/xml/wifi_advanced_settings.xml b/res/xml/wifi_advanced_settings.xml
index 8496428..7ccd588 100644
--- a/res/xml/wifi_advanced_settings.xml
+++ b/res/xml/wifi_advanced_settings.xml
@@ -18,13 +18,6 @@
         android:title="@string/wifi_advanced_titlebar">
 
     <ListPreference
-            android:key="num_channels"
-            android:title="@string/wifi_setting_num_channels_title"
-            android:summary="@string/wifi_setting_num_channels_summary"
-            android:persistent="false"
-            />
-    
-    <ListPreference
             android:key="sleep_policy"
             android:title="@string/wifi_setting_sleep_policy_title"
             android:summary="@string/wifi_setting_sleep_policy_summary"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index b0e5c07..c9c9263 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -18,21 +18,20 @@
 
 import android.app.AlertDialog;
 import android.app.Dialog;
+import android.content.ContentResolver;
 import android.content.DialogInterface;
 import android.os.BatteryManager;
 import android.os.Bundle;
-import android.os.SystemProperties;
 import android.preference.Preference;
-import android.preference.PreferenceActivity;
+import android.preference.PreferenceFragment;
 import android.preference.PreferenceScreen;
 import android.preference.CheckBoxPreference;
 import android.provider.Settings;
-import android.text.TextUtils;
 
 /*
  * Displays preferences for application developers.
  */
-public class DevelopmentSettings extends PreferenceActivity
+public class DevelopmentSettings extends PreferenceFragment
         implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener {
 
     private static final String ENABLE_ADB = "enable_adb";
@@ -49,7 +48,7 @@
     private Dialog mOkDialog;
 
     @Override
-    protected void onCreate(Bundle icicle) {
+    public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
 
         addPreferencesFromResource(R.xml.development_prefs);
@@ -60,14 +59,15 @@
     }
 
     @Override
-    protected void onResume() {
+    public void onResume() {
         super.onResume();
 
-        mEnableAdb.setChecked(Settings.Secure.getInt(getContentResolver(),
+        final ContentResolver cr = getActivity().getContentResolver();
+        mEnableAdb.setChecked(Settings.Secure.getInt(cr,
                 Settings.Secure.ADB_ENABLED, 0) != 0);
-        mKeepScreenOn.setChecked(Settings.System.getInt(getContentResolver(),
+        mKeepScreenOn.setChecked(Settings.System.getInt(cr,
                 Settings.System.STAY_ON_WHILE_PLUGGED_IN, 0) != 0);
-        mAllowMockLocation.setChecked(Settings.Secure.getInt(getContentResolver(),
+        mAllowMockLocation.setChecked(Settings.Secure.getInt(cr,
                 Settings.Secure.ALLOW_MOCK_LOCATION, 0) != 0);
     }
 
@@ -82,8 +82,8 @@
             if (mEnableAdb.isChecked()) {
                 mOkClicked = false;
                 if (mOkDialog != null) dismissDialog();
-                mOkDialog = new AlertDialog.Builder(this).setMessage(
-                        getResources().getString(R.string.adb_warning_message))
+                mOkDialog = new AlertDialog.Builder(getActivity()).setMessage(
+                        getActivity().getResources().getString(R.string.adb_warning_message))
                         .setTitle(R.string.adb_warning_title)
                         .setIcon(android.R.drawable.ic_dialog_alert)
                         .setPositiveButton(android.R.string.yes, this)
@@ -91,14 +91,17 @@
                         .show();
                 mOkDialog.setOnDismissListener(this);
             } else {
-                Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 0);
+                Settings.Secure.putInt(getActivity().getContentResolver(),
+                        Settings.Secure.ADB_ENABLED, 0);
             }
         } else if (preference == mKeepScreenOn) {
-            Settings.System.putInt(getContentResolver(), Settings.System.STAY_ON_WHILE_PLUGGED_IN, 
+            Settings.System.putInt(getActivity().getContentResolver(),
+                    Settings.System.STAY_ON_WHILE_PLUGGED_IN, 
                     mKeepScreenOn.isChecked() ? 
                     (BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
         } else if (preference == mAllowMockLocation) {
-            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ALLOW_MOCK_LOCATION,
+            Settings.Secure.putInt(getActivity().getContentResolver(),
+                    Settings.Secure.ALLOW_MOCK_LOCATION,
                     mAllowMockLocation.isChecked() ? 1 : 0);
         }
 
@@ -114,7 +117,8 @@
     public void onClick(DialogInterface dialog, int which) {
         if (which == DialogInterface.BUTTON_POSITIVE) {
             mOkClicked = true;
-            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ADB_ENABLED, 1);
+            Settings.Secure.putInt(getActivity().getContentResolver(),
+                    Settings.Secure.ADB_ENABLED, 1);
         } else {
             // Reset the toggle
             mEnableAdb.setChecked(false);
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index b428928..3a6e6d8 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -56,7 +56,9 @@
         String intentClass = intent.getComponent().getClassName();
         if (intentClass.equals(getClass().getName())) return null;
 
-        if ("com.android.settings.ManageApplications".equals(intentClass)) {
+        if ("com.android.settings.ManageApplications".equals(intentClass)
+                || "com.android.settings.RunningServices".equals(intentClass)
+                || "com.android.settings.applications.StorageUse".equals(intentClass)) {
             // Old name of manage apps.
             intentClass = com.android.settings.applications.ManageApplications.class.getName();
         }
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index cb5fbed..1d46ed0 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -40,9 +40,11 @@
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Bundle;
+import android.os.Environment;
 import android.os.Handler;
 import android.os.Message;
 import android.os.RemoteException;
+import android.preference.PreferenceActivity;
 import android.text.format.Formatter;
 import android.util.Log;
 
@@ -222,6 +224,10 @@
     }
 
     private void initMoveButton() {
+        if (Environment.isExternalStorageEmulated()) {
+            mMoveAppButton.setVisibility(View.INVISIBLE);
+            return;
+        }
         boolean dataOnly = false;
         dataOnly = (mPackageInfo == null) && (mAppEntry != null);
         boolean moveDisable = true;
@@ -470,13 +476,8 @@
         if(localLOGV) Log.i(TAG, "appChanged="+appChanged);
         Intent intent = new Intent();
         intent.putExtra(ManageApplications.APP_CHG, appChanged);
-        Fragment target = getTargetFragment();
-        if (target != null) {
-            target.onActivityResult(getTargetRequestCode(), Activity.RESULT_OK, intent);
-        }
-        if (finish) {
-            getActivity().onBackPressed();
-        }
+        PreferenceActivity pa = (PreferenceActivity)getActivity();
+        pa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
     }
     
     private void refreshSizeInfo() {
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java
index 217e333..20cf2f9 100644
--- a/src/com/android/settings/applications/ManageApplications.java
+++ b/src/com/android/settings/applications/ManageApplications.java
@@ -21,14 +21,11 @@
 import com.android.settings.applications.ApplicationsState.AppEntry;
 
 import android.app.Fragment;
-import android.app.TabActivity;
 import android.content.Context;
-import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.IPackageManager;
 import android.content.pm.PackageInfo;
-import android.net.Uri;
 import android.os.Bundle;
 import android.os.Environment;
 import android.os.RemoteException;
@@ -38,14 +35,12 @@
 import android.provider.Settings;
 import android.text.format.Formatter;
 import android.util.Log;
-import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.Window;
 import android.view.animation.AnimationUtils;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.AbsListView;
@@ -57,7 +52,6 @@
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TabHost;
-import android.widget.TabWidget;
 import android.widget.TextView;
 import android.widget.AdapterView.OnItemClickListener;
 
@@ -167,6 +161,8 @@
     TextView mUsedStorageText;
     TextView mFreeStorageText;
 
+    private Menu mOptionsMenu;
+    
     // These are for keeping track of activity and tab switch state.
     private int mCurView;
     private boolean mCreatedRunning;
@@ -518,11 +514,14 @@
         Intent intent = getActivity().getIntent();
         String action = intent.getAction();
         String defaultTabTag = TAB_DOWNLOADED;
-        if (intent.getComponent().getClassName().equals(
-                "com.android.settings.RunningServices")) {
+        String className = getArguments() != null
+                ? getArguments().getString("classname") : null;
+        if (className == null) {
+            className = intent.getComponent().getClassName();
+        }
+        if (className.equals("com.android.settings.RunningServices")) {
             defaultTabTag = TAB_RUNNING;
-        } else if (intent.getComponent().getClassName().equals(
-                "com.android.settings.applications.StorageUse")
+        } else if (className.equals("com.android.settings.applications.StorageUse")
                 || action.equals(Intent.ACTION_MANAGE_PACKAGE_STORAGE)) {
             mSortOrder = SORT_ORDER_SIZE;
             mFilterApps = FILTER_APPS_ALL;
@@ -577,6 +576,8 @@
         mRunningProcessesView = (RunningProcessesView)mRootView.findViewById(
                 R.id.running_processes);
 
+        mCreatedRunning = mResumedRunning = false;
+        
         View tabRoot = mInflater.inflate(com.android.internal.R.layout.tab_content, null);
         mTabHost = (TabHost)tabRoot.findViewById(com.android.internal.R.id.tabhost);
         mTabHost.setup();
@@ -589,10 +590,12 @@
                 .setIndicator(getActivity().getString(R.string.filter_apps_all),
                         getActivity().getResources().getDrawable(R.drawable.ic_tab_all))
                 .setContent(this));
-        tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD)
-                .setIndicator(getActivity().getString(R.string.filter_apps_onsdcard),
-                        getActivity().getResources().getDrawable(R.drawable.ic_tab_sdcard))
-                .setContent(this));
+        if (!Environment.isExternalStorageEmulated()) {
+            tabHost.addTab(tabHost.newTabSpec(TAB_SDCARD)
+                    .setIndicator(getActivity().getString(R.string.filter_apps_onsdcard),
+                            getActivity().getResources().getDrawable(R.drawable.ic_tab_sdcard))
+                    .setContent(this));
+        }
         tabHost.addTab(tabHost.newTabSpec(TAB_RUNNING)
                 .setIndicator(getActivity().getString(R.string.filter_apps_running),
                         getActivity().getResources().getDrawable(R.drawable.ic_tab_running))
@@ -613,6 +616,7 @@
         super.onResume();
         mActivityResumed = true;
         showCurrentTab();
+        updateOptionsMenu();
     }
 
     @Override
@@ -620,8 +624,8 @@
         super.onSaveInstanceState(outState);
         outState.putInt("sortOrder", mSortOrder);
         outState.putInt("filterApps", mFilterApps);
-        if (mTabHost != null) {
-            outState.putString("defautTabTag", mTabHost.getCurrentTabTag());
+        if (mDefaultTab != null) {
+            outState.putString("defautTabTag", mDefaultTab);
         }
     }
 
@@ -645,52 +649,63 @@
     
     // utility method used to start sub activity
     private void startApplicationDetailsActivity() {
-        // Create intent to start new activity
-        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
-                Uri.fromParts("package", mCurrentPkgName, null));
         // start new fragment to display extended information
         Bundle args = new Bundle();
         args.putString(InstalledAppDetails.ARG_PACKAGE_NAME, mCurrentPkgName);
 
         PreferenceActivity pa = (PreferenceActivity)getActivity();
-        if (pa.isMultiPane()) {
-            Fragment frag = new InstalledAppDetails();
-            frag.setTargetFragment(this, INSTALLED_APP_DETAILS);
-            frag.setArguments(args);
-            frag.setTargetFragment(this, INSTALLED_APP_DETAILS);
-            pa.startPreferenceFragment(frag, true);
-        } else {
-            pa.startWithFragment(InstalledAppDetails.class.getName(), args);
-        }
+        pa.startPreferencePanel(InstalledAppDetails.class.getName(), args,
+                R.string.application_info_label, null, this, INSTALLED_APP_DETAILS);
     }
     
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
+        Log.i(TAG, "onCreateOptionsMenu in " + this + ": " + menu);
+        mOptionsMenu = menu;
         menu.add(0, SORT_ORDER_ALPHA, 1, R.string.sort_order_alpha)
-                .setIcon(android.R.drawable.ic_menu_sort_alphabetically);
+                .setIcon(android.R.drawable.ic_menu_sort_alphabetically)
+                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
         menu.add(0, SORT_ORDER_SIZE, 2, R.string.sort_order_size)
-                .setIcon(android.R.drawable.ic_menu_sort_by_size); 
-        menu.add(0, SHOW_RUNNING_SERVICES, 3, R.string.show_running_services);
-        menu.add(0, SHOW_BACKGROUND_PROCESSES, 3, R.string.show_background_processes);
+                .setIcon(android.R.drawable.ic_menu_sort_by_size)
+                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+        menu.add(0, SHOW_RUNNING_SERVICES, 3, R.string.show_running_services)
+                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+        menu.add(0, SHOW_BACKGROUND_PROCESSES, 3, R.string.show_background_processes)
+                .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
+        updateOptionsMenu();
     }
     
     @Override
     public void onPrepareOptionsMenu(Menu menu) {
+        updateOptionsMenu();
+    }
+    
+    @Override
+    public void onDestroyOptionsMenu() {
+        mOptionsMenu = null;
+    }
+    
+    void updateOptionsMenu() {
+        if (mOptionsMenu == null) {
+            return;
+        }
+        
         /*
          * The running processes screen doesn't use the mApplicationsAdapter
          * so bringing up this menu in that case doesn't make any sense.
          */
         if (mCurView == VIEW_RUNNING) {
-            boolean showingBackground = mRunningProcessesView.mAdapter.getShowBackground();
-            menu.findItem(SORT_ORDER_ALPHA).setVisible(false);
-            menu.findItem(SORT_ORDER_SIZE).setVisible(false);
-            menu.findItem(SHOW_RUNNING_SERVICES).setVisible(showingBackground);
-            menu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(!showingBackground);
+            boolean showingBackground = mRunningProcessesView != null
+                    ? mRunningProcessesView.mAdapter.getShowBackground() : false;
+            mOptionsMenu.findItem(SORT_ORDER_ALPHA).setVisible(false);
+            mOptionsMenu.findItem(SORT_ORDER_SIZE).setVisible(false);
+            mOptionsMenu.findItem(SHOW_RUNNING_SERVICES).setVisible(showingBackground);
+            mOptionsMenu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(!showingBackground);
         } else {
-            menu.findItem(SORT_ORDER_ALPHA).setVisible(mSortOrder != SORT_ORDER_ALPHA);
-            menu.findItem(SORT_ORDER_SIZE).setVisible(mSortOrder != SORT_ORDER_SIZE);
-            menu.findItem(SHOW_RUNNING_SERVICES).setVisible(false);
-            menu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(false);
+            mOptionsMenu.findItem(SORT_ORDER_ALPHA).setVisible(mSortOrder != SORT_ORDER_ALPHA);
+            mOptionsMenu.findItem(SORT_ORDER_SIZE).setVisible(mSortOrder != SORT_ORDER_SIZE);
+            mOptionsMenu.findItem(SHOW_RUNNING_SERVICES).setVisible(false);
+            mOptionsMenu.findItem(SHOW_BACKGROUND_PROCESSES).setVisible(false);
         }
     }
 
@@ -707,6 +722,7 @@
         } else if (menuId == SHOW_BACKGROUND_PROCESSES) {
             mRunningProcessesView.mAdapter.setShowBackground(true);
         }
+        updateOptionsMenu();
         return true;
     }
     
@@ -822,7 +838,7 @@
             }
             boolean haveData = true;
             if (mActivityResumed && !mResumedRunning) {
-                haveData = mRunningProcessesView.doResume(mRunningProcessesAvail);
+                haveData = mRunningProcessesView.doResume(this, mRunningProcessesAvail);
                 mResumedRunning = true;
             }
             mApplicationsAdapter.pause();
@@ -850,7 +866,7 @@
     }
 
     public void showCurrentTab() {
-        String tabId = mTabHost.getCurrentTabTag();
+        String tabId = mDefaultTab = mTabHost.getCurrentTabTag();
         int newOption;
         if (TAB_DOWNLOADED.equalsIgnoreCase(tabId)) {
             newOption = FILTER_APPS_THIRD_PARTY;
@@ -872,6 +888,7 @@
         mFilterApps = newOption;
         selectView(VIEW_LIST);
         updateStorageUsage();
+        updateOptionsMenu();
     }
 
     public void onTabChanged(String tabId) {
diff --git a/src/com/android/settings/applications/RunningProcessesView.java b/src/com/android/settings/applications/RunningProcessesView.java
index 7794365..958adbd 100644
--- a/src/com/android/settings/applications/RunningProcessesView.java
+++ b/src/com/android/settings/applications/RunningProcessesView.java
@@ -20,16 +20,16 @@
 
 import android.app.ActivityManager;
 import android.app.Dialog;
+import android.app.Fragment;
 import android.content.Context;
-import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.os.SystemProperties;
+import android.preference.PreferenceActivity;
 import android.text.format.DateUtils;
 import android.text.format.Formatter;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -61,6 +61,8 @@
     
     RunningState mState;
     
+    Fragment mOwner;
+    
     Runnable mDataAvail;
 
     StringBuilder mBuilder = new StringBuilder(128);
@@ -417,14 +419,22 @@
         ListView l = (ListView)parent;
         RunningState.MergedItem mi = (RunningState.MergedItem)l.getAdapter().getItem(position);
         mCurSelected = mi;
-        Intent intent = new Intent();
-        intent.putExtra(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
-        intent.putExtra(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
-        intent.putExtra(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
-        intent.setClass(getContext(), RunningServiceDetails.class);
-        getContext().startActivity(intent);
+        startServiceDetailsActivity(mi);
     }
 
+    // utility method used to start sub activity
+    private void startServiceDetailsActivity(RunningState.MergedItem mi) {
+        // start new fragment to display extended information
+        Bundle args = new Bundle();
+        args.putInt(RunningServiceDetails.KEY_UID, mi.mProcess.mUid);
+        args.putString(RunningServiceDetails.KEY_PROCESS, mi.mProcess.mProcessName);
+        args.putBoolean(RunningServiceDetails.KEY_BACKGROUND, mAdapter.mShowBackground);
+
+        PreferenceActivity pa = (PreferenceActivity)mOwner.getActivity();
+        pa.startPreferencePanel(RunningServiceDetails.class.getName(), args,
+                R.string.runningservicedetails_settings_title, null, null, 0);
+    }
+    
     public void onMovedToScrapHeap(View view) {
         mActiveItems.remove(view);
     }
@@ -472,9 +482,11 @@
     public void doPause() {
         mState.pause();
         mDataAvail = null;
+        mOwner = null;
     }
 
-    public boolean doResume(Runnable dataAvail) {
+    public boolean doResume(Fragment owner, Runnable dataAvail) {
+        mOwner = owner;
         mState.resume(this);
         if (mState.hasData()) {
             // If the state already has its data, then let's populate our
diff --git a/src/com/android/settings/applications/RunningServiceDetails.java b/src/com/android/settings/applications/RunningServiceDetails.java
index aa89baf..eccff93 100644
--- a/src/com/android/settings/applications/RunningServiceDetails.java
+++ b/src/com/android/settings/applications/RunningServiceDetails.java
@@ -2,11 +2,12 @@
 
 import com.android.settings.R;
 
-import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.AlertDialog;
 import android.app.ApplicationErrorReport;
 import android.app.Dialog;
+import android.app.DialogFragment;
+import android.app.Fragment;
 import android.app.PendingIntent;
 import android.content.ActivityNotFoundException;
 import android.content.ComponentName;
@@ -37,7 +38,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 
-public class RunningServiceDetails extends Activity
+public class RunningServiceDetails extends Fragment
         implements RunningState.OnRefreshUiListener {
     static final String TAG = "RunningServicesDetails";
     
@@ -59,6 +60,7 @@
     
     RunningState.MergedItem mMergedItem;
     
+    View mRootView;
     ViewGroup mAllDetails;
     ViewGroup mSnippet;
     RunningProcessesView.ActiveItem mSnippetActiveItem;
@@ -84,14 +86,11 @@
             RunningState.ServiceItem si = mServiceItem;
             if (!confirmed) {
                 if ((si.mServiceInfo.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) != 0) {
-                    Bundle args = new Bundle();
-                    args.putParcelable("comp", si.mRunningService.service);
-                    removeDialog(DIALOG_CONFIRM_STOP);
-                    showDialog(DIALOG_CONFIRM_STOP, args);
+                    showConfirmStopDialog(si.mRunningService.service);
                     return;
                 }
             }
-            stopService(new Intent().setComponent(si.mRunningService.service));
+            getActivity().stopService(new Intent().setComponent(si.mRunningService.service));
             if (mMergedItem == null) {
                 // If this is gone, we are gone.
                 mState.updateNow();
@@ -125,7 +124,7 @@
                 }
                 ComponentName comp = new ComponentName(mServiceItem.mServiceInfo.packageName,
                         mServiceItem.mServiceInfo.name);
-                File filename = getFileStreamPath("service_dump.txt");
+                File filename = getActivity().getFileStreamPath("service_dump.txt");
                 FileOutputStream output = null;
                 try {
                     output = new FileOutputStream(filename);
@@ -160,7 +159,7 @@
 
             if (mManageIntent != null) {
                 try {
-                    startIntentSender(mManageIntent.getIntentSender(), null,
+                    getActivity().startIntentSender(mManageIntent.getIntentSender(), null,
                             Intent.FLAG_ACTIVITY_NEW_TASK
                                     | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET,
                             Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, 0);
@@ -236,7 +235,7 @@
         
         TextView description = (TextView)root.findViewById(R.id.comp_description);
         if (si != null && si.mServiceInfo.descriptionRes != 0) {
-            description.setText(getPackageManager().getText(
+            description.setText(getActivity().getPackageManager().getText(
                     si.mServiceInfo.packageName, si.mServiceInfo.descriptionRes,
                     si.mServiceInfo.applicationInfo));
         } else {
@@ -244,15 +243,15 @@
                 description.setText(R.string.background_process_stop_description);
             } else if (detail.mManageIntent != null) {
                 try {
-                    Resources clientr = getPackageManager().getResourcesForApplication(
+                    Resources clientr = getActivity().getPackageManager().getResourcesForApplication(
                             si.mRunningService.clientPackage);
                     String label = clientr.getString(si.mRunningService.clientLabel);
-                    description.setText(getString(R.string.service_manage_description,
+                    description.setText(getActivity().getString(R.string.service_manage_description,
                             label));
                 } catch (PackageManager.NameNotFoundException e) {
                 }
             } else {
-                description.setText(getText(si != null
+                description.setText(getActivity().getText(si != null
                         ? R.string.service_stop_description
                         : R.string.heavy_weight_stop_description));
             }
@@ -260,18 +259,19 @@
         
         detail.mStopButton = (Button)root.findViewById(R.id.left_button);
         detail.mStopButton.setOnClickListener(detail);
-        detail.mStopButton.setText(getText(detail.mManageIntent != null
+        detail.mStopButton.setText(getActivity().getText(detail.mManageIntent != null
                 ? R.string.service_manage : R.string.service_stop));
 
         detail.mReportButton = (Button)root.findViewById(R.id.right_button);
         detail.mReportButton.setOnClickListener(detail);
         detail.mReportButton.setText(com.android.internal.R.string.report);
         // check if error reporting is enabled in secure settings
-        int enabled = Settings.Secure.getInt(getContentResolver(),
+        int enabled = Settings.Secure.getInt(getActivity().getContentResolver(),
                 Settings.Secure.SEND_ACTION_APP_ERROR, 0);
         if (enabled != 0 && si != null) {
             detail.mInstaller = ApplicationErrorReport.getErrorReportReceiver(
-                    this, si.mServiceInfo.packageName, si.mServiceInfo.applicationInfo.flags);
+                    getActivity(), si.mServiceInfo.packageName,
+                    si.mServiceInfo.applicationInfo.flags);
             detail.mReportButton.setEnabled(detail.mInstaller != null);
         } else {
             detail.mReportButton.setEnabled(false);
@@ -312,9 +312,9 @@
                     textid = R.string.process_provider_in_use_description;
                     if (rpi.importanceReasonComponent != null) {
                         try {
-                            ProviderInfo prov = getPackageManager().getProviderInfo(
+                            ProviderInfo prov = getActivity().getPackageManager().getProviderInfo(
                                     rpi.importanceReasonComponent, 0);
-                            label = RunningState.makeLabel(getPackageManager(),
+                            label = RunningState.makeLabel(getActivity().getPackageManager(),
                                     prov.name, prov);
                         } catch (NameNotFoundException e) {
                         }
@@ -324,9 +324,9 @@
                     textid = R.string.process_service_in_use_description;
                     if (rpi.importanceReasonComponent != null) {
                         try {
-                            ServiceInfo serv = getPackageManager().getServiceInfo(
+                            ServiceInfo serv = getActivity().getPackageManager().getServiceInfo(
                                     rpi.importanceReasonComponent, 0);
-                            label = RunningState.makeLabel(getPackageManager(),
+                            label = RunningState.makeLabel(getActivity().getPackageManager(),
                                     serv.name, serv);
                         } catch (NameNotFoundException e) {
                         }
@@ -334,7 +334,7 @@
                     break;
             }
             if (textid != 0 && label != null) {
-                description.setText(getString(textid, label));
+                description.setText(getActivity().getString(textid, label));
             }
         }
         
@@ -405,23 +405,30 @@
         }
     }
     
+    private void finish() {
+        getActivity().onBackPressed();
+    }
+    
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
+    public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         
-        mUid = getIntent().getIntExtra(KEY_UID, 0);
-        mProcessName = getIntent().getStringExtra(KEY_PROCESS);
-        mShowBackground = getIntent().getBooleanExtra(KEY_BACKGROUND, false);
+        mUid = getArguments().getInt(KEY_UID, 0);
+        mProcessName = getArguments().getString(KEY_PROCESS);
+        mShowBackground = getArguments().getBoolean(KEY_BACKGROUND, false);
         
-        mAm = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
-        mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+        mAm = (ActivityManager)getActivity().getSystemService(Context.ACTIVITY_SERVICE);
+        mInflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         
-        mState = RunningState.getInstance(this);
+        mState = RunningState.getInstance(getActivity());
+    }
+    
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        View view = mRootView = inflater.inflate(R.layout.running_service_details, null);
         
-        setContentView(R.layout.running_service_details);
-        
-        mAllDetails = (ViewGroup)findViewById(R.id.all_details);
-        mSnippet = (ViewGroup)findViewById(R.id.snippet);
+        mAllDetails = (ViewGroup)view.findViewById(R.id.all_details);
+        mSnippet = (ViewGroup)view.findViewById(R.id.snippet);
         mSnippet.setBackgroundResource(com.android.internal.R.drawable.title_bar_medium);
         mSnippet.setPadding(0, mSnippet.getPaddingTop(), 0, mSnippet.getPaddingBottom());
         mSnippetViewHolder = new RunningProcessesView.ViewHolder(mSnippet);
@@ -429,26 +436,23 @@
         // We want to retrieve the data right now, so any active managed
         // dialog that gets created can find it.
         ensureData();
+        
+        return view;
     }
 
     @Override
-    protected void onPause() {
+    public void onPause() {
         super.onPause();
         mHaveData = false;
         mState.pause();
     }
 
     @Override
-    protected void onResume() {
+    public void onResume() {
         super.onResume();
         ensureData();
     }
 
-    @Override
-    protected void onSaveInstanceState(Bundle outState) {
-        super.onSaveInstanceState(outState);
-    }
-    
     ActiveDetail activeDetailForService(ComponentName comp) {
         for (int i=0; i<mActiveDetails.size(); i++) {
             ActiveDetail ad = mActiveDetails.get(i);
@@ -460,34 +464,56 @@
         return null;
     }
     
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle args) {
-        switch (id) {
-            case DIALOG_CONFIRM_STOP: {
-                final ComponentName comp = (ComponentName)args.getParcelable("comp");
-                if (activeDetailForService(comp) == null) {
-                    return null;
-                }
-                
-                return new AlertDialog.Builder(this)
-                        .setTitle(getString(R.string.runningservicedetails_stop_dlg_title))
-                        .setIcon(android.R.drawable.ic_dialog_alert)
-                        .setMessage(getString(R.string.runningservicedetails_stop_dlg_text))
-                        .setPositiveButton(R.string.dlg_ok,
-                                new DialogInterface.OnClickListener() {
-                            public void onClick(DialogInterface dialog, int which) {
-                                ActiveDetail ad = activeDetailForService(comp);
-                                if (ad != null) {
-                                    ad.stopActiveService(true);
+    private void showConfirmStopDialog(ComponentName comp) {
+        DialogFragment newFragment = MyAlertDialogFragment.newConfirmStop(
+                DIALOG_CONFIRM_STOP, comp);
+        newFragment.setTargetFragment(this, 0);
+        newFragment.show(getFragmentManager(), "confirmstop");
+    }
+    
+    public static class MyAlertDialogFragment extends DialogFragment {
+
+        public static MyAlertDialogFragment newConfirmStop(int id, ComponentName comp) {
+            MyAlertDialogFragment frag = new MyAlertDialogFragment();
+            Bundle args = new Bundle();
+            args.putInt("id", id);
+            args.putParcelable("comp", comp);
+            frag.setArguments(args);
+            return frag;
+        }
+
+        RunningServiceDetails getOwner() {
+            return (RunningServiceDetails)getTargetFragment();
+        }
+
+        @Override
+        public Dialog onCreateDialog(Bundle savedInstanceState) {
+            int id = getArguments().getInt("id");
+            switch (id) {
+                case DIALOG_CONFIRM_STOP: {
+                    final ComponentName comp = (ComponentName)getArguments().getParcelable("comp");
+                    if (getOwner().activeDetailForService(comp) == null) {
+                        return null;
+                    }
+                    
+                    return new AlertDialog.Builder(getActivity())
+                            .setTitle(getActivity().getString(R.string.runningservicedetails_stop_dlg_title))
+                            .setIcon(android.R.drawable.ic_dialog_alert)
+                            .setMessage(getActivity().getString(R.string.runningservicedetails_stop_dlg_text))
+                            .setPositiveButton(R.string.dlg_ok,
+                                    new DialogInterface.OnClickListener() {
+                                public void onClick(DialogInterface dialog, int which) {
+                                    ActiveDetail ad = getOwner().activeDetailForService(comp);
+                                    if (ad != null) {
+                                        ad.stopActiveService(true);
+                                    }
                                 }
-                            }
-                        })
-                        .setNegativeButton(R.string.dlg_cancel, null)
-                        .create();
+                            })
+                            .setNegativeButton(R.string.dlg_cancel, null)
+                            .create();
+                }
             }
-            
-            default:
-                return super.onCreateDialog(id, args);
+            throw new IllegalArgumentException("unknown id " + id);
         }
     }
 
@@ -509,11 +535,10 @@
     
     void updateTimes() {
         if (mSnippetActiveItem != null) {
-            mSnippetActiveItem.updateTime(RunningServiceDetails.this, mBuilder);
+            mSnippetActiveItem.updateTime(getActivity(), mBuilder);
         }
         for (int i=0; i<mActiveDetails.size(); i++) {
-            mActiveDetails.get(i).mActiveItem.updateTime(
-                    RunningServiceDetails.this, mBuilder);
+            mActiveDetails.get(i).mActiveItem.updateTime(getActivity(), mBuilder);
         }
     }
 
diff --git a/src/com/android/settings/wifi/AdvancedSettings.java b/src/com/android/settings/wifi/AdvancedSettings.java
index c88073d..0d33a10 100644
--- a/src/com/android/settings/wifi/AdvancedSettings.java
+++ b/src/com/android/settings/wifi/AdvancedSettings.java
@@ -35,12 +35,8 @@
 
     private static final String KEY_MAC_ADDRESS = "mac_address";
     private static final String KEY_CURRENT_IP_ADDRESS = "current_ip_address";
-    private static final String KEY_NUM_CHANNELS = "num_channels";
     private static final String KEY_SLEEP_POLICY = "sleep_policy";
 
-    //Tracks ro.debuggable (1 on userdebug builds)
-    private static int DEBUGGABLE;
-
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -50,77 +46,16 @@
     @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
-
-        DEBUGGABLE = SystemProperties.getInt("ro.debuggable", 0);
-
-        /**
-         * Remove user control of regulatory domain
-         * channel count settings in non userdebug builds
-         */
-        if (DEBUGGABLE == 1) {
-            /*
-             * Fix the Run-time IllegalStateException that ListPreference requires an entries
-             * array and an entryValues array, this exception occurs when user open/close the
-             * slider in the Regulatory domain dialog.
-             */
-            initNumChannelsPreference();
-        } else {
-            Preference chanPref = findPreference(KEY_NUM_CHANNELS);
-            if (chanPref != null) {
-              getPreferenceScreen().removePreference(chanPref);
-            }
-        }
     }
-    
+
     @Override
     public void onResume() {
         super.onResume();
 
-        /**
-         * Remove user control of regulatory domain
-         * channel count settings in non userdebug builds
-         */
-        if (DEBUGGABLE == 1) {
-            initNumChannelsPreference();
-        }
         initSleepPolicyPreference();
         refreshWifiInfo();
     }
 
-    private void initNumChannelsPreference() {
-        ListPreference pref = (ListPreference) findPreference(KEY_NUM_CHANNELS);
-        pref.setOnPreferenceChangeListener(this);
-
-        WifiManager wifiManager = (WifiManager) getSystemService(Activity.WIFI_SERVICE);
-        /*
-         * Generate the list of valid channel counts to show in the ListPreference.
-         * The values are numerical, so the only text to be localized is the
-         * "channel_word" resource.
-         */
-        int[] validChannelCounts = wifiManager.getValidChannelCounts();
-        if (validChannelCounts == null) {
-            Toast.makeText(getActivity(), R.string.wifi_setting_num_channels_error,
-                           Toast.LENGTH_SHORT).show();
-            pref.setEnabled(false);
-            return;
-        }
-        String[] entries = new String[validChannelCounts.length];
-        String[] entryValues = new String[validChannelCounts.length];
-
-        for (int i = 0; i < validChannelCounts.length; i++) {
-            entryValues[i] = String.valueOf(validChannelCounts[i]);
-            entries[i] = getActivity().getString(R.string.wifi_setting_num_channels_channel_phrase,
-                    validChannelCounts[i]);
-        }
-        pref.setEntries(entries);
-        pref.setEntryValues(entryValues);
-        pref.setEnabled(true);
-        int numChannels = wifiManager.getNumAllowedChannels();
-        if (numChannels >= 0) {
-            pref.setValue(String.valueOf(numChannels));
-        }
-    }
-    
     private void initSleepPolicyPreference() {
         ListPreference pref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
         pref.setOnPreferenceChangeListener(this);
@@ -133,21 +68,7 @@
         String key = preference.getKey();
         if (key == null) return true;
 
-        if (key.equals(KEY_NUM_CHANNELS)) {
-            try {
-                int numChannels = Integer.parseInt((String) newValue);
-                WifiManager wifiManager = (WifiManager) getSystemService(Activity.WIFI_SERVICE);
-                if (!wifiManager.setNumAllowedChannels(numChannels, true)) {
-                    Toast.makeText(getActivity(), R.string.wifi_setting_num_channels_error,
-                            Toast.LENGTH_SHORT).show();
-                }
-            } catch (NumberFormatException e) {
-                Toast.makeText(getActivity(), R.string.wifi_setting_num_channels_error,
-                        Toast.LENGTH_SHORT).show();
-                return false;
-            }
-            
-        } else if (key.equals(KEY_SLEEP_POLICY)) {
+        if (key.equals(KEY_SLEEP_POLICY)) {
             try {
                 Settings.System.putInt(getContentResolver(),
                         Settings.System.WIFI_SLEEP_POLICY, Integer.parseInt(((String) newValue)));
@@ -157,7 +78,7 @@
                 return false;
             }
         }
-        
+
         return true;
     }
 
@@ -167,7 +88,7 @@
 
         Preference wifiMacAddressPref = findPreference(KEY_MAC_ADDRESS);
         String macAddress = wifiInfo == null ? null : wifiInfo.getMacAddress();
-        wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress 
+        wifiMacAddressPref.setSummary(!TextUtils.isEmpty(macAddress) ? macAddress
                 : getActivity().getString(R.string.status_unavailable));
 
         Preference wifiIpAddressPref = findPreference(KEY_CURRENT_IP_ADDRESS);
