Merge "User restrictions for creds storage & user removal" into jb-mr2-dev

This commit is contained in:
Emily Bernier
2013-04-12 20:22:03 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 7 deletions

View File

@@ -235,15 +235,20 @@ public class SecuritySettings extends SettingsPreferenceFragment
mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD);
// Credential storage
mKeyStore = KeyStore.getInstance();
Preference credentialStorageType = root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
if (!um.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
mKeyStore = KeyStore.getInstance();
Preference credentialStorageType = root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
final int storageSummaryRes =
final int storageSummaryRes =
mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
: R.string.credential_storage_type_software;
credentialStorageType.setSummary(storageSummaryRes);
credentialStorageType.setSummary(storageSummaryRes);
mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS);
} else {
removePreference(KEY_CREDENTIALS_MANAGER);
}
// Application install
PreferenceGroup deviceAdminCategory= (PreferenceGroup)
@@ -252,7 +257,6 @@ public class SecuritySettings extends SettingsPreferenceFragment
KEY_TOGGLE_INSTALL_APPLICATIONS);
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
boolean isSideloadingAllowed =
!um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES);
// Side loading of apps.

View File

@@ -233,7 +233,8 @@ public class UserSettings extends SettingsPreferenceFragment
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
if (!mIsOwner) {
UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
if (!mIsOwner && !um.hasUserRestriction(UserManager.DISALLOW_REMOVE_USER)) {
String nickname = mUserManager.getUserName();
MenuItem removeThisUser = menu.add(0, MENU_REMOVE_USER, 0,
getResources().getString(R.string.user_remove_user_menu, nickname));