bug 918645 - rash in java.lang.SecurityException: WifiService: Neither user 10061 nor current process has android.permission.ACCESS_WIFI_STATE. at android.os.Parcel.readException(Parcel.java r=mcmanus

--HG--
extra : rebase_source : fb48217a5654ceba1ec0361466af5698d2f2e3c5
This commit is contained in:
Brad Lassey 2013-09-20 15:58:10 -04:00
parent 0fcc4a14b4
commit 444daf2f5c

View File

@ -148,7 +148,7 @@ public class GeckoNetworkManager extends BroadcastReceiver {
if (mNetworkType != NetworkType.NETWORK_WIFI) {
return 0;
}
try {
WifiManager mgr = (WifiManager)sInstance.mApplicationContext.getSystemService(Context.WIFI_SERVICE);
DhcpInfo d = mgr.getDhcpInfo();
if (d == null) {
@ -156,6 +156,13 @@ public class GeckoNetworkManager extends BroadcastReceiver {
}
return d.gateway;
} catch (Exception ex) {
// getDhcpInfo() is not documented to require any permissions, but on some devices
// requires android.permission.ACCESS_WIFI_STATE. Just catching the generic exeption
// here and returning 0. Not logging because this could be noisy
return 0;
}
}
private void updateNetworkType() {