diff --git a/src/com/android/settings/GoogleLocationSettingHelper.java b/src/com/android/settings/GoogleLocationSettingHelper.java
index 0d4861e..be4a02c 100644
--- a/src/com/android/settings/GoogleLocationSettingHelper.java
+++ b/src/com/android/settings/GoogleLocationSettingHelper.java
@@ -122,6 +122,7 @@
         try {
             context.startActivity(i);
         } catch (ActivityNotFoundException e) {
+            Log.e("GoogleLocationSettingHelper", "Problem while starting GSF location activity");
         }
     }
 
diff --git a/src/com/android/settings/LocationSettings.java b/src/com/android/settings/LocationSettings.java
new file mode 100644
index 0000000..645e6d7
--- /dev/null
+++ b/src/com/android/settings/LocationSettings.java
@@ -0,0 +1,193 @@
+/*
+ * Copyright (C) 2011 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 android.content.ContentQueryMap;
+import android.content.ContentResolver;
+import android.content.Intent;
+import android.database.Cursor;
+import android.location.LocationManager;
+import android.preference.CheckBoxPreference;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceChangeListener;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+
+import java.util.Observable;
+import java.util.Observer;
+
+/**
+ * Gesture lock pattern settings.
+ */
+public class LocationSettings extends SettingsPreferenceFragment
+        implements OnPreferenceChangeListener {
+
+    // Location Settings
+    private static final String KEY_LOCATION_NETWORK = "location_network";
+    private static final String KEY_LOCATION_GPS = "location_gps";
+    private static final String KEY_ASSISTED_GPS = "assisted_gps";
+    private static final String KEY_USE_LOCATION = "location_use_for_services";
+
+    private CheckBoxPreference mNetwork;
+    private CheckBoxPreference mGps;
+    private CheckBoxPreference mAssistedGps;
+    private CheckBoxPreference mUseLocation;
+
+    // These provide support for receiving notification when Location Manager settings change.
+    // This is necessary because the Network Location Provider can change settings
+    // if the user does not confirm enabling the provider.
+    private ContentQueryMap mContentQueryMap;
+
+    private Observer mSettingsObserver;
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        // listen for Location Manager settings changes
+        Cursor settingsCursor = getContentResolver().query(Settings.Secure.CONTENT_URI, null,
+                "(" + Settings.System.NAME + "=?)",
+                new String[]{Settings.Secure.LOCATION_PROVIDERS_ALLOWED},
+                null);
+        mContentQueryMap = new ContentQueryMap(settingsCursor, Settings.System.NAME, true, null);
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        if (mSettingsObserver != null) {
+            mContentQueryMap.deleteObserver(mSettingsObserver);
+        }
+    }
+
+    private PreferenceScreen createPreferenceHierarchy() {
+        PreferenceScreen root = getPreferenceScreen();
+        if (root != null) {
+            root.removeAll();
+        }
+        addPreferencesFromResource(R.xml.location_settings);
+        root = getPreferenceScreen();
+
+        mNetwork = (CheckBoxPreference) root.findPreference(KEY_LOCATION_NETWORK);
+        mGps = (CheckBoxPreference) root.findPreference(KEY_LOCATION_GPS);
+        mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS);
+        if (GoogleLocationSettingHelper.isAvailable(getActivity())) {
+            // GSF present, Add setting for 'Use My Location'
+            CheckBoxPreference useLocation = new CheckBoxPreference(getActivity());
+            useLocation.setKey(KEY_USE_LOCATION);
+            useLocation.setTitle(R.string.use_location_title);
+            useLocation.setSummaryOn(R.string.use_location_summary_enabled);
+            useLocation.setSummaryOff(R.string.use_location_summary_disabled);
+            useLocation.setChecked(
+                    GoogleLocationSettingHelper.getUseLocationForServices(getActivity())
+                    == GoogleLocationSettingHelper.USE_LOCATION_FOR_SERVICES_ON);
+            useLocation.setPersistent(false);
+            useLocation.setOnPreferenceChangeListener(this);
+            getPreferenceScreen().addPreference(useLocation);
+            mUseLocation = useLocation;
+        }
+
+        // Change the summary for wifi-only devices
+        if (Utils.isWifiOnly()) {
+            mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi);
+        }
+
+        return root;
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+
+        // Make sure we reload the preference hierarchy since some of these settings
+        // depend on others...
+        createPreferenceHierarchy();
+        updateLocationToggles();
+
+        if (mSettingsObserver == null) {
+            mSettingsObserver = new Observer() {
+                public void update(Observable o, Object arg) {
+                    updateLocationToggles();
+                }
+            };
+            mContentQueryMap.addObserver(mSettingsObserver);
+        }
+    }
+
+    @Override
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+
+        if (preference == mNetwork) {
+            Settings.Secure.setLocationProviderEnabled(getContentResolver(),
+                    LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
+        } else if (preference == mGps) {
+            boolean enabled = mGps.isChecked();
+            Settings.Secure.setLocationProviderEnabled(getContentResolver(),
+                    LocationManager.GPS_PROVIDER, enabled);
+            if (mAssistedGps != null) {
+                mAssistedGps.setEnabled(enabled);
+            }
+        } else if (preference == mAssistedGps) {
+            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
+                    mAssistedGps.isChecked() ? 1 : 0);
+        } else {
+            // If we didn't handle it, let preferences handle it.
+            return super.onPreferenceTreeClick(preferenceScreen, preference);
+        }
+
+        return true;
+    }
+
+    /*
+     * Creates toggles for each available location provider
+     */
+    private void updateLocationToggles() {
+        ContentResolver res = getContentResolver();
+        boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
+                res, LocationManager.GPS_PROVIDER);
+        mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
+                res, LocationManager.NETWORK_PROVIDER));
+        mGps.setChecked(gpsEnabled);
+        if (mAssistedGps != null) {
+            mAssistedGps.setChecked(Settings.Secure.getInt(res,
+                    Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
+            mAssistedGps.setEnabled(gpsEnabled);
+        }
+    }
+
+    /**
+     * see confirmPatternThenDisableAndClear
+     */
+    @Override
+    public void onActivityResult(int requestCode, int resultCode, Intent data) {
+        super.onActivityResult(requestCode, resultCode, data);
+        createPreferenceHierarchy();
+    }
+
+    public boolean onPreferenceChange(Preference preference, Object value) {
+        if (preference == mUseLocation) {
+            boolean newValue = (value == null ? false : (Boolean) value);
+            GoogleLocationSettingHelper.setUseLocationForServices(getActivity(), newValue);
+            // We don't want to change the value immediately here, since the user may click
+            // disagree in the dialog that pops up. When the activity we just launched exits, this
+            // activity will be restated and the new value re-read, so the checkbox will get its
+            // new value then.
+            return false;
+        }
+        return true;
+    }
+}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 5d77e53..fc91e78 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -19,15 +19,9 @@
 
 import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
 
-import com.android.internal.widget.LockPatternUtils;
-
 import android.app.admin.DevicePolicyManager;
-import android.content.ContentQueryMap;
-import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
-import android.database.Cursor;
-import android.location.LocationManager;
 import android.os.Bundle;
 import android.os.Vibrator;
 import android.preference.CheckBoxPreference;
@@ -41,9 +35,9 @@
 import android.telephony.TelephonyManager;
 import android.util.Log;
 
+import com.android.internal.widget.LockPatternUtils;
+
 import java.util.ArrayList;
-import java.util.Observable;
-import java.util.Observer;
 
 /**
  * Gesture lock pattern settings.
@@ -60,38 +54,17 @@
     private static final String KEY_LOCK_AFTER_TIMEOUT = "lock_after_timeout";
     private static final int SET_OR_CHANGE_LOCK_METHOD_REQUEST = 123;
 
-    // Location Settings
-    private static final String KEY_LOCATION_CATEGORY = "location_category";
-    private static final String KEY_LOCATION_NETWORK = "location_network";
-    private static final String KEY_LOCATION_GPS = "location_gps";
-    private static final String KEY_ASSISTED_GPS = "assisted_gps";
-    private static final String KEY_USE_LOCATION = "location_use_for_services";
-
     // Misc Settings
     private static final String KEY_SIM_LOCK = "sim_lock";
     private static final String KEY_SHOW_PASSWORD = "show_password";
     private static final String KEY_RESET_CREDENTIALS = "reset_credentials";
 
-    private static final String TAG = "SecuritySettings";
-
-    private CheckBoxPreference mNetwork;
-    private CheckBoxPreference mGps;
-    private CheckBoxPreference mAssistedGps;
-    private CheckBoxPreference mUseLocation;
-
     DevicePolicyManager mDPM;
 
-    // These provide support for receiving notification when Location Manager settings change.
-    // This is necessary because the Network Location Provider can change settings
-    // if the user does not confirm enabling the provider.
-    private ContentQueryMap mContentQueryMap;
-
     private ChooseLockSettingsHelper mChooseLockSettingsHelper;
     private LockPatternUtils mLockPatternUtils;
     private ListPreference mLockAfter;
 
-    private Observer mSettingsObserver;
-
     private CheckBoxPreference mVisiblePattern;
     private CheckBoxPreference mTactileFeedback;
 
@@ -110,25 +83,6 @@
         mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
     }
 
-    @Override
-    public void onStart() {
-        super.onStart();
-        // listen for Location Manager settings changes
-        Cursor settingsCursor = getContentResolver().query(Settings.Secure.CONTENT_URI, null,
-                "(" + Settings.System.NAME + "=?)",
-                new String[]{Settings.Secure.LOCATION_PROVIDERS_ALLOWED},
-                null);
-        mContentQueryMap = new ContentQueryMap(settingsCursor, Settings.System.NAME, true, null);
-    }
-
-    @Override
-    public void onStop() {
-        super.onStop();
-        if (mSettingsObserver != null) {
-            mContentQueryMap.deleteObserver(mSettingsObserver);
-        }
-    }
-
     private PreferenceScreen createPreferenceHierarchy() {
         PreferenceScreen root = getPreferenceScreen();
         if (root != null) {
@@ -137,32 +91,6 @@
         addPreferencesFromResource(R.xml.security_settings);
         root = getPreferenceScreen();
 
-        mNetwork = (CheckBoxPreference) root.findPreference(KEY_LOCATION_NETWORK);
-        mGps = (CheckBoxPreference) root.findPreference(KEY_LOCATION_GPS);
-        mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS);
-        if (GoogleLocationSettingHelper.isAvailable(getActivity())) {
-            // GSF present, Add setting for 'Use My Location'
-            PreferenceGroup locationCat =
-                    (PreferenceGroup) root.findPreference(KEY_LOCATION_CATEGORY);
-            CheckBoxPreference useLocation = new CheckBoxPreference(getActivity());
-            useLocation.setKey(KEY_USE_LOCATION);
-            useLocation.setTitle(R.string.use_location_title);
-            useLocation.setSummaryOn(R.string.use_location_summary_enabled);
-            useLocation.setSummaryOff(R.string.use_location_summary_disabled);
-            useLocation.setChecked(
-                    GoogleLocationSettingHelper.getUseLocationForServices(getActivity())
-                    == GoogleLocationSettingHelper.USE_LOCATION_FOR_SERVICES_ON);
-            useLocation.setPersistent(false);
-            useLocation.setOnPreferenceChangeListener(this);
-            locationCat.addPreference(useLocation);
-            mUseLocation = useLocation;
-        }
-
-        // Change the summary for wifi-only devices
-        if (Utils.isWifiOnly()) {
-            mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi);
-        }
-
         // Add options for lock/unlock screen
         int resid = 0;
         if (!mLockPatternUtils.isSecure()) {
@@ -311,16 +239,6 @@
         // Make sure we reload the preference hierarchy since some of these settings
         // depend on others...
         createPreferenceHierarchy();
-        updateLocationToggles();
-
-        if (mSettingsObserver == null) {
-            mSettingsObserver = new Observer() {
-                public void update(Observable o, Object arg) {
-                    updateLocationToggles();
-                }
-            };
-            mContentQueryMap.addObserver(mSettingsObserver);
-        }
 
         final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
         if (mVisiblePattern != null) {
@@ -338,8 +256,7 @@
     }
 
     @Override
-    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
-            Preference preference) {
+    public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
         final String key = preference.getKey();
 
         final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
@@ -355,19 +272,6 @@
         } else if (preference == mShowPassword) {
             Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
                     mShowPassword.isChecked() ? 1 : 0);
-        } else if (preference == mNetwork) {
-            Settings.Secure.setLocationProviderEnabled(getContentResolver(),
-                    LocationManager.NETWORK_PROVIDER, mNetwork.isChecked());
-        } else if (preference == mGps) {
-            boolean enabled = mGps.isChecked();
-            Settings.Secure.setLocationProviderEnabled(getContentResolver(),
-                    LocationManager.GPS_PROVIDER, enabled);
-            if (mAssistedGps != null) {
-                mAssistedGps.setEnabled(enabled);
-            }
-        } else if (preference == mAssistedGps) {
-            Settings.Secure.putInt(getContentResolver(), Settings.Secure.ASSISTED_GPS_ENABLED,
-                    mAssistedGps.isChecked() ? 1 : 0);
         } else {
             // If we didn't handle it, let preferences handle it.
             return super.onPreferenceTreeClick(preferenceScreen, preference);
@@ -376,29 +280,12 @@
         return true;
     }
 
-    /*
-     * Creates toggles for each available location provider
-     */
-    private void updateLocationToggles() {
-        ContentResolver res = getContentResolver();
-        boolean gpsEnabled = Settings.Secure.isLocationProviderEnabled(
-                res, LocationManager.GPS_PROVIDER);
-        mNetwork.setChecked(Settings.Secure.isLocationProviderEnabled(
-                res, LocationManager.NETWORK_PROVIDER));
-        mGps.setChecked(gpsEnabled);
-        if (mAssistedGps != null) {
-            mAssistedGps.setChecked(Settings.Secure.getInt(res,
-                    Settings.Secure.ASSISTED_GPS_ENABLED, 2) == 1);
-            mAssistedGps.setEnabled(gpsEnabled);
-        }
-    }
-
     private boolean isToggled(Preference pref) {
         return ((CheckBoxPreference) pref).isChecked();
     }
 
     /**
-     * @see #confirmPatternThenDisableAndClear
+     * see confirmPatternThenDisableAndClear
      */
     @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -416,14 +303,6 @@
                 Log.e("SecuritySettings", "could not persist lockAfter timeout setting", e);
             }
             updateLockAfterPreferenceSummary();
-        } else if (preference == mUseLocation) {
-            boolean newValue = (value == null ? false : (Boolean) value);
-            GoogleLocationSettingHelper.setUseLocationForServices(getActivity(), newValue);
-            // We don't want to change the value immediately here, since the user may click
-            // disagree in the dialog that pops up. When the activity we just launched exits, this
-            // activity will be restated and the new value re-read, so the checkbox will get its
-            // new value then.
-            return false;
         }
         return true;
     }
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 1f54b17..102dd7f 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -528,7 +528,6 @@
     /*
      * Settings subclasses for launching independently.
      */
-
     public static class BluetoothSettingsActivity extends Settings { /* empty */ }
     public static class WirelessSettingsActivity extends Settings { /* empty */ }
     public static class TetherSettingsActivity extends Settings { /* empty */ }
@@ -550,6 +549,7 @@
     public static class DevelopmentSettingsActivity extends Settings { /* empty */ }
     public static class AccessibilitySettingsActivity extends Settings { /* empty */ }
     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 */ }
