diff options
author | Amith Yamasani <yamasani@google.com> | 2012-09-25 22:17:33 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-09-25 22:44:21 -0700 |
commit | 7fb4f850eabc017bab6090bf9268cf3fae1e08eb (patch) | |
tree | e36a70d880a5dd5640fddbdb53cc3050019c215d /src | |
parent | 0d9179c47338532bb2995130d07e458ab12bcb5c (diff) | |
download | packages_apps_settings-7fb4f850eabc017bab6090bf9268cf3fae1e08eb.zip packages_apps_settings-7fb4f850eabc017bab6090bf9268cf3fae1e08eb.tar.gz packages_apps_settings-7fb4f850eabc017bab6090bf9268cf3fae1e08eb.tar.bz2 |
Show more security settings, and fix missing summary in widget selection.
Bug: 7232809
Change-Id: Ib7a67b83f455592ba5e0e48420924671f8ed95e8
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/SecuritySettings.java | 82 |
1 files changed, 44 insertions, 38 deletions
diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 1b63acb..2af212c 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -90,6 +90,7 @@ public class SecuritySettings extends SettingsPreferenceFragment private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications"; private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications"; private static final String KEY_POWER_INSTANTLY_LOCKS = "power_button_instantly_locks"; + private static final String KEY_CREDENTIALS_MANAGER = "credentials_management"; private static final String PACKAGE_MIME_TYPE = "application/vnd.android.package-archive"; DevicePolicyManager mDPM; @@ -112,6 +113,8 @@ public class SecuritySettings extends SettingsPreferenceFragment private CheckBoxPreference mToggleVerifyApps; private CheckBoxPreference mPowerButtonInstantlyLocks; + private boolean mIsPrimary; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -164,7 +167,9 @@ public class SecuritySettings extends SettingsPreferenceFragment DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); - if (UserHandle.myUserId() == 0) { + mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER; + + if (mIsPrimary) { switch (dpm.getStorageEncryptionStatus()) { case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE: // The device is currently encrypted. @@ -216,17 +221,40 @@ public class SecuritySettings extends SettingsPreferenceFragment } } - if (UserHandle.myUserId() > 0) { - return root; + mUserSelectedWidget = root.findPreference(KEY_CHOOSE_LOCKSCREEN_STATUS_WIDGET); + if (mUserSelectedWidget != null) { + AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); + int appWidgetId = getStatusAppWidgetId(); + if (appWidgetId == -1) { + mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_default)); + } else { + AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); + if (appWidget != null) { + mUserSelectedWidget.setSummary(appWidget.label); + } + } + } + + mUserSelectedWidget = root.findPreference(KEY_CHOOSE_USER_SELECTED_LOCKSCREEN_WIDGET); + if (mUserSelectedWidget != null) { + AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); + int appWidgetId = getUserSelectedAppWidgetId(); + if (appWidgetId == -1) { + mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_none)); + } else { + AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); + if (appWidget != null) { + mUserSelectedWidget.setSummary(appWidget.label); + } + } } - // Rest are for primary user... // Append the rest of the settings addPreferencesFromResource(R.xml.security_settings_misc); // Do not display SIM lock for devices without an Icc card TelephonyManager tm = TelephonyManager.getDefault(); - if (!tm.hasIccCard()) { + if (!mIsPrimary || !tm.hasIccCard()) { root.removePreference(root.findPreference(KEY_SIM_LOCK)); } else { // Disable SIM lock if sim card is missing or unknown @@ -241,50 +269,28 @@ public class SecuritySettings extends SettingsPreferenceFragment // Show password mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD); - // Credential storage - mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); + // Credential storage, only for primary user + if (mIsPrimary) { + mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); + } else { + removePreference(KEY_CREDENTIALS_MANAGER); + } mToggleAppInstallation = (CheckBoxPreference) findPreference( KEY_TOGGLE_INSTALL_APPLICATIONS); mToggleAppInstallation.setChecked(isNonMarketAppsAllowed()); - // Package verification - if (showVerifierSetting()) { - mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS); + // Package verification, only visible to primary user and if enabled + mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS); + if (mIsPrimary && showVerifierSetting()) { if (isVerifierInstalled()) { mToggleVerifyApps.setChecked(isVerifyAppsEnabled()); } else { mToggleVerifyApps.setChecked(false); mToggleVerifyApps.setEnabled(false); } - } - - mUserSelectedWidget = root.findPreference(KEY_CHOOSE_LOCKSCREEN_STATUS_WIDGET); - if (mUserSelectedWidget != null) { - AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); - int appWidgetId = getStatusAppWidgetId(); - if (appWidgetId == -1) { - mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_default)); - } else { - AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); - if (appWidget != null) { - mUserSelectedWidget.setSummary(appWidget.label); - } - } - } - - mUserSelectedWidget = root.findPreference(KEY_CHOOSE_USER_SELECTED_LOCKSCREEN_WIDGET); - if (mUserSelectedWidget != null) { - AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(getActivity()); - int appWidgetId = getUserSelectedAppWidgetId(); - if (appWidgetId == -1) { - mUserSelectedWidget.setSummary(getResources().getString(R.string.widget_none)); - } else { - AppWidgetProviderInfo appWidget = appWidgetManager.getAppWidgetInfo(appWidgetId); - if (appWidget != null) { - mUserSelectedWidget.setSummary(appWidget.label); - } - } + } else if (mToggleVerifyApps != null) { + mToggleVerifyApps.setEnabled(false); } return root; |