Add 5G detection to android_network_monitor

This patch adds detection of 5G to andoird_network_monitor
using the TelephonyManager.NETWORK_TYPE_NR.

It also adds
- TelephonyManager.NETWORK_TYPE_GSM as 2G
- TelephonyManager.NETWORK_TYPE_TD_SCDMA as 3G
- TelephonyManager.NETWORK_TYPE_IWLAN as 4G

note: AdapterTypeFromNetworkType still return rtc::ADAPTER_TYPE_CELLULAR
for all cellular connections (changing that is a next step).

Bug: webrtc:11473
Change-Id: If2e681e10b24f46ea0071db0cdba758a8c4e7ee2
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/174500
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31171}
This commit is contained in:
Jonas Oreland
2020-05-06 09:37:31 +02:00
committed by Commit Bot
parent 81be4217b8
commit 5ed65b2e98
3 changed files with 11 additions and 0 deletions

View File

@ -50,6 +50,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
CONNECTION_UNKNOWN,
CONNECTION_ETHERNET,
CONNECTION_WIFI,
CONNECTION_5G,
CONNECTION_4G,
CONNECTION_3G,
CONNECTION_2G,
@ -798,6 +799,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_IDEN:
case TelephonyManager.NETWORK_TYPE_GSM:
return ConnectionType.CONNECTION_2G;
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
@ -808,9 +810,13 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
case TelephonyManager.NETWORK_TYPE_EVDO_B:
case TelephonyManager.NETWORK_TYPE_EHRPD:
case TelephonyManager.NETWORK_TYPE_HSPAP:
case TelephonyManager.NETWORK_TYPE_TD_SCDMA:
return ConnectionType.CONNECTION_3G;
case TelephonyManager.NETWORK_TYPE_LTE:
case TelephonyManager.NETWORK_TYPE_IWLAN:
return ConnectionType.CONNECTION_4G;
case TelephonyManager.NETWORK_TYPE_NR:
return ConnectionType.CONNECTION_5G;
default:
return ConnectionType.CONNECTION_UNKNOWN_CELLULAR;
}