mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1125286 - Restricted profiles: Introduce toggle for "Data choices". r=margaret
This commit is contained in:
parent
1b8585a77e
commit
9b5e7c3397
@ -1793,7 +1793,7 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
}
|
||||
|
||||
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && Restrictions.isAllowed(this, Restrictable.LOCATION_SERVICE)) {
|
||||
if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
// Start (this acts as ping if started already) the stumbler lib; if the stumbler has queued data it will upload it.
|
||||
// Stumbler operates on its own thread, and startup impact is further minimized by delaying work (such as upload) a few seconds.
|
||||
// Avoid any potential startup CPU/thread contention by delaying the pref broadcast.
|
||||
@ -1823,7 +1823,7 @@ public class BrowserApp extends GeckoApp
|
||||
});
|
||||
|
||||
// Display notification for Mozilla data reporting, if data should be collected.
|
||||
if (AppConstants.MOZ_DATA_REPORTING) {
|
||||
if (AppConstants.MOZ_DATA_REPORTING && Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
DataReportingNotification.checkAndNotifyPolicy(GeckoAppShell.getContext());
|
||||
}
|
||||
|
||||
|
@ -726,6 +726,8 @@ just addresses the organization to follow, e.g. "This site is run by " -->
|
||||
<!ENTITY restrictable_feature_advanced_settings_description "This includes importing bookmarks, restoring tabs and automated updates. Turn off for simplified settings suitable for any family member.">
|
||||
<!ENTITY restrictable_feature_camera_microphone "Camera & Microphone">
|
||||
<!ENTITY restrictable_feature_camera_microphone_description "Allows family members to engage in real time communication on websites.">
|
||||
<!ENTITY restrictable_feature_data_choices "Data Choices">
|
||||
<!ENTITY restrictable_feature_data_choices_description "Choose whether or not to send usage information to Mozilla to help make Firefox better.">
|
||||
|
||||
<!-- Default Bookmarks titles-->
|
||||
<!-- LOCALIZATION NOTE (bookmarks_about_browser): link title for about:fennec -->
|
||||
|
@ -672,7 +672,7 @@ OnSharedPreferenceChangeListener
|
||||
if (pref instanceof PreferenceGroup) {
|
||||
// If datareporting is disabled, remove UI.
|
||||
if (PREFS_DATA_REPORTING_PREFERENCES.equals(key)) {
|
||||
if (!AppConstants.MOZ_DATA_REPORTING) {
|
||||
if (!AppConstants.MOZ_DATA_REPORTING || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
@ -714,27 +714,27 @@ OnSharedPreferenceChangeListener
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_TELEMETRY_ENABLED.equals(key)) {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) ||
|
||||
PREFS_HEALTHREPORT_LINK.equals(key)) {
|
||||
if (!AppConstants.MOZ_SERVICES_HEALTHREPORT) {
|
||||
if (!AppConstants.MOZ_SERVICES_HEALTHREPORT || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_CRASHREPORTER_ENABLED.equals(key)) {
|
||||
if (!AppConstants.MOZ_CRASHREPORTER) {
|
||||
if (!AppConstants.MOZ_CRASHREPORTER || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_GEO_REPORTING.equals(key) ||
|
||||
PREFS_GEO_LEARN_MORE.equals(key)) {
|
||||
if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !Restrictions.isAllowed(this, Restrictable.LOCATION_SERVICE)) {
|
||||
if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
|
@ -48,7 +48,9 @@ public enum Restrictable {
|
||||
R.string.restrictable_feature_private_browsing,
|
||||
R.string.restrictable_feature_private_browsing_description),
|
||||
|
||||
LOCATION_SERVICE(13, "location_service", 0, 0),
|
||||
DATA_CHOICES(13, "data_coices",
|
||||
R.string.restrictable_feature_data_choices,
|
||||
R.string.restrictable_feature_data_choices_description),
|
||||
|
||||
CLEAR_HISTORY(14, "clear_history",
|
||||
R.string.restrictable_feature_clear_history,
|
||||
|
@ -16,34 +16,41 @@ import android.os.StrictMode;
|
||||
import android.os.UserManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
public class RestrictedProfileConfiguration implements RestrictionConfiguration {
|
||||
static List<Restrictable> DEFAULT_DISABLED_FEATURES = Arrays.asList(
|
||||
Restrictable.INSTALL_EXTENSION,
|
||||
Restrictable.PRIVATE_BROWSING,
|
||||
Restrictable.LOCATION_SERVICE,
|
||||
Restrictable.CLEAR_HISTORY,
|
||||
Restrictable.MASTER_PASSWORD,
|
||||
Restrictable.GUEST_BROWSING,
|
||||
Restrictable.ADVANCED_SETTINGS,
|
||||
Restrictable.CAMERA_MICROPHONE
|
||||
);
|
||||
// Mapping from restrictable feature to default state (on/off)
|
||||
private static Map<Restrictable, Boolean> configuration = new LinkedHashMap<>();
|
||||
static {
|
||||
configuration.put(Restrictable.INSTALL_EXTENSION, false);
|
||||
configuration.put(Restrictable.PRIVATE_BROWSING, false);
|
||||
configuration.put(Restrictable.CLEAR_HISTORY, false);
|
||||
configuration.put(Restrictable.MASTER_PASSWORD, false);
|
||||
configuration.put(Restrictable.GUEST_BROWSING, false);
|
||||
configuration.put(Restrictable.ADVANCED_SETTINGS, false);
|
||||
configuration.put(Restrictable.CAMERA_MICROPHONE, false);
|
||||
configuration.put(Restrictable.DATA_CHOICES, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* These restrictions are hidden from the admin configuration UI.
|
||||
*/
|
||||
private static List<Restrictable> hiddenRestrictions = Arrays.asList(
|
||||
Restrictable.MASTER_PASSWORD,
|
||||
Restrictable.GUEST_BROWSING,
|
||||
Restrictable.LOCATION_SERVICE
|
||||
Restrictable.GUEST_BROWSING
|
||||
);
|
||||
|
||||
/* package-private */ static boolean shouldHide(Restrictable restrictable) {
|
||||
return hiddenRestrictions.contains(restrictable);
|
||||
}
|
||||
|
||||
/* package-private */ static Map<Restrictable, Boolean> getConfiguration() {
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private Context context;
|
||||
private Bundle cachedAppRestrictions;
|
||||
private Bundle cachedUserRestrictions;
|
||||
@ -65,7 +72,7 @@ public class RestrictedProfileConfiguration implements RestrictionConfiguration
|
||||
return !cachedUserRestrictions.getBoolean(restrictable.name);
|
||||
}
|
||||
|
||||
return cachedAppRestrictions.getBoolean(restrictable.name, !DEFAULT_DISABLED_FEATURES.contains(restrictable));
|
||||
return cachedAppRestrictions.getBoolean(restrictable.name, configuration.get(restrictable));
|
||||
}
|
||||
|
||||
private void readRestrictions() {
|
||||
|
@ -18,6 +18,7 @@ import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Broadcast receiver providing supported restrictions to the system.
|
||||
@ -53,17 +54,15 @@ public class RestrictionProvider extends BroadcastReceiver {
|
||||
private ArrayList<RestrictionEntry> initRestrictions(Context context, Bundle oldRestrictions) {
|
||||
ArrayList<RestrictionEntry> entries = new ArrayList<RestrictionEntry>();
|
||||
|
||||
for (Restrictable restrictable : RestrictedProfileConfiguration.DEFAULT_DISABLED_FEATURES) {
|
||||
if (restrictable == Restrictable.LOCATION_SERVICE && !AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
|
||||
continue;
|
||||
}
|
||||
final Map<Restrictable, Boolean> configuration = RestrictedProfileConfiguration.getConfiguration();
|
||||
|
||||
for (Restrictable restrictable : configuration.keySet()) {
|
||||
if (RestrictedProfileConfiguration.shouldHide(restrictable)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RestrictionEntry entry = createRestrictionEntryWithDefaultValue(context, restrictable,
|
||||
oldRestrictions.getBoolean(restrictable.name, false));
|
||||
oldRestrictions.getBoolean(restrictable.name, configuration.get(restrictable)));
|
||||
entries.add(entry);
|
||||
}
|
||||
|
||||
|
@ -575,6 +575,8 @@
|
||||
<string name="restrictable_feature_advanced_settings_description">&restrictable_feature_advanced_settings_description;</string>
|
||||
<string name="restrictable_feature_camera_microphone">&restrictable_feature_camera_microphone;</string>
|
||||
<string name="restrictable_feature_camera_microphone_description">&restrictable_feature_camera_microphone_description;</string>
|
||||
<string name="restrictable_feature_data_choices">&restrictable_feature_data_choices;</string>
|
||||
<string name="restrictable_feature_data_choices_description">&restrictable_feature_data_choices_description;</string>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<string name="ellipsis">&ellipsis;</string>
|
||||
|
@ -11,7 +11,7 @@ interface nsIFile;
|
||||
interface nsIInterfaceRequestor;
|
||||
interface nsIArray;
|
||||
|
||||
[scriptable, uuid(ec6ae96e-e161-481e-bb51-78b11fc1fdbe)]
|
||||
[scriptable, uuid(f35733bc-114b-49ce-a8dd-a423f19318bc)]
|
||||
interface nsIParentalControlsService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -29,7 +29,7 @@ interface nsIParentalControlsService : nsISupports
|
||||
const short REMOTE_DEBUGGING = 10; // Remote debugging
|
||||
const short IMPORT_SETTINGS = 11; // Importing settings from other apps
|
||||
const short PRIVATE_BROWSING = 12; // Disallow usage of private browsing
|
||||
const short LOCATION_SERVICE = 13; // Sharing of location data to location service
|
||||
const short DATA_CHOICES = 13; // Choose whether or not to send usage information
|
||||
const short CLEAR_HISTORY = 14; // Clear browsing history
|
||||
const short MASTER_PASSWORD = 15; // Setting master password for logins
|
||||
const short GUEST_BROWSING = 16; // Disallow usage of guest browsing
|
||||
|
Loading…
Reference in New Issue
Block a user