Skip to content

Commit

Permalink
Bug 1694179 - Add workaround for getNetworkLinkType on Android 11. r=…
Browse files Browse the repository at this point in the history
…esawin, a=RyanVM

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
  • Loading branch information
agi committed Feb 25, 2021
1 parent 253c39a commit f115926
Showing 1 changed file with 10 additions and 1 deletion.
Expand Up @@ -1197,7 +1197,16 @@ private static int getNetworkLinkType() {
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:
Expand Down

0 comments on commit f115926

Please sign in to comment.