Bug 1434469 - Add ACCESS_COARSE_LOCATION to list of permissions; r=snorp
authorJim Chen <nchen@mozilla.com>
Tue, 13 Feb 2018 13:01:18 -0500
changeset 456098 12e36be8f26008904e67b48f2da01707dbfacce3
parent 456097 35d9bc4727d2405f78b86020d99164f99781d8a8
child 456099 55fff88d6d890cf0ab3c7a0e421c4d8d8485086a
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1434469
milestone60.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 1434469 - Add ACCESS_COARSE_LOCATION to list of permissions; r=snorp Add ACCESS_COARSE_LOCATION to the Fennec and GeckoView list of permissions. For completeness, also add ACCESS_COARSE_LOCATION to JS modules that handle runtime permissions. MozReview-Commit-ID: 8UHaiJcRnq
mobile/android/base/FennecManifest_permissions.xml.in
mobile/android/components/geckoview/GeckoViewPermission.js
mobile/android/geckoview/src/main/AndroidManifest.xml
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java
mobile/android/modules/RuntimePermissions.jsm
testing/mozbase/mozrunner/mozrunner/devices/android_device.py
--- a/mobile/android/base/FennecManifest_permissions.xml.in
+++ b/mobile/android/base/FennecManifest_permissions.xml.in
@@ -5,16 +5,17 @@
      RECEIVE_BOOT_COMPLETED and the permission for push.  We want to ask for
      them during the same release, which should be Fennec 48.  Therefore we
      decouple the push permission from MOZ_ANDROID_GCM to let it ride ahead
      (potentially) of the push feature. -->
 #include GcmAndroidManifest_permissions.xml.in
 
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
     <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
--- a/mobile/android/components/geckoview/GeckoViewPermission.js
+++ b/mobile/android/components/geckoview/GeckoViewPermission.js
@@ -6,16 +6,17 @@ ChromeUtils.import("resource://gre/modul
 
 XPCOMUtils.defineLazyModuleGetters(this, {
   EventDispatcher: "resource://gre/modules/Messaging.jsm",
   GeckoViewUtils: "resource://gre/modules/GeckoViewUtils.jsm",
   Services: "resource://gre/modules/Services.jsm",
 });
 
 // See: http://developer.android.com/reference/android/Manifest.permission.html
+const PERM_ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
 const PERM_ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
 const PERM_CAMERA = "android.permission.CAMERA";
 const PERM_RECORD_AUDIO = "android.permission.RECORD_AUDIO";
 
 function GeckoViewPermission() {
   this.wrappedJSObject = this;
 }
 
--- a/mobile/android/geckoview/src/main/AndroidManifest.xml
+++ b/mobile/android/geckoview/src/main/AndroidManifest.xml
@@ -1,13 +1,14 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.mozilla.geckoview">
 
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/>
     <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoSession.java
@@ -1798,16 +1798,17 @@ public class GeckoSession extends LayerS
             void reject();
         }
 
         /**
          * Request Android app permissions.
          *
          * @param session GeckoSession instance requesting the permissions.
          * @param permissions List of permissions to request; possible values are,
+         *                    android.Manifest.permission.ACCESS_COARSE_LOCATION
          *                    android.Manifest.permission.ACCESS_FINE_LOCATION
          *                    android.Manifest.permission.CAMERA
          *                    android.Manifest.permission.RECORD_AUDIO
          * @param callback Callback interface.
          */
         void requestAndroidPermissions(GeckoSession session, String[] permissions,
                                        Callback callback);
 
--- a/mobile/android/modules/RuntimePermissions.jsm
+++ b/mobile/android/modules/RuntimePermissions.jsm
@@ -7,22 +7,24 @@
 this.EXPORTED_SYMBOLS = ["RuntimePermissions"];
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "EventDispatcher",
                                "resource://gre/modules/Messaging.jsm");
 
 // See: http://developer.android.com/reference/android/Manifest.permission.html
+const ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
 const ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
 const CAMERA = "android.permission.CAMERA";
 const RECORD_AUDIO = "android.permission.RECORD_AUDIO";
 const WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
 
 var RuntimePermissions = {
+  ACCESS_COARSE_LOCATION: ACCESS_COARSE_LOCATION,
   ACCESS_FINE_LOCATION: ACCESS_FINE_LOCATION,
   CAMERA: CAMERA,
   RECORD_AUDIO: RECORD_AUDIO,
   WRITE_EXTERNAL_STORAGE: WRITE_EXTERNAL_STORAGE,
 
   /**
    * Check whether the permissions have been granted or not. If needed prompt the user to accept the permissions.
    *
--- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py
@@ -378,16 +378,17 @@ def grant_runtime_permissions(build_obj)
     dm = DeviceManagerADB(autoconnect=False, adbPath=adb_path, retryLimit=1)
     dm.default_timeout = 10
     try:
         sdk_level = dm.shellCheckOutput(['getprop', 'ro.build.version.sdk'])
         if sdk_level and int(sdk_level) >= 23:
             _log_info("Granting important runtime permissions to %s" % app)
             dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.WRITE_EXTERNAL_STORAGE'])
             dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.READ_EXTERNAL_STORAGE'])
+            dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.ACCESS_COARSE_LOCATION'])
             dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.ACCESS_FINE_LOCATION'])
             dm.shellCheckOutput(['pm', 'grant', app, 'android.permission.CAMERA'])
     except DMError:
         _log_warning("Unable to grant runtime permissions to %s" % app)
 
 
 class AndroidEmulator(object):