Remove wifi/bt restrictions choice for limited users

Bug: 8631653

Make "Unknown sources" visible but disabled if restricted for limited user.
Bug: 8629605

Also show the restriction name as the dialog title in the picker.

Change-Id: I8d6ea3571bcc4372347cad6a2c982f35afa7cc09
This commit is contained in:
Amith Yamasani
2013-04-16 15:39:47 -07:00
parent 1a72d9c49b
commit e11a346f1f
3 changed files with 9 additions and 15 deletions

View File

@@ -260,15 +260,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
boolean isSideloadingAllowed = boolean isSideloadingAllowed =
!um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES); !um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES);
// Side loading of apps. // Side loading of apps.
if (isSideloadingAllowed) {
mToggleAppInstallation.setEnabled(isSideloadingAllowed); mToggleAppInstallation.setEnabled(isSideloadingAllowed);
} else {
if (deviceAdminCategory != null) {
deviceAdminCategory.removePreference(mToggleAppInstallation);
} else {
mToggleAppInstallation.setEnabled(false);
}
}
// Package verification, only visible to primary user and if enabled // Package verification, only visible to primary user and if enabled
mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS); mToggleVerifyApps = (CheckBoxPreference) findPreference(KEY_TOGGLE_VERIFY_APPLICATIONS);

View File

@@ -682,6 +682,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
((ListPreference)p).setEntryValues(entry.getChoiceValues()); ((ListPreference)p).setEntryValues(entry.getChoiceValues());
((ListPreference)p).setEntries(entry.getChoiceEntries()); ((ListPreference)p).setEntries(entry.getChoiceEntries());
((ListPreference)p).setValue(value); ((ListPreference)p).setValue(value);
((ListPreference)p).setDialogTitle(entry.getTitle());
break; break;
case RestrictionEntry.TYPE_MULTI_SELECT: case RestrictionEntry.TYPE_MULTI_SELECT:
p = new MultiSelectListPreference(context); p = new MultiSelectListPreference(context);
@@ -693,6 +694,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
set.add(s); set.add(s);
} }
((MultiSelectListPreference)p).setValues(set); ((MultiSelectListPreference)p).setValues(set);
((MultiSelectListPreference)p).setDialogTitle(entry.getTitle());
break; break;
case RestrictionEntry.TYPE_NULL: case RestrictionEntry.TYPE_NULL:
default: default:

View File

@@ -31,22 +31,22 @@ import java.util.ArrayList;
public class RestrictionUtils { public class RestrictionUtils {
public static final String [] sRestrictionKeys = { public static final String [] sRestrictionKeys = {
UserManager.DISALLOW_CONFIG_WIFI, // UserManager.DISALLOW_CONFIG_WIFI,
UserManager.DISALLOW_CONFIG_BLUETOOTH, // UserManager.DISALLOW_CONFIG_BLUETOOTH,
UserManager.DISALLOW_SHARE_LOCATION, UserManager.DISALLOW_SHARE_LOCATION,
UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES
}; };
public static final int [] sRestrictionTitles = { public static final int [] sRestrictionTitles = {
R.string.restriction_wifi_config_title, // R.string.restriction_wifi_config_title,
R.string.restriction_bluetooth_config_title, // R.string.restriction_bluetooth_config_title,
R.string.restriction_location_enable_title, R.string.restriction_location_enable_title,
R.string.install_applications R.string.install_applications
}; };
public static final int [] sRestrictionDescriptions = { public static final int [] sRestrictionDescriptions = {
R.string.restriction_wifi_config_summary, // R.string.restriction_wifi_config_summary,
R.string.restriction_bluetooth_config_summary, // R.string.restriction_bluetooth_config_summary,
R.string.restriction_location_enable_summary, R.string.restriction_location_enable_summary,
R.string.install_unknown_applications R.string.install_unknown_applications
}; };