Bug 1232761 - Expose telemetry/fhr settings directly in restricted profile admin UI. r=sebastian draft
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 18 Dec 2015 11:37:26 -0500
changeset 316393 6f40de0dc974415419d4c791173b2ea06d0843c2
parent 316382 9765236f55225dd74caee557f9ee3193467d4e6d
child 512154 2410c9fe7f8d5defc851247b9c4877bd23d596c0
push id8539
push usermleibovic@mozilla.com
push dateFri, 18 Dec 2015 17:05:12 +0000
reviewerssebastian
bugs1232761
milestone46.0a1
Bug 1232761 - Expose telemetry/fhr settings directly in restricted profile admin UI. r=sebastian
mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/strings.xml.in
mobile/android/chrome/content/browser.js
toolkit/components/parentalcontrols/nsIParentalControlsService.idl
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/Restrictable.java
@@ -43,19 +43,17 @@ public enum Restrictable {
 
     IMPORT_SETTINGS(11, "import_settings", 0, 0),
 
     PRIVATE_BROWSING(
             12, "private_browsing",
             R.string.restrictable_feature_private_browsing,
             R.string.restrictable_feature_private_browsing_description),
 
-    DATA_CHOICES(13, "data_coices",
-            R.string.restrictable_feature_data_choices,
-            R.string.restrictable_feature_data_choices_description),
+    DATA_CHOICES(13, "data_coices", 0, 0),
 
     CLEAR_HISTORY(14, "clear_history",
             R.string.restrictable_feature_clear_history,
             R.string.restrictable_feature_clear_history_description),
 
     MASTER_PASSWORD(15, "master_password", 0, 0),
 
     GUEST_BROWSING(16, "guest_browsing",  0, 0),
@@ -65,17 +63,26 @@ public enum Restrictable {
             R.string.restrictable_feature_advanced_settings_description),
 
     CAMERA_MICROPHONE(18, "camera_microphone",
             R.string.restrictable_feature_camera_microphone,
             R.string.restrictable_feature_camera_microphone_description),
 
     BLOCK_LIST(19, "block_list",
             R.string.restrictable_feature_block_list,
-            R.string.restrictable_feature_block_list_description);
+            R.string.restrictable_feature_block_list_description),
+
+    TELEMETRY(20, "telemetry",
+            R.string.datareporting_telemetry_title,
+            R.string.datareporting_telemetry_summary),
+
+    HEALTH_REPORT(21, "health_report",
+            R.string.datareporting_fhr_title,
+            R.string.datareporting_fhr_summary2);
+
 
     public final int id;
     public final String name;
 
     @StringRes
     public final int title;
 
     @StringRes
--- a/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/restrictions/RestrictedProfileConfiguration.java
@@ -28,30 +28,34 @@ public class RestrictedProfileConfigurat
     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);
+        configuration.put(Restrictable.DATA_CHOICES, false);
 
         // Hold behind Nightly flag until we have an actual block list deployed.
         if (AppConstants.NIGHTLY_BUILD) {
             configuration.put(Restrictable.BLOCK_LIST, false);
         }
+
+        configuration.put(Restrictable.TELEMETRY, false);
+        configuration.put(Restrictable.HEALTH_REPORT, true);
     }
 
     /**
      * These restrictions are hidden from the admin configuration UI.
      */
     private static List<Restrictable> hiddenRestrictions = Arrays.asList(
             Restrictable.MASTER_PASSWORD,
-            Restrictable.GUEST_BROWSING
+            Restrictable.GUEST_BROWSING,
+            Restrictable.DATA_CHOICES
     );
 
     /* package-private */ static boolean shouldHide(Restrictable restrictable) {
         return hiddenRestrictions.contains(restrictable);
     }
 
     /* package-private */ static Map<Restrictable, Boolean> getConfiguration() {
         return configuration;
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -737,18 +737,16 @@ just addresses the organization to follo
 <!ENTITY restrictable_feature_private_browsing "Private Browsing">
 <!ENTITY restrictable_feature_private_browsing_description "Allows family members to browse without saving information about the sites and pages they\'ve visited.">
 <!ENTITY restrictable_feature_clear_history "Clear History">
 <!ENTITY restrictable_feature_clear_history_description "Allows family members to delete information about the sites and pages they\'ve visited.">
 <!ENTITY restrictable_feature_advanced_settings "Advanced Settings">
 <!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 &amp; 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.">
 <!ENTITY restrictable_feature_block_list "Block List">
 <!ENTITY restrictable_feature_block_list_description "Block websites that include sensitive content.">
 
 <!-- Default Bookmarks titles-->
 <!-- LOCALIZATION NOTE (bookmarks_about_browser): link title for about:fennec -->
 <!ENTITY bookmarks_about_browser "Firefox: About your browser">
 <!-- LOCALIZATION NOTE (bookmarks_addons): link title for https://addons.mozilla.org/en-US/mobile -->
 <!ENTITY bookmarks_addons "Firefox: Customize with add-ons">
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -571,18 +571,16 @@
   <string name="restrictable_feature_private_browsing">&restrictable_feature_private_browsing;</string>
   <string name="restrictable_feature_private_browsing_description">&restrictable_feature_private_browsing_description;</string>
   <string name="restrictable_feature_clear_history">&restrictable_feature_clear_history;</string>
   <string name="restrictable_feature_clear_history_description">&restrictable_feature_clear_history_description;</string>
   <string name="restrictable_feature_advanced_settings">&restrictable_feature_advanced_settings;</string>
   <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>
   <string name="restrictable_feature_block_list">&restrictable_feature_block_list;</string>
   <string name="restrictable_feature_block_list_description">&restrictable_feature_block_list_description;</string>
 
   <!-- Miscellaneous -->
   <string name="ellipsis">&ellipsis;</string>
 
   <string name="colon">&colon;</string>
 
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -537,16 +537,22 @@ var BrowserApp = {
       Services.prefs.clearUserPref("extensions.autoDisableScopes");
       Services.prefs.setBoolPref("xpinstall.enabled", true);
     }
 
     if (ParentalControls.parentalControlsEnabled) {
         let isBlockListEnabled = ParentalControls.isAllowed(ParentalControls.BLOCK_LIST);
         Services.prefs.setBoolPref("browser.safebrowsing.forbiddenURIs.enabled", isBlockListEnabled);
         Services.prefs.setBoolPref("browser.safebrowsing.allowOverride", !isBlockListEnabled);
+
+        let isTelemetryEnabled = ParentalControls.isAllowed(ParentalControls.TELEMETRY);
+        Services.prefs.setBoolPref("toolkit.telemetry.enabled", isTelemetryEnabled);
+
+        let isHealthReportEnabled = ParentalControls.isAllowed(ParentalControls.HEALTH_REPORT);
+        SharedPreferences.forApp().setBoolPref("android.not_a_preference.healthreport.uploadEnabled", isHealthReportEnabled);
     }
 
     let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
     if (sysInfo.get("version") < 16) {
       let defaults = Services.prefs.getDefaultBranch(null);
       defaults.setBoolPref("media.autoplay.enabled", false);
     }
 
--- a/toolkit/components/parentalcontrols/nsIParentalControlsService.idl
+++ b/toolkit/components/parentalcontrols/nsIParentalControlsService.idl
@@ -6,17 +6,17 @@
 
 #include "nsISupports.idl"
 
 interface nsIURI;
 interface nsIFile;
 interface nsIInterfaceRequestor;
 interface nsIArray;
 
-[scriptable, uuid(f17414cd-d357-476d-b894-2f7bda9e3a9b)]
+[scriptable, uuid(3dc75deb-14cc-4bc3-9369-5002b5275c58)]
 interface nsIParentalControlsService : nsISupports
 {
   /**
    * Action types that can be blocked for users.
    */
   const short DOWNLOAD = 1; // Downloading files
   const short INSTALL_EXTENSION = 2; // Installing extensions
   const short INSTALL_APP = 3; // Installing webapps
@@ -31,16 +31,18 @@ interface nsIParentalControlsService : n
   const short PRIVATE_BROWSING = 12; // Disallow usage of private browsing
   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
   const short ADVANCED_SETTINGS = 17; // Advanced settings
   const short CAMERA_MICROPHONE = 18; // Camera and microphone (WebRTC)
   const short BLOCK_LIST = 19; // Block websites that include sensitive content
+  const short TELEMETRY = 20; // Submit telemetry data
+  const short HEALTH_REPORT = 21; // Submit FHR data
 
   /**
    * @returns true if the current user account has parental controls
    * restrictions enabled.
    */
   readonly attribute boolean parentalControlsEnabled;
 
   /**