mirror of
https://github.com/androidx/media.git
synced 2025-05-12 10:09:55 +08:00
Support 5G in network type detection
PiperOrigin-RevId: 288280500
This commit is contained in:
parent
6f312c054e
commit
3a31bc1724
@ -977,8 +977,8 @@ public final class C {
|
||||
/**
|
||||
* Network connection type. One of {@link #NETWORK_TYPE_UNKNOWN}, {@link #NETWORK_TYPE_OFFLINE},
|
||||
* {@link #NETWORK_TYPE_WIFI}, {@link #NETWORK_TYPE_2G}, {@link #NETWORK_TYPE_3G}, {@link
|
||||
* #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_CELLULAR_UNKNOWN}, {@link #NETWORK_TYPE_ETHERNET} or
|
||||
* {@link #NETWORK_TYPE_OTHER}.
|
||||
* #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_5G}, {@link #NETWORK_TYPE_CELLULAR_UNKNOWN}, {@link
|
||||
* #NETWORK_TYPE_ETHERNET} or {@link #NETWORK_TYPE_OTHER}.
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@ -989,6 +989,7 @@ public final class C {
|
||||
NETWORK_TYPE_2G,
|
||||
NETWORK_TYPE_3G,
|
||||
NETWORK_TYPE_4G,
|
||||
NETWORK_TYPE_5G,
|
||||
NETWORK_TYPE_CELLULAR_UNKNOWN,
|
||||
NETWORK_TYPE_ETHERNET,
|
||||
NETWORK_TYPE_OTHER
|
||||
@ -1006,6 +1007,8 @@ public final class C {
|
||||
public static final int NETWORK_TYPE_3G = 4;
|
||||
/** Network type for a 4G cellular connection. */
|
||||
public static final int NETWORK_TYPE_4G = 5;
|
||||
/** Network type for a 5G cellular connection. */
|
||||
public static final int NETWORK_TYPE_5G = 9;
|
||||
/**
|
||||
* Network type for cellular connections which cannot be mapped to one of {@link
|
||||
* #NETWORK_TYPE_2G}, {@link #NETWORK_TYPE_3G}, or {@link #NETWORK_TYPE_4G}.
|
||||
@ -1013,10 +1016,7 @@ public final class C {
|
||||
public static final int NETWORK_TYPE_CELLULAR_UNKNOWN = 6;
|
||||
/** Network type for an Ethernet connection. */
|
||||
public static final int NETWORK_TYPE_ETHERNET = 7;
|
||||
/**
|
||||
* Network type for other connections which are not Wifi or cellular (e.g. Ethernet, VPN,
|
||||
* Bluetooth).
|
||||
*/
|
||||
/** Network type for other connections which are not Wifi or cellular (e.g. VPN, Bluetooth). */
|
||||
public static final int NETWORK_TYPE_OTHER = 8;
|
||||
|
||||
/**
|
||||
|
@ -203,9 +203,10 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
|
||||
result.append(C.NETWORK_TYPE_2G, DEFAULT_INITIAL_BITRATE_ESTIMATES_2G[groupIndices[1]]);
|
||||
result.append(C.NETWORK_TYPE_3G, DEFAULT_INITIAL_BITRATE_ESTIMATES_3G[groupIndices[2]]);
|
||||
result.append(C.NETWORK_TYPE_4G, DEFAULT_INITIAL_BITRATE_ESTIMATES_4G[groupIndices[3]]);
|
||||
// Assume default Wifi bitrate for Ethernet to prevent using the slower fallback bitrate.
|
||||
// Assume default Wifi bitrate for Ethernet and 5G to prevent using the slower fallback.
|
||||
result.append(
|
||||
C.NETWORK_TYPE_ETHERNET, DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI[groupIndices[0]]);
|
||||
result.append(C.NETWORK_TYPE_5G, DEFAULT_INITIAL_BITRATE_ESTIMATES_WIFI[groupIndices[0]]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2126,6 +2126,8 @@ public final class Util {
|
||||
return C.NETWORK_TYPE_3G;
|
||||
case TelephonyManager.NETWORK_TYPE_LTE:
|
||||
return C.NETWORK_TYPE_4G;
|
||||
case TelephonyManager.NETWORK_TYPE_NR:
|
||||
return C.NETWORK_TYPE_5G;
|
||||
case TelephonyManager.NETWORK_TYPE_IWLAN:
|
||||
return C.NETWORK_TYPE_WIFI;
|
||||
case TelephonyManager.NETWORK_TYPE_GSM:
|
||||
|
Loading…
x
Reference in New Issue
Block a user