Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java

Issue 2112963002: Add UNKNOWN_CELLULAR network type and allow unknown network type in NetworkMonitor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java
diff --git a/webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java b/webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java
index c4e3a901c970fc8f3b9543c309bd8838c47813c8..4335e5ce73ba99e34aaa64cf53c5870f7598d1ad 100644
--- a/webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java
+++ b/webrtc/api/java/android/org/webrtc/NetworkMonitorAutoDetect.java
@@ -55,6 +55,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
CONNECTION_4G,
CONNECTION_3G,
CONNECTION_2G,
+ CONNECTION_UNKNOWN_CELLULAR,
CONNECTION_BLUETOOTH,
CONNECTION_NONE
}
@@ -292,17 +293,24 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
return null;
}
- ConnectionType connectionType = getConnectionType(getNetworkState(network));
- if (connectionType == ConnectionType.CONNECTION_UNKNOWN
- || connectionType == ConnectionType.CONNECTION_NONE) {
+ NetworkState networkState = getNetworkState(network);
+ ConnectionType connectionType = getConnectionType(networkState);
+ if (connectionType == ConnectionType.CONNECTION_NONE) {
// This may not be an error. The OS may signal a network event with connection type
- // NONE when the network disconnects. But in some devices, the OS may incorrectly
- // report an UNKNOWN connection type. In either case, it won't benefit to send down
- // a network event with this connection type.
- Logging.d(TAG, "Network " + network.toString() + " has connection type " + connectionType);
+ // NONE when the network disconnects.
+ Logging.d(TAG, "Network " + network.toString() + " is disconnected");
return null;
}
+ // Some android device may return a CONNECTION_UNKNOWN_CELLULAR or CONNECTION_UNKNOWN type,
+ // which appears to be usable. Just log them here.
+ if (connectionType == ConnectionType.CONNECTION_UNKNOWN
+ || connectionType == ConnectionType.CONNECTION_UNKNOWN_CELLULAR) {
+ Logging.d(TAG, "Network " + network.toString() + " connection type is " + connectionType
+ + " because it has type " + networkState.getNetworkType()
+ + " and subtype " + networkState.getNetworkSubType());
+ }
+
NetworkInformation networkInformation = new NetworkInformation(
linkProperties.getInterfaceName(),
connectionType,
@@ -569,7 +577,7 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
case TelephonyManager.NETWORK_TYPE_LTE:
return ConnectionType.CONNECTION_4G;
default:
- return ConnectionType.CONNECTION_UNKNOWN;
+ return ConnectionType.CONNECTION_UNKNOWN_CELLULAR;
}
default:
return ConnectionType.CONNECTION_UNKNOWN;
« no previous file with comments | « webrtc/api/java/android/org/webrtc/NetworkMonitor.java ('k') | webrtc/api/java/jni/androidnetworkmonitor_jni.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698