summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/settings/DevelopmentSettings.java36
-rw-r--r--src/com/android/settings/RestrictedSettingsFragment.java64
-rw-r--r--src/com/android/settings/SecuritySettings.java25
-rw-r--r--src/com/android/settings/WirelessSettings.java28
-rwxr-xr-xsrc/com/android/settings/bluetooth/BluetoothSettings.java14
-rw-r--r--src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java6
-rw-r--r--src/com/android/settings/bluetooth/DevicePickerFragment.java4
-rw-r--r--src/com/android/settings/users/UserSettings.java26
8 files changed, 159 insertions, 44 deletions
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 8ed9a7e14..dd04cd9c1 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -79,7 +79,7 @@ import java.util.List;
/*
* Displays preferences for application developers.
*/
-public class DevelopmentSettings extends PreferenceFragment
+public class DevelopmentSettings extends RestrictedSettingsFragment
implements DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
OnPreferenceChangeListener, CompoundButton.OnCheckedChangeListener {
private static final String TAG = "DevelopmentSettings";
@@ -210,6 +210,7 @@ public class DevelopmentSettings extends PreferenceFragment
= new ArrayList<CheckBoxPreference>();
private final HashSet<Preference> mDisabledPrefs = new HashSet<Preference>();
+ private final HashSet<Preference> mProtectedByRestrictionsPrefs = new HashSet<Preference>();
// To track whether a confirmation dialog was clicked.
private boolean mDialogClicked;
@@ -219,6 +220,10 @@ public class DevelopmentSettings extends PreferenceFragment
private boolean mUnavailable;
+ public DevelopmentSettings() {
+ super(null /* Don't ask for restrictions pin on creation. */);
+ }
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -268,6 +273,13 @@ public class DevelopmentSettings extends PreferenceFragment
disableForUser(mPassword);
}
+ if (shouldBePinProtected(RESTRICTIONS_PIN_SET)) {
+ protectByRestrictions(mEnableAdb);
+ protectByRestrictions(mClearAdbKeys);
+ protectByRestrictions(mEnableTerminal);
+ protectByRestrictions(mPassword);
+ }
+
mDebugAppPref = findPreference(DEBUG_APP_KEY);
mAllPrefs.add(mDebugAppPref);
mWaitForDebugger = findAndInitCheckboxPref(WAIT_FOR_DEBUGGER_KEY);
@@ -350,6 +362,12 @@ public class DevelopmentSettings extends PreferenceFragment
}
}
+ private void protectByRestrictions(Preference pref) {
+ if (pref != null) {
+ mProtectedByRestrictionsPrefs.add(pref);
+ }
+ }
+
private CheckBoxPreference findAndInitCheckboxPref(String key) {
CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
if (pref == null) {
@@ -793,7 +811,7 @@ public class DevelopmentSettings extends PreferenceFragment
if (flinger != null) {
Parcel data = Parcel.obtain();
data.writeInterfaceToken("android.ui.ISurfaceComposer");
- final int showUpdates = mShowScreenUpdates.isChecked() ? 1 : 0;
+ final int showUpdates = mShowScreenUpdates.isChecked() ? 1 : 0;
data.writeInt(showUpdates);
flinger.transact(1002, data, null, 0);
data.recycle();
@@ -810,7 +828,7 @@ public class DevelopmentSettings extends PreferenceFragment
if (flinger != null) {
Parcel data = Parcel.obtain();
data.writeInterfaceToken("android.ui.ISurfaceComposer");
- final int disableOverlays = mDisableOverlays.isChecked() ? 1 : 0;
+ final int disableOverlays = mDisableOverlays.isChecked() ? 1 : 0;
data.writeInt(disableOverlays);
flinger.transact(1008, data, null, 0);
data.recycle();
@@ -824,7 +842,7 @@ public class DevelopmentSettings extends PreferenceFragment
private void updateHardwareUiOptions() {
updateCheckBox(mForceHardwareUi, SystemProperties.getBoolean(HARDWARE_UI_PROPERTY, false));
}
-
+
private void writeHardwareUiOptions() {
SystemProperties.set(HARDWARE_UI_PROPERTY, mForceHardwareUi.isChecked() ? "true" : "false");
pokeSystemProperties();
@@ -952,7 +970,7 @@ public class DevelopmentSettings extends PreferenceFragment
updateCheckBox(mShowCpuUsage, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.SHOW_PROCESSES, 0) != 0);
}
-
+
private void writeCpuUsageOptions() {
boolean value = mShowCpuUsage.isChecked();
Settings.Global.putInt(getActivity().getContentResolver(),
@@ -1160,6 +1178,10 @@ public class DevelopmentSettings extends PreferenceFragment
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (mProtectedByRestrictionsPrefs.contains(preference)
+ && !restrictionsPinCheck(RESTRICTIONS_PIN_SET)) {
+ return false;
+ }
if (Utils.isMonkeyRunning()) {
return false;
@@ -1198,12 +1220,12 @@ public class DevelopmentSettings extends PreferenceFragment
: PackageManager.COMPONENT_ENABLED_STATE_DEFAULT, 0);
} else if (preference == mBugreportInPower) {
Settings.Secure.putInt(getActivity().getContentResolver(),
- Settings.Secure.BUGREPORT_IN_POWER_MENU,
+ Settings.Secure.BUGREPORT_IN_POWER_MENU,
mBugreportInPower.isChecked() ? 1 : 0);
} else if (preference == mKeepScreenOn) {
Settings.Global.putInt(getActivity().getContentResolver(),
Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
- mKeepScreenOn.isChecked() ?
+ mKeepScreenOn.isChecked() ?
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
} else if (preference == mBtHciSnoopLog) {
writeBtHciSnoopLogOptions();
diff --git a/src/com/android/settings/RestrictedSettingsFragment.java b/src/com/android/settings/RestrictedSettingsFragment.java
index 55c264c3e..ebf2bcf34 100644
--- a/src/com/android/settings/RestrictedSettingsFragment.java
+++ b/src/com/android/settings/RestrictedSettingsFragment.java
@@ -25,11 +25,16 @@ import android.os.UserManager;
/**
* Base class for settings activities that should be pin protected when in restricted mode.
* The constructor for this class will take the restriction key that this screen should be
- * locked by. If {@link UserManager.hasRestrictionsPin()} and {@link UserManager.hasUserRestriction(String)} returns true for the
- * restriction key, then the user will hav
+ * locked by. If {@link UserManager.hasRestrictionsPin()} and
+ * {@link UserManager.hasUserRestriction(String)} returns true for the restriction key, then
+ * the user will have to enter the restrictions pin before seeing the Settings screen.
*
+ * If this settings screen should be pin protected whenever
+ * {@link UserManager.hasUserRestriction(String)} returns true, pass in
+ * {@link RESTRICTIONS_PIN_SET} to the constructor instead of a restrictions key.
*/
public class RestrictedSettingsFragment extends SettingsPreferenceFragment {
+ protected static final String RESTRICTIONS_PIN_SET = "restrictions_pin_set";
// Should be unique across all settings screens that use this.
private static final int REQUEST_PIN_CHALLENGE = 12309;
@@ -45,21 +50,22 @@ public class RestrictedSettingsFragment extends SettingsPreferenceFragment {
private final String mRestrictionKey;
- public RestrictedSettingsFragment(String restrictedFlag) {
- mRestrictionKey = restrictedFlag;
- }
-
- @Override
- public void onActivityCreated(Bundle savedInstanceState) {
- super.onActivityCreated(savedInstanceState);
-
- mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
+ /**
+ * @param restrictionKey The restriction key to check before pin protecting
+ * this settings page. Pass in {@link RESTRICTIONS_PIN_SET} if it should
+ * be PIN protected whenever a restrictions pin is set. Pass in
+ * null if it should never be PIN protected.
+ */
+ public RestrictedSettingsFragment(String restrictionKey) {
+ mRestrictionKey = restrictionKey;
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
+
if (icicle != null) {
mChallengeSucceeded = icicle.getBoolean(KEY_CHALLENGE_SUCCEEDED, false);
mChallengeRequested = icicle.getBoolean(KEY_CHALLENGE_REQUESTED, false);
@@ -79,8 +85,7 @@ public class RestrictedSettingsFragment extends SettingsPreferenceFragment {
@Override
public void onResume() {
super.onResume();
- if (mUserManager.hasUserRestriction(mRestrictionKey)
- && mUserManager.hasRestrictionsPin()) {
+ if (shouldBePinProtected(mRestrictionKey)) {
ensurePin();
}
}
@@ -121,7 +126,40 @@ public class RestrictedSettingsFragment extends SettingsPreferenceFragment {
* Used to determine if the settings UI should disable UI.
*/
protected boolean isRestrictedAndNotPinProtected() {
+ if (mRestrictionKey == null || RESTRICTIONS_PIN_SET.equals(mRestrictionKey)) {
+ return false;
+ }
return mUserManager.hasUserRestriction(mRestrictionKey)
&& !mUserManager.hasRestrictionsPin();
}
+
+ /**
+ * Called to trigger the pin entry if the given restriction key is locked down.
+ * @param restrictionsKey The restriction key or {@link RESTRICTIONS_PIN_SET} if
+ * pin entry should get triggered if there is a pin set.
+ */
+ protected boolean restrictionsPinCheck(String restrictionsKey) {
+ if (shouldBePinProtected(restrictionsKey) && !mChallengeSucceeded) {
+ ensurePin();
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ protected boolean hasChallengeSucceeded() {
+ return mChallengeSucceeded;
+ }
+
+ /**
+ * Returns true if this restrictions key is locked down.
+ */
+ protected boolean shouldBePinProtected(String restrictionKey) {
+ if (restrictionKey == null) {
+ return false;
+ }
+ boolean restricted = RESTRICTIONS_PIN_SET.equals(restrictionKey)
+ || mUserManager.hasUserRestriction(restrictionKey);
+ return restricted && mUserManager.hasRestrictionsPin();
+ }
}
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java
index 948aded98..7a442a9b7 100644
--- a/src/com/android/settings/SecuritySettings.java
+++ b/src/com/android/settings/SecuritySettings.java
@@ -45,14 +45,14 @@ import android.util.Log;
import com.android.internal.widget.LockPatternUtils;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
/**
* Gesture lock pattern settings.
*/
-public class SecuritySettings extends SettingsPreferenceFragment
+public class SecuritySettings extends RestrictedSettingsFragment
implements OnPreferenceChangeListener, DialogInterface.OnClickListener {
-
static final String TAG = "SecuritySettings";
// Lock Settings
@@ -82,6 +82,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
private static final String KEY_NOTIFICATION_ACCESS = "manage_notification_access";
private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive";
+ private final HashSet<Preference> mProtectedByRestictionsPrefs = new HashSet<Preference>();
+
private PackageManager mPM;
DevicePolicyManager mDPM;
@@ -106,6 +108,10 @@ public class SecuritySettings extends SettingsPreferenceFragment
private boolean mIsPrimary;
+ public SecuritySettings() {
+ super(null /* Don't ask for restrictions pin on creation. */);
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -303,9 +309,19 @@ public class SecuritySettings extends SettingsPreferenceFragment
}
}
+ if (shouldBePinProtected(RESTRICTIONS_PIN_SET)) {
+ protectByRestrictions(mToggleAppInstallation);
+ protectByRestrictions(mToggleVerifyApps);
+ }
return root;
}
+ private void protectByRestrictions(Preference pref) {
+ if (pref != null) {
+ mProtectedByRestictionsPrefs.add(pref);
+ }
+ }
+
private int getNumEnabledNotificationListeners() {
final String flat = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ENABLED_NOTIFICATION_LISTENERS);
@@ -471,6 +487,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (mProtectedByRestictionsPrefs.contains(preference)
+ && !restrictionsPinCheck(RESTRICTIONS_PIN_SET)) {
+ return false;
+ }
+
final String key = preference.getKey();
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 1f2992708..ecb984d33 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -16,6 +16,8 @@
package com.android.settings;
+import java.util.HashSet;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -44,7 +46,7 @@ import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.nfc.NfcEnabler;
import com.android.settings.NsdEnabler;
-public class WirelessSettings extends SettingsPreferenceFragment {
+public class WirelessSettings extends RestrictedSettingsFragment {
private static final String TAG = "WirelessSettings";
private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane";
@@ -73,7 +75,11 @@ public class WirelessSettings extends SettingsPreferenceFragment {
private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1;
private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage";
+ private final HashSet<Preference> mProtectedByRestictionsPrefs = new HashSet<Preference>();
+ public WirelessSettings() {
+ super(null);
+ }
/**
* Invoked on each preference click in this hierarchy, overrides
* PreferenceActivity's implementation. Used to make sure we track the
@@ -81,6 +87,10 @@ public class WirelessSettings extends SettingsPreferenceFragment {
*/
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
+ if (mProtectedByRestictionsPrefs.contains(preference) && !hasChallengeSucceeded()) {
+ restrictionsPinCheck(RESTRICTIONS_PIN_SET);
+ return false;
+ }
log("onPreferenceTreeClick: preference=" + preference);
if (preference == mAirplaneModePreference && Boolean.parseBoolean(
SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) {
@@ -145,6 +155,13 @@ public class WirelessSettings extends SettingsPreferenceFragment {
}
}
+ private void protectByRestrictions(String key) {
+ Preference pref = findPreference(key);
+ if (pref != null) {
+ mProtectedByRestictionsPrefs.add(pref);
+ }
+ }
+
@Override
public Dialog onCreateDialog(int dialogId) {
log("onCreateDialog: dialogId=" + dialogId);
@@ -225,6 +242,8 @@ public class WirelessSettings extends SettingsPreferenceFragment {
ps.setDependency(KEY_TOGGLE_AIRPLANE);
}
}
+ protectByRestrictions(KEY_WIMAX_SETTINGS);
+
// Manually set dependencies for Wifi when not toggleable.
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) {
findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE);
@@ -232,7 +251,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
if (isSecondaryUser) { // Disable VPN
removePreference(KEY_VPN_SETTINGS);
}
-
+ protectByRestrictions(KEY_VPN_SETTINGS);
// Manually set dependencies for Bluetooth when not toggleable.
if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) {
// No bluetooth-dependent items in the list. Code kept in case one is added later.
@@ -257,6 +276,8 @@ public class WirelessSettings extends SettingsPreferenceFragment {
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
removePreference(KEY_MANAGE_MOBILE_PLAN);
}
+ protectByRestrictions(KEY_MOBILE_NETWORK_SETTINGS);
+ protectByRestrictions(KEY_MANAGE_MOBILE_PLAN);
// Remove Airplane Mode settings if it's a stationary device such as a TV.
if (getActivity().getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
@@ -280,6 +301,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
Preference p = findPreference(KEY_TETHER_SETTINGS);
p.setTitle(Utils.getTetheringLabel(cm));
}
+ protectByRestrictions(KEY_TETHER_SETTINGS);
// Enable link to CMAS app settings depending on the value in config.xml.
boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean(
@@ -300,6 +322,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS);
if (ps != null) root.removePreference(ps);
}
+ protectByRestrictions(KEY_CELL_BROADCAST_SETTINGS);
}
@Override
@@ -345,6 +368,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes,
mAirplaneModePreference.isChecked());
}
+ super.onActivityResult(requestCode, resultCode, data);
}
@Override
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index ab657e07e..529ee7971 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -27,7 +27,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.os.UserManager;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceCategory;
@@ -74,7 +73,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
private final IntentFilter mIntentFilter;
- private UserManager mUserManager;
// accessed from inner class (not private to avoid thunks)
Preference mMyDevicePreference;
@@ -96,13 +94,13 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
};
public BluetoothSettings() {
+ super(DISALLOW_CONFIG_BLUETOOTH);
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- mUserManager = (UserManager) getSystemService(Context.USER_SERVICE);
mActivityStarted = (savedInstanceState == null); // don't auto start scan after rotation
mEmptyView = (TextView) getView().findViewById(android.R.id.empty);
@@ -171,7 +169,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (mLocalAdapter == null) return;
// If the user is not allowed to configure bluetooth, do not show the menu.
- if (mUserManager.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) return;
+ if (isRestrictedAndNotPinProtected()) return;
boolean bluetoothIsEnabled = mLocalAdapter.getBluetoothState() == BluetoothAdapter.STATE_ON;
boolean isDiscovering = mLocalAdapter.isDiscovering();
@@ -219,7 +217,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
}
private void startScanning() {
- if (mUserManager.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) return;
+ if (isRestrictedAndNotPinProtected()) return;
if (!mAvailableDevicesCategoryIsPresent) {
getPreferenceScreen().addPreference(mAvailableDevicesCategory);
}
@@ -266,7 +264,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
mMyDevicePreference.setEnabled(true);
preferenceScreen.addPreference(mMyDevicePreference);
- if (! mUserManager.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) {
+ if (!isRestrictedAndNotPinProtected()) {
if (mDiscoverableEnabler == null) {
mDiscoverableEnabler = new BluetoothDiscoverableEnabler(getActivity(),
mLocalAdapter, mMyDevicePreference);
@@ -297,7 +295,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
} else {
mAvailableDevicesCategory.removeAll();
}
- if (! mUserManager.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) {
+ if (!isRestrictedAndNotPinProtected()) {
addDeviceCategory(mAvailableDevicesCategory,
R.string.bluetooth_preference_found_devices,
BluetoothDeviceFilter.UNBONDED_DEVICE_FILTER);
@@ -366,7 +364,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
public void onClick(View v) {
// User clicked on advanced options icon for a device in the list
if (v.getTag() instanceof CachedBluetoothDevice) {
- if (mUserManager.hasUserRestriction(DISALLOW_CONFIG_BLUETOOTH)) return;
+ if (isRestrictedAndNotPinProtected()) return;
CachedBluetoothDevice device = (CachedBluetoothDevice) v.getTag();
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index 7fc1b65de..e2faf7fd5 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -26,6 +26,7 @@ import android.preference.PreferenceScreen;
import android.util.Log;
import com.android.settings.ProgressCategory;
+import com.android.settings.RestrictedSettingsFragment;
import com.android.settings.SettingsPreferenceFragment;
import java.util.Collection;
@@ -39,7 +40,7 @@ import java.util.WeakHashMap;
* @see DevicePickerFragment
*/
public abstract class DeviceListPreferenceFragment extends
- SettingsPreferenceFragment implements BluetoothCallback {
+ RestrictedSettingsFragment implements BluetoothCallback {
private static final String TAG = "DeviceListPreferenceFragment";
@@ -58,7 +59,8 @@ public abstract class DeviceListPreferenceFragment extends
final WeakHashMap<CachedBluetoothDevice, BluetoothDevicePreference> mDevicePreferenceMap =
new WeakHashMap<CachedBluetoothDevice, BluetoothDevicePreference>();
- DeviceListPreferenceFragment() {
+ DeviceListPreferenceFragment(String restrictedKey) {
+ super(restrictedKey);
mFilter = BluetoothDeviceFilter.ALL_FILTER;
}
diff --git a/src/com/android/settings/bluetooth/DevicePickerFragment.java b/src/com/android/settings/bluetooth/DevicePickerFragment.java
index 027ceedbe..de8202b0f 100644
--- a/src/com/android/settings/bluetooth/DevicePickerFragment.java
+++ b/src/com/android/settings/bluetooth/DevicePickerFragment.java
@@ -34,6 +34,10 @@ import com.android.settings.R;
*/
public final class DevicePickerFragment extends DeviceListPreferenceFragment {
+ DevicePickerFragment() {
+ super(null /* Not tied to any user restrictions. */);
+ }
+
private boolean mNeedAuth;
private String mLaunchPackage;
private String mLaunchClass;
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index c236b6dd1..1c2c5f72a 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -16,6 +16,10 @@
package com.android.settings.users;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.Activity;
@@ -42,8 +46,8 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.Preference;
-import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceActivity;
import android.preference.PreferenceGroup;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
@@ -59,19 +63,13 @@ import android.widget.SimpleAdapter;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.ChooseLockGeneric;
-import com.android.settings.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.OwnerInfoSettings;
import com.android.settings.R;
+import com.android.settings.RestrictedSettingsFragment;
import com.android.settings.SelectableEditTextPreference;
-import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.Utils;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class UserSettings extends SettingsPreferenceFragment
+public class UserSettings extends RestrictedSettingsFragment
implements OnPreferenceClickListener, OnClickListener, DialogInterface.OnDismissListener,
Preference.OnPreferenceChangeListener {
@@ -136,6 +134,9 @@ public class UserSettings extends SettingsPreferenceFragment
private SparseArray<Bitmap> mUserIcons = new SparseArray<Bitmap>();
private boolean mIsOwner = UserHandle.myUserId() == UserHandle.USER_OWNER;
+ public UserSettings() {
+ super(null);
+ }
private Handler mHandler = new Handler() {
@Override
@@ -717,6 +718,9 @@ public class UserSettings extends SettingsPreferenceFragment
@Override
public boolean onPreferenceClick(Preference pref) {
+ if (pref == mAddUser && !restrictionsPinCheck(RESTRICTIONS_PIN_SET)) {
+ return false;
+ }
if (pref == mMePreference) {
Intent editProfile;
if (!mProfileExists) {
@@ -776,7 +780,9 @@ public class UserSettings extends SettingsPreferenceFragment
int userId = ((UserPreference) v.getTag()).getUserId();
switch (v.getId()) {
case UserPreference.DELETE_ID:
- onRemoveUserClicked(userId);
+ if (restrictionsPinCheck(RESTRICTIONS_PIN_SET)) {
+ onRemoveUserClicked(userId);
+ }
break;
case UserPreference.SETTINGS_ID:
onManageUserClicked(userId, false);