User management screens

Customized Settings for restricted users
- Only some top-level settings panels available

User management
- Primary user can add and remove users
- User details screen to change name and list of enabled apps

Change-Id: Ia6beb991b427197a4ec2724ca3c9222073f6cf7d
This commit is contained in:
Amith Yamasani
2012-03-25 10:12:26 -07:00
parent 7014dbca85
commit b810a0ddf9
11 changed files with 600 additions and 13 deletions

View File

@@ -26,6 +26,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.UserId;
import android.os.Vibrator;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
@@ -140,15 +141,17 @@ public class SecuritySettings extends SettingsPreferenceFragment
DevicePolicyManager dpm =
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
switch (dpm.getStorageEncryptionStatus()) {
case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
// The device is currently encrypted.
addPreferencesFromResource(R.xml.security_settings_encrypted);
break;
case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
// This device supports encryption but isn't encrypted.
addPreferencesFromResource(R.xml.security_settings_unencrypted);
break;
if (UserId.myUserId() == 0) {
switch (dpm.getStorageEncryptionStatus()) {
case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE:
// The device is currently encrypted.
addPreferencesFromResource(R.xml.security_settings_encrypted);
break;
case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE:
// This device supports encryption but isn't encrypted.
addPreferencesFromResource(R.xml.security_settings_unencrypted);
break;
}
}
// lock after preference
@@ -190,6 +193,11 @@ public class SecuritySettings extends SettingsPreferenceFragment
}
}
if (UserId.myUserId() > 0) {
return root;
}
// Rest are for primary user...
// Append the rest of the settings
addPreferencesFromResource(R.xml.security_settings_misc);
@@ -246,7 +254,9 @@ public class SecuritySettings extends SettingsPreferenceFragment
public void onClick(DialogInterface dialog, int which) {
if (dialog == mWarnInstallApps && which == DialogInterface.BUTTON_POSITIVE) {
setNonMarketAppsAllowed(true);
mToggleAppInstallation.setChecked(true);
if (mToggleAppInstallation != null) {
mToggleAppInstallation.setChecked(true);
}
}
}
@@ -343,11 +353,15 @@ public class SecuritySettings extends SettingsPreferenceFragment
mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks());
}
mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
if (mShowPassword != null) {
mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1) != 0);
}
KeyStore.State state = KeyStore.getInstance().state();
mResetCredentials.setEnabled(state != KeyStore.State.UNINITIALIZED);
if (mResetCredentials != null) {
mResetCredentials.setEnabled(state != KeyStore.State.UNINITIALIZED);
}
}
@Override