diff --git a/res/values/strings.xml b/res/values/strings.xml
index ecc465e..67b5eaa 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2806,8 +2806,6 @@
 
     <!-- Security & location settings screen, section header for settings relating to location -->
     <string name="location_title">My Location</string>
-    <!-- Title for managed profile preference category [CHAR_LIMIT=25] -->
-    <string name="managed_profile_location_category">Work profile</string>
     <!-- [CHAR LIMIT=30] Title for managed profile location switch  -->
     <string name="managed_profile_location_switch_title">Location for work profile</string>
     <!-- [CHAR LIMIT=30] Text to show on managed profile location switch if MDM has locked down location access for managed profile-->
diff --git a/res/xml/location_settings.xml b/res/xml/location_settings.xml
index 2cd86f5..4ccc14a 100644
--- a/res/xml/location_settings.xml
+++ b/res/xml/location_settings.xml
@@ -27,19 +27,13 @@
             android:summary="@string/location_mode_location_off_title" />
 
         <!-- This preference category gets removed if there is no managed profile -->
-        <PreferenceCategory
-            android:key="managed_profile_location_category"
-            android:title="@string/managed_profile_location_category">
-
-            <Preference
-                android:key="managed_profile_location_switch"
-                android:title="@string/managed_profile_location_switch_title"
-                android:summary="@string/managed_profile_location_switch_lockdown"
-                android:persistent="false"
-                android:enabled="false"
-                android:selectable="false" />
-
-        </PreferenceCategory>
+        <SwitchPreference
+            android:key="managed_profile_location_switch"
+            android:title="@string/managed_profile_location_switch_title"
+            android:summary="@string/managed_profile_location_switch_lockdown"
+            android:persistent="false"
+            android:enabled="false"
+            android:selectable="true" />
 
         <PreferenceCategory
             android:key="recent_location_requests"
diff --git a/src/com/android/settings/location/LocationSettings.java b/src/com/android/settings/location/LocationSettings.java
index 2ed48e9..9974e89 100644
--- a/src/com/android/settings/location/LocationSettings.java
+++ b/src/com/android/settings/location/LocationSettings.java
@@ -17,7 +17,9 @@
 package com.android.settings.location;
 
 import android.app.Activity;
+import android.app.admin.DevicePolicyManager;
 import android.content.BroadcastReceiver;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
@@ -30,6 +32,7 @@
 import android.support.v7.preference.PreferenceCategory;
 import android.support.v7.preference.PreferenceGroup;
 import android.support.v7.preference.PreferenceScreen;
+import android.support.v14.preference.SwitchPreference;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -81,16 +84,10 @@
     private static final String TAG = "LocationSettings";
 
     /**
-     * Key for managed profile location preference category. Category is shown only
-     * if there is a managed profile
+     * Key for managed profile location switch preference. Shown only
+     * if there is a managed profile.
      */
-    private static final String KEY_MANAGED_PROFILE_CATEGORY = "managed_profile_location_category";
-    /**
-     * Key for managed profile location preference. Note it used to be a switch pref and we had to
-     * keep the key as strings had been submitted for string freeze before the decision to
-     * demote this to a simple preference was made. TODO: Candidate for refactoring.
-     */
-    private static final String KEY_MANAGED_PROFILE_PREFERENCE = "managed_profile_location_switch";
+    private static final String KEY_MANAGED_PROFILE_SWITCH = "managed_profile_location_switch";
     /** Key for preference screen "Mode" */
     private static final String KEY_LOCATION_MODE = "location_mode";
     /** Key for preference category "Recent location requests" */
@@ -104,7 +101,7 @@
     private Switch mSwitch;
     private boolean mValidListener = false;
     private UserHandle mManagedProfile;
-    private Preference mManagedProfilePreference;
+    private SwitchPreference mManagedProfileSwitch;
     private Preference mLocationMode;
     private PreferenceCategory mCategoryRecentLocationRequests;
     /** Receives UPDATE_INTENT  */
@@ -250,20 +247,39 @@
         mManagedProfile = Utils.getManagedProfile(mUm);
         if (mManagedProfile == null) {
             // There is no managed profile
-            root.removePreference(root.findPreference(KEY_MANAGED_PROFILE_CATEGORY));
-            mManagedProfilePreference = null;
+            root.removePreference(root.findPreference(KEY_MANAGED_PROFILE_SWITCH));
+            mManagedProfileSwitch = null;
         } else {
-            mManagedProfilePreference = root.findPreference(KEY_MANAGED_PROFILE_PREFERENCE);
-            mManagedProfilePreference.setOnPreferenceClickListener(null);
+            mManagedProfileSwitch = (SwitchPreference)root
+                    .findPreference(KEY_MANAGED_PROFILE_SWITCH);
+            mManagedProfileSwitch.setOnPreferenceClickListener(null);
         }
     }
 
-    private void changeManagedProfileLocationAccessStatus(boolean enabled, int summaryResId) {
-        if (mManagedProfilePreference == null) {
+    private void changeManagedProfileLocationAccessStatus(boolean mainSwitchOn) {
+        if (mManagedProfileSwitch == null) {
             return;
         }
-        mManagedProfilePreference.setEnabled(enabled);
-        mManagedProfilePreference.setSummary(summaryResId);
+        boolean enabled = mainSwitchOn;
+        int summaryResId = R.string.switch_off_text;
+        if (mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)
+                && getAdminRestrictingManagedProfile() != null) {
+                    summaryResId = R.string.managed_profile_location_switch_lockdown;
+                    enabled = false;
+        }
+
+        mManagedProfileSwitch.setEnabled(enabled);
+        mManagedProfileSwitch.setOnPreferenceClickListener(null);
+        if (!enabled) {
+            mManagedProfileSwitch.setChecked(false);
+        } else {
+            final boolean isRestricted = isManagedProfileRestrictedByBase();
+            mManagedProfileSwitch.setChecked(!isRestricted);
+            summaryResId = (isRestricted ?
+                    R.string.switch_off_text : R.string.switch_on_text);
+            mManagedProfileSwitch.setOnPreferenceClickListener(mManagedProfileSwitchClickListener);
+        }
+        mManagedProfileSwitch.setSummary(summaryResId);
     }
 
     /**
@@ -374,18 +390,7 @@
             }
         }
 
-        if (mManagedProfilePreference != null) {
-            if (mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)) {
-                changeManagedProfileLocationAccessStatus(false,
-                        R.string.managed_profile_location_switch_lockdown);
-            } else {
-                if (enabled) {
-                    changeManagedProfileLocationAccessStatus(true, R.string.switch_on_text);
-                } else {
-                    changeManagedProfileLocationAccessStatus(false, R.string.switch_off_text);
-                }
-            }
-        }
+        changeManagedProfileLocationAccessStatus(enabled);
 
         // As a safety measure, also reloads on location mode change to ensure the settings are
         // up-to-date even if an affected app doesn't send the setting changed broadcast.
@@ -404,6 +409,47 @@
         }
     }
 
+    private ComponentName getAdminRestrictingManagedProfile() {
+        if (mManagedProfile == null) {
+            return null;
+        }
+        DevicePolicyManager dpm = (DevicePolicyManager)getActivity().getSystemService(
+                Context.DEVICE_POLICY_SERVICE);
+        if (dpm == null) {
+            return null;
+        }
+        List<ComponentName> admins = dpm.getActiveAdminsAsUser(mManagedProfile.getIdentifier());
+        for (int i = 0; i < admins.size(); ++i) {
+            final ComponentName admin = admins.get(i);
+            Bundle restrictions = dpm.getUserRestrictions(admin, mManagedProfile.getIdentifier());
+            if (restrictions != null && restrictions.getBoolean(UserManager.DISALLOW_SHARE_LOCATION,
+                    false)) {
+                return admin;
+            }
+        }
+        return null;
+    }
+
+    private boolean isManagedProfileRestrictedByBase() {
+        if (mManagedProfile == null) {
+            return false;
+        }
+        return mUm.hasBaseUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile);
+    }
+
+    private Preference.OnPreferenceClickListener mManagedProfileSwitchClickListener =
+            new Preference.OnPreferenceClickListener() {
+                @Override
+                public boolean onPreferenceClick(Preference preference) {
+                    final boolean switchState = mManagedProfileSwitch.isChecked();
+                    mUm.setUserRestriction(UserManager.DISALLOW_SHARE_LOCATION,
+                            !switchState, mManagedProfile);
+                    mManagedProfileSwitch.setSummary(switchState ?
+                            R.string.switch_on_text : R.string.switch_off_text);
+                    return true;
+                }
+            };
+
     private class PackageEntryClickedListener
             implements Preference.OnPreferenceClickListener {
         private String mPackage;
