commit 2f95c5a75f74fb9f34c60940a5e1285162f696d5 Author: Matthew Finkel Matthew.Finkel@gmail.com Date: Wed Apr 11 17:52:59 2018 +0000
Bug 25741 - TBA: Conditionally require WIFI and NETWORK permissions
Only require the {ACCESS,CHANGE}_WIFI_STATE and ACCESS_NETWORK_STATE permissions if MOZ_ANDROID_NETWORK_STATE is defined in the preprocessor. --- mobile/android/base/FennecManifest_permissions.xml.in | 3 +++ mobile/android/geckoview/src/main/AndroidManifest.xml | 2 ++ mobile/android/moz.configure | 4 ++++ .../services/manifests/FxAccountAndroidManifest_permissions.xml.in | 2 ++ mobile/android/torbrowser.configure | 2 ++ 5 files changed, 13 insertions(+)
diff --git a/mobile/android/base/FennecManifest_permissions.xml.in b/mobile/android/base/FennecManifest_permissions.xml.in index 94bd1b39e0e0..747f1e988147 100644 --- a/mobile/android/base/FennecManifest_permissions.xml.in +++ b/mobile/android/base/FennecManifest_permissions.xml.in @@ -8,8 +8,11 @@ (potentially) of the push feature. --> #include GcmAndroidManifest_permissions.xml.in
+#ifdef MOZ_ANDROID_NETWORK_STATE + <!-- Android WIFI state --> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> +#endif <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"/> diff --git a/mobile/android/geckoview/src/main/AndroidManifest.xml b/mobile/android/geckoview/src/main/AndroidManifest.xml index c99c76efdd57..2a84ae4611ad 100644 --- a/mobile/android/geckoview/src/main/AndroidManifest.xml +++ b/mobile/android/geckoview/src/main/AndroidManifest.xml @@ -1,11 +1,13 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.mozilla.geckoview">
+#ifdef MOZ_ANDROID_NETWORK_STATE <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"/> +#endif <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"/> diff --git a/mobile/android/moz.configure b/mobile/android/moz.configure index df9eb2038075..468ec4723632 100644 --- a/mobile/android/moz.configure +++ b/mobile/android/moz.configure @@ -185,3 +185,7 @@ def check_android_gcm(android_gcm, if not google_play_services: die('You must specify --with-google-play-services when' ' building with MOZ_ANDROID_GCM=1') + +project_flag('MOZ_ANDROID_NETWORK_STATE', + help='Include permission for accessing WiFi/network state on Android', + default=False) diff --git a/mobile/android/services/manifests/FxAccountAndroidManifest_permissions.xml.in b/mobile/android/services/manifests/FxAccountAndroidManifest_permissions.xml.in index d5c7e3e5c7dc..8498b8015855 100644 --- a/mobile/android/services/manifests/FxAccountAndroidManifest_permissions.xml.in +++ b/mobile/android/services/manifests/FxAccountAndroidManifest_permissions.xml.in @@ -1,5 +1,7 @@ <uses-permission android:name="android.permission.GET_ACCOUNTS" /> +#ifdef MOZ_ANDROID_NETWORK_STATE <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> +#endif <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> diff --git a/mobile/android/torbrowser.configure b/mobile/android/torbrowser.configure index 5e3ab67dca6a..3e84355774d5 100644 --- a/mobile/android/torbrowser.configure +++ b/mobile/android/torbrowser.configure @@ -41,3 +41,5 @@ imply_option('MOZ_SERVICES_HEALTHREPORT', False) # them here, as well. #imply_option('MOZ_TELEMETRY_REPORTING', False) #imply_option('MOZ_DATA_REPORTING', False) + +imply_option('MOZ_ANDROID_NETWORK_STATE', False);
tbb-commits@lists.torproject.org