Bug 1125309 - Restricted profiles: Hide all Location Services features and related UI. r=margaret
authorSebastian Kaspari <s.kaspari@gmail.com>
Thu, 30 Jul 2015 20:18:03 +0200
changeset 287158 0f5b42aa89276bcffcce2728507a4c7626b7be95
parent 287157 4a0743e93d6f2caf2c48031b1f74f89d1f855bef
child 287159 2384042162833c8a3f99cc58b3d9b95e3f6bc20e
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1125309
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1125309 - Restricted profiles: Hide all Location Services features and related UI. r=margaret
mobile/android/base/BrowserApp.java
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/preferences/GeckoPreferences.java
mobile/android/base/restrictions/RestrictedProfileConfiguration.java
mobile/android/base/restrictions/Restriction.java
mobile/android/base/strings.xml.in
toolkit/components/parentalcontrols/nsIParentalControlsService.idl
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1971,17 +1971,17 @@ public class BrowserApp extends GeckoApp
                                 getSupportFragmentManager().beginTransaction().disallowAddToBackStack().add(mpm, tag).commit();
                             }
                         } catch (Exception ex) {
                             Log.e(LOGTAG, "Error initializing media manager", ex);
                         }
                     }
                 }
 
-                if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED) {
+                if (AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED && RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
                     // 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.
                     final long oneSecondInMillis = 1000;
                     ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
                         @Override
                         public void run() {
                              GeckoPreferences.broadcastStumblerPref(BrowserApp.this);
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -694,8 +694,10 @@ just addresses the organization to follo
 <!ENTITY restriction_disallow_apps_title "Disallow apps">
 <!ENTITY restriction_disallow_apps_description "Disallow installing apps from Firefox Marketplace.">
 <!ENTITY restriction_disallow_devtools_title "Disallow developer tools">
 <!ENTITY restriction_disallow_devtools_description "Disallow usage of developer tools.">
 <!ENTITY restriction_disallow_customize_home_title "Disallow customizing home">
 <!ENTITY restriction_disallow_customize_home_description "Disallow customizing home panels.">
 <!ENTITY restriction_disallow_private_browsing_title "Disallow private browsing">
 <!ENTITY restriction_disallow_private_browsing_description "Disallow private browsing mode.">
+<!ENTITY restriction_disallow_location_services_title "Disallow location services">
+<!ENTITY restriction_disallow_location_services_description "Disallow sharing of location data to improve geolocation service.">
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -761,17 +761,17 @@ OnSharedPreferenceChangeListener
                 } else if (PREFS_CRASHREPORTER_ENABLED.equals(key)) {
                     if (!AppConstants.MOZ_CRASHREPORTER) {
                         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) {
+                    if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_LOCATION_SERVICE)) {
                         preferences.removePreference(pref);
                         i--;
                         continue;
                     }
                 } else if (PREFS_DEVTOOLS_REMOTE_USB_ENABLED.equals(key)) {
                     if (!RestrictedProfiles.isAllowed(this, Restriction.DISALLOW_REMOTE_DEBUGGING)) {
                         preferences.removePreference(pref);
                         i--;
--- a/mobile/android/base/restrictions/RestrictedProfileConfiguration.java
+++ b/mobile/android/base/restrictions/RestrictedProfileConfiguration.java
@@ -18,17 +18,18 @@ public class RestrictedProfileConfigurat
     static List<Restriction> DEFAULT_RESTRICTIONS = Arrays.asList(
             Restriction.DISALLOW_INSTALL_EXTENSION,
             Restriction.DISALLOW_INSTALL_APPS,
             Restriction.DISALLOW_TOOLS_MENU,
             Restriction.DISALLOW_REPORT_SITE_ISSUE,
             Restriction.DISALLOW_IMPORT_SETTINGS,
             Restriction.DISALLOW_DEVELOPER_TOOLS,
             Restriction.DISALLOW_CUSTOMIZE_HOME,
-            Restriction.DISALLOW_PRIVATE_BROWSING
+            Restriction.DISALLOW_PRIVATE_BROWSING,
+            Restriction.DISALLOW_LOCATION_SERVICE
     );
 
     private static final String ABOUT_ADDONS = "about:addons";
     private static final String ABOUT_PRIVATE_BROWSING = "about:privatebrowsing";
 
     private Context context;
 
     public RestrictedProfileConfiguration(Context context) {
--- a/mobile/android/base/restrictions/Restriction.java
+++ b/mobile/android/base/restrictions/Restriction.java
@@ -77,16 +77,22 @@ public enum Restriction {
             R.string.restriction_disallow_customize_home_title,
             R.string.restriction_disallow_customize_home_description
     ),
 
     DISALLOW_PRIVATE_BROWSING(
             16, "no_private_browsing",
             R.string.restriction_disallow_private_browsing_title,
             R.string.restriction_disallow_private_browsing_description
+    ),
+
+    DISALLOW_LOCATION_SERVICE(
+            17, "no_location_service",
+            R.string.restriction_disallow_location_services_title,
+            R.string.restriction_disallow_location_services_description
     );
 
     public final int id;
     public final String name;
     public final int titleResource;
     public final int descriptionResource;
 
     Restriction(final int id, final String name, int titleResource, int descriptionResource) {
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -550,16 +550,18 @@
   <string name="restriction_disallow_apps_title">&restriction_disallow_apps_title;</string>
   <string name="restriction_disallow_apps_description">&restriction_disallow_apps_description;</string>
   <string name="restriction_disallow_devtools_title">&restriction_disallow_devtools_title;</string>
   <string name="restriction_disallow_devtools_description">&restriction_disallow_devtools_description;</string>
   <string name="restriction_disallow_customize_home_title">&restriction_disallow_customize_home_title;</string>
   <string name="restriction_disallow_customize_home_description">&restriction_disallow_customize_home_description;</string>
   <string name="restriction_disallow_private_browsing_title">&restriction_disallow_private_browsing_title;</string>
   <string name="restriction_disallow_private_browsing_description">&restriction_disallow_private_browsing_description;</string>
+  <string name="restriction_disallow_location_services_title">&restriction_disallow_location_services_title;</string>
+  <string name="restriction_disallow_location_services_description">&restriction_disallow_location_services_description;</string>
 
   <!-- Miscellaneous -->
   <string name="ellipsis">&ellipsis;</string>
 
   <string name="colon">&colon;</string>
 
   <string name="percent">&percent;</string>
 
--- 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(95e1b8cc-c26b-4393-a27e-b630d46183a9)]
+[scriptable, uuid(4ee714a7-e9a8-43ed-a061-60155b63e290)]
 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
@@ -26,16 +26,17 @@ interface nsIParentalControlsService : n
   const short ADD_CONTACT = 7; // Add contacts to the system database
   const short SET_IMAGE = 8; // Setting images as wall paper
   const short MODIFY_ACCOUNTS = 9; // Modifying system accounts
   const short REMOTE_DEBUGGING = 10; // Remote debugging
   const short IMPORT_SETTINGS = 11; // Importing settings from other apps
   const short TOOLS_MENU = 12; // Hide tools menu entry
   const short REPORT_SITE_ISSUE = 13; // Hide "Report Site Issue" menu entry
   const short PRIVATE_BROWSING = 16; // Disallow usage of private browsing
+  const short LOCATION_SERVICE = 17; // Sharing of location data to location service
 
   /**
    * @returns true if the current user account has parental controls
    * restrictions enabled.
    */
   readonly attribute boolean parentalControlsEnabled;
 
   /**