Bug 1222390 - (Part 1) Restricted profiles: Always hide 'master password' setting. r=margaret

--HG--
extra : commitid : 3DRJBw5ZNaM
extra : rebase_source : 186cbfb1463704586c29b8c75b769fb20e5228da
extra : histedit_source : ea0f16e6435c70e0fc97199c6f8a93393b4ecad9
This commit is contained in:
Sebastian Kaspari 2015-11-27 13:25:13 +01:00
parent 4284c4c838
commit c549ff65b6
5 changed files with 16 additions and 7 deletions

View File

@ -721,7 +721,6 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY restrictable_feature_location_services "Location Services">
<!ENTITY restrictable_feature_clear_history "Clear History">
<!ENTITY restrictable_feature_guest_browsing "Guest browsing">
<!ENTITY restrictable_feature_master_password "Master password">
<!ENTITY restrictable_feature_advanced_settings "Advanced Settings">
<!ENTITY restrictable_feature_camera_microphone "Camera &amp; Microphone">

View File

@ -46,7 +46,7 @@ public enum Restrictable {
CLEAR_HISTORY(14, "clear_history", R.string.restrictable_feature_clear_history),
MASTER_PASSWORD(15, "master_password", R.string.restrictable_feature_master_password),
MASTER_PASSWORD(15, "master_password", 0),
GUEST_BROWSING(16, "guest_browsing", R.string.restrictable_feature_guest_browsing),

View File

@ -31,6 +31,17 @@ public class RestrictedProfileConfiguration implements RestrictionConfiguration
Restrictable.CAMERA_MICROPHONE
);
/**
* These restrictions are hidden from the admin configuration UI.
*/
private static List<Restrictable> hiddenRestrictions = Arrays.asList(
Restrictable.MASTER_PASSWORD
);
/* package-private */ static boolean shouldHide(Restrictable restrictable) {
return hiddenRestrictions.contains(restrictable);
}
private Context context;
private Bundle cachedAppRestrictions;
private Bundle cachedUserRestrictions;
@ -119,10 +130,6 @@ public class RestrictedProfileConfiguration implements RestrictionConfiguration
bundle.putBoolean(Restrictable.CLEAR_HISTORY.name, !bundle.getBoolean("no_clear_history"));
}
if (!bundle.containsKey(Restrictable.MASTER_PASSWORD.name) && bundle.containsKey("no_master_password")) {
bundle.putBoolean(Restrictable.MASTER_PASSWORD.name, !bundle.getBoolean("no_master_password"));
}
if (!bundle.containsKey(Restrictable.GUEST_BROWSING.name) && bundle.containsKey("no_guest_browsing")) {
bundle.putBoolean(Restrictable.GUEST_BROWSING.name, !bundle.getBoolean("no_guest_browsing"));
}

View File

@ -57,6 +57,10 @@ public class RestrictionProvider extends BroadcastReceiver {
continue;
}
if (RestrictedProfileConfiguration.shouldHide(restrictable)) {
continue;
}
RestrictionEntry entry = createRestrictionEntryWithDefaultValue(context, restrictable,
oldRestrictions.getBoolean(restrictable.name, false));
entries.add(entry);

View File

@ -570,7 +570,6 @@
<string name="restrictable_feature_location_services">&restrictable_feature_location_services;</string>
<string name="restrictable_feature_clear_history">&restrictable_feature_clear_history;</string>
<string name="restrictable_feature_guest_browsing">&restrictable_feature_guest_browsing;</string>
<string name="restrictable_feature_master_password">&restrictable_feature_master_password;</string>
<string name="restrictable_feature_advanced_settings">&restrictable_feature_advanced_settings;</string>
<string name="restrictable_feature_camera_microphone">&restrictable_feature_camera_microphone;</string>