Bug 1491094 - Don't require ACCESS_WIFI_STATE for GeckoView r=droeh
authorJames Willcox <snorp@snorp.net>
Fri, 28 Sep 2018 18:34:57 +0000
changeset 497158 149bad7f0537378befc983add77a57fd55415fe5
parent 497157 02f06f657185208fdd389ff82f0a7d0b144c8223
child 497159 684521e3af2ff1029d60bb207ae0d75058c3ce1f
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh
bugs1491094
milestone64.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 1491094 - Don't require ACCESS_WIFI_STATE for GeckoView r=droeh Fennec will continue to require this. While we're here, also make 'touchscreen' feature optional. Differential Revision: https://phabricator.services.mozilla.com/D7125
mobile/android/geckoview/src/main/AndroidManifest.xml
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
--- a/mobile/android/geckoview/src/main/AndroidManifest.xml
+++ b/mobile/android/geckoview/src/main/AndroidManifest.xml
@@ -1,51 +1,42 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="org.mozilla.geckoview">
 
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.WAKE_LOCK"/>
     <uses-permission android:name="android.permission.VIBRATE"/>
 
     <uses-feature
             android:name="android.hardware.location"
             android:required="false"/>
     <uses-feature
             android:name="android.hardware.location.gps"
             android:required="false"/>
-    <uses-feature android:name="android.hardware.touchscreen"/>
+    <uses-feature
+            android:name="android.hardware.touchscreen"
+            android:required="false"/>
     <uses-feature
             android:name="android.hardware.camera"
             android:required="false"/>
     <uses-feature
             android:name="android.hardware.camera.autofocus"
             android:required="false"/>
 
-    <!-- #ifdef MOZ_WEBRTC -->
-    <!--
-         TODO preprocess AndroidManifest.xml so that we can
-         conditionally include WebRTC permissions based on MOZ_WEBRTC.
-    -->
     <uses-feature
             android:name="android.hardware.audio.low_latency"
             android:required="false"/>
-    -->
     <uses-feature
             android:name="android.hardware.microphone"
             android:required="false"/>
-    -->
     <uses-feature
             android:name="android.hardware.camera.any"
             android:required="false"/>
-    -->
-    <!-- #endif -->
-
 
     <!-- GeckoView requires OpenGL ES 2.0 -->
     <uses-feature
             android:glEsVersion="0x00020000"
             android:required="true"/>
 
     <application>
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoNetworkManager.java
@@ -385,16 +385,20 @@ public class GeckoNetworkManager extends
 
     private static int wifiDhcpGatewayAddress(final Context context) {
         if (context == null) {
             return 0;
         }
 
         try {
             WifiManager mgr = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+            if (mgr == null) {
+                return 0;
+            }
+
             DhcpInfo d = mgr.getDhcpInfo();
             if (d == null) {
                 return 0;
             }
 
             return d.gateway;
 
         } catch (Exception ex) {
@@ -411,16 +415,19 @@ public class GeckoNetworkManager extends
      */
     public void handleMessage(final String event, final GeckoBundle message,
                               final EventCallback callback) {
         final Context applicationContext = GeckoAppShell.getApplicationContext();
         switch (event) {
             case "Wifi:Enable":
                 final WifiManager mgr = (WifiManager)
                         applicationContext.getSystemService(Context.WIFI_SERVICE);
+                if (mgr == null) {
+                    return;
+                }
 
                 if (!mgr.isWifiEnabled()) {
                     mgr.setWifiEnabled(true);
                     break;
                 }
 
                 // If Wifi is enabled, maybe you need to select a network
                 Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);