Remove pin and add restrictions for Security settings.

Bug: 14081992
Change-Id: Iec5667202b6f5ae5b5a2a0cfded1a832d98adaf9
This commit is contained in:
Julia Reynolds
2014-06-12 11:49:12 -04:00
parent 253b111a3d
commit 565653cef1
6 changed files with 71 additions and 26 deletions

View File

@@ -56,7 +56,7 @@ import java.util.List;
/**
* Gesture lock pattern settings.
*/
public class SecuritySettings extends RestrictedSettingsFragment
public class SecuritySettings extends SettingsPreferenceFragment
implements OnPreferenceChangeListener, DialogInterface.OnClickListener, Indexable {
static final String TAG = "SecuritySettings";
private static final Intent TRUST_AGENT_INTENT =
@@ -113,10 +113,6 @@ public class SecuritySettings extends RestrictedSettingsFragment
private boolean mIsPrimary;
public SecuritySettings() {
super(null /* Don't ask for restrictions pin on creation. */);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -272,6 +268,7 @@ public class SecuritySettings extends RestrictedSettingsFragment
} else {
removePreference(KEY_CREDENTIALS_MANAGER);
removePreference(KEY_CREDENTIALS_INSTALL);
}
// Application install
@@ -280,9 +277,12 @@ public class SecuritySettings extends RestrictedSettingsFragment
mToggleAppInstallation = (CheckBoxPreference) findPreference(
KEY_TOGGLE_INSTALL_APPLICATIONS);
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
// Side loading of apps.
mToggleAppInstallation.setEnabled(mIsPrimary);
if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES)
|| um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) {
mToggleAppInstallation.setEnabled(false);
}
// Package verification, only visible to primary user and if enabled
mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS);
@@ -300,12 +300,8 @@ public class SecuritySettings extends RestrictedSettingsFragment
mToggleVerifyApps.setEnabled(false);
}
}
if (shouldBePinProtected(RESTRICTIONS_PIN_SET)) {
protectByRestrictions(mToggleAppInstallation);
protectByRestrictions(mToggleVerifyApps);
protectByRestrictions(mResetCredentials);
protectByRestrictions(root.findPreference(KEY_CREDENTIALS_INSTALL));
if (um.hasUserRestriction(UserManager.ENSURE_VERIFY_APPS)) {
mToggleVerifyApps.setEnabled(false);
}
// Trust Agent preferences
@@ -499,9 +495,6 @@ public class SecuritySettings extends RestrictedSettingsFragment
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if (ensurePinRestrictedPreference(preference)) {
return true;
}
final String key = preference.getKey();
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();