Commit b8ed960d authored by Yu Su's avatar Yu Su Committed by Commit Bot

Add 5G connection type in network_change_notifier_mac.

5G connection type is not added in network_change_notifier_mac.mm
currently. It leads to crash in Cronet when testing 5G network on iOS
(b/171830601).

Change-Id: I781ef9a253ff0e473fba7eceaf549ef2bc011c83
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2506300
Commit-Queue: Yu Su <yuyansu@google.com>
Reviewed-by: default avatarDavid Schinazi <dschinazi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822014}
parent 7dd0c706
...@@ -113,6 +113,10 @@ NetworkChangeNotifierMac::CalculateConnectionType( ...@@ -113,6 +113,10 @@ NetworkChangeNotifierMac::CalculateConnectionType(
CTRadioAccessTechnologyeHRPD, nil]; CTRadioAccessTechnologyeHRPD, nil];
NSSet<NSString*>* technologies_4g = NSSet<NSString*>* technologies_4g =
[NSSet setWithObjects:CTRadioAccessTechnologyLTE, nil]; [NSSet setWithObjects:CTRadioAccessTechnologyLTE, nil];
// TODO: Use constants from CoreTelephony once Cronet builds with XCode 12.1
NSSet<NSString*>* technologies_5g =
[NSSet setWithObjects:@"CTRadioAccessTechnologyNRNSA",
@"CTRadioAccessTechnologyNR", nil];
int best_network = 0; int best_network = 0;
for (NSString* service in service_current_radio_access_technology) { for (NSString* service in service_current_radio_access_technology) {
if (!service_current_radio_access_technology[service]) { if (!service_current_radio_access_technology[service]) {
...@@ -128,6 +132,8 @@ NetworkChangeNotifierMac::CalculateConnectionType( ...@@ -128,6 +132,8 @@ NetworkChangeNotifierMac::CalculateConnectionType(
current_network = 3; current_network = 3;
} else if ([technologies_4g containsObject:network_type]) { } else if ([technologies_4g containsObject:network_type]) {
current_network = 4; current_network = 4;
} else if ([technologies_5g containsObject:network_type]) {
current_network = 5;
} else { } else {
// New technology? // New technology?
NOTREACHED(); NOTREACHED();
...@@ -145,6 +151,8 @@ NetworkChangeNotifierMac::CalculateConnectionType( ...@@ -145,6 +151,8 @@ NetworkChangeNotifierMac::CalculateConnectionType(
return CONNECTION_3G; return CONNECTION_3G;
case 4: case 4:
return CONNECTION_4G; return CONNECTION_4G;
case 5:
return CONNECTION_5G;
default: default:
// Default to CONNECTION_3G to not change existing behavior. // Default to CONNECTION_3G to not change existing behavior.
return CONNECTION_3G; return CONNECTION_3G;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment