bug 944043 - security exception on start up for GeckoView app r=mfinkle

This commit is contained in:
Brad Lassey 2013-11-27 18:37:44 -05:00
parent 5ba16c0086
commit 1e976cbe99
2 changed files with 16 additions and 4 deletions

View File

@ -1515,9 +1515,13 @@ public class GeckoAppShell
public static boolean isNetworkLinkUp() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cm.getActiveNetworkInfo();
if (info == null || !info.isConnected())
try {
NetworkInfo info = cm.getActiveNetworkInfo();
if (info == null || !info.isConnected())
return false;
} catch (SecurityException se) {
return false;
}
return true;
}
@ -1525,8 +1529,12 @@ public class GeckoAppShell
public static boolean isNetworkLinkKnown() {
ConnectivityManager cm = (ConnectivityManager)
getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm.getActiveNetworkInfo() == null)
try {
if (cm.getActiveNetworkInfo() == null)
return false;
} catch (SecurityException se) {
return false;
}
return true;
}

View File

@ -220,7 +220,11 @@ public class GeckoNetworkManager extends BroadcastReceiver {
return NetworkType.NETWORK_NONE;
}
NetworkInfo ni = cm.getActiveNetworkInfo();
NetworkInfo ni = null;
try {
ni = cm.getActiveNetworkInfo();
} catch (SecurityException se) {} // if we don't have the permission, fall through to null check
if (ni == null) {
return NetworkType.NETWORK_NONE;
}