Disable the "none" security selection in settings when there's only 1 user

Fixes bug 7454567

Change-Id: Ifffa1403af8d45bc3c7da1f459b87f0a2c064b80
This commit is contained in:
Jim Miller
2012-11-01 19:39:21 -07:00
parent 0b2bd8d11d
commit 783ea85bec
2 changed files with 19 additions and 1 deletions

View File

@@ -27,8 +27,10 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -120,7 +122,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
// Add options for lock/unlock screen
int resid = 0;
if (!mLockPatternUtils.isSecure()) {
if (mLockPatternUtils.isLockScreenDisabled()) {
// if there are multiple users, disable "None" setting
UserManager mUm = (UserManager) getSystemService(Context.USER_SERVICE);
List<UserInfo> users = mUm.getUsers(true);
final boolean singleUser = users.size() == 1;
if (singleUser && mLockPatternUtils.isLockScreenDisabled()) {
resid = R.xml.security_settings_lockscreen;
} else {
resid = R.xml.security_settings_chooser;