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

Unified Diff: talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java

Issue 1668673003: Do not notify networkconnect if the connection type is unknown. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: merge and also check connection type is not NONE Created 4 years, 11 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
« no previous file with comments | « no previous file | talk/app/webrtc/java/jni/androidnetworkmonitor_jni.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java
diff --git a/talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java b/talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java
index e3d6d0cef627cc4b4c36c19dda6572d90ddc13c7..e7cfb74856e477f29f8711649f930691d0e344d8 100644
--- a/talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java
+++ b/talk/app/webrtc/java/android/org/webrtc/NetworkMonitorAutoDetect.java
@@ -132,27 +132,25 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
@Override
public void onAvailable(Network network) {
- NetworkInformation networkInformation = connectivityManagerDelegate.networkToInfo(network);
- Logging.d(TAG, "Network " + networkInformation.name + " with handle " +
- networkInformation.handle + " is connected ");
- observer.onNetworkConnect(networkInformation);
+ Logging.d(TAG, "Network becomes available: " + network.toString());
+ onNetworkChanged(network);
}
@Override
public void onCapabilitiesChanged(
Network network, NetworkCapabilities networkCapabilities) {
// A capabilities change may indicate the ConnectionType has changed,
- // so forward the new NetworkInformation along to observer.
- NetworkInformation networkInformation = connectivityManagerDelegate.networkToInfo(network);
- observer.onNetworkConnect(networkInformation);
+ // so forward the new NetworkInformation along to the observer.
+ Logging.d(TAG, "capabilities changed: " + networkCapabilities.toString());
+ onNetworkChanged(network);
}
@Override
public void onLinkPropertiesChanged(Network network, LinkProperties linkProperties) {
// A link property change may indicate the IP address changes.
// so forward the new NetworkInformation to the observer.
- NetworkInformation networkInformation = connectivityManagerDelegate.networkToInfo(network);
- observer.onNetworkConnect(networkInformation);
+ Logging.d(TAG, "link properties changed: " + linkProperties.toString());
+ onNetworkChanged(network);
}
@Override
@@ -169,6 +167,14 @@ public class NetworkMonitorAutoDetect extends BroadcastReceiver {
Logging.d(TAG, "Network with handle " + handle + " is disconnected");
observer.onNetworkDisconnect(handle);
}
+
+ private void onNetworkChanged(Network network) {
+ NetworkInformation networkInformation = connectivityManagerDelegate.networkToInfo(network);
+ if (networkInformation.type != ConnectionType.CONNECTION_UNKNOWN
+ && networkInformation.type != ConnectionType.CONNECTION_NONE) {
+ observer.onNetworkConnect(networkInformation);
+ }
+ }
}
/** Queries the ConnectivityManager for information about the current connection. */
« no previous file with comments | « no previous file | talk/app/webrtc/java/jni/androidnetworkmonitor_jni.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698