Bug 1694179 - Add workaround for getNetworkLinkType on Android 11. r=esawin

I have a better fix but let's land this in the meanwhile as this crashes at
startup on any Android 11 device.

Differential Revision: https://phabricator.services.mozilla.com/D106547
This commit is contained in:
Agi Sferro 2021-02-25 21:50:19 +00:00
parent f1229ce794
commit 79b1179eb9

View File

@ -1197,7 +1197,16 @@ public class GeckoAppShell {
return LINK_TYPE_UNKNOWN;
}
switch (tm.getNetworkType()) {
final int networkType;
try {
// Bug 1694179 workaround, on Android 11 this throws
networkType = tm.getNetworkType();
} catch (final Exception ex) {
return LINK_TYPE_4G;
}
switch (networkType) {
case TelephonyManager.NETWORK_TYPE_IDEN:
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_GPRS: