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

Unified Diff: webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc

Issue 2697943002: Return "not implemented" error from BindSocketToNetwork properly. (Closed)
Patch Set: Created 3 years, 10 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 | « webrtc/sdk/android/api/org/webrtc/NetworkMonitorAutoDetect.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc
diff --git a/webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc b/webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc
index 4b3144efcbb553608f5825088e7bbbe4737174b5..7f62bbe68664348c07be694e5b9d7ca716465e64 100644
--- a/webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc
+++ b/webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc
@@ -240,13 +240,15 @@ rtc::NetworkBindingResult AndroidNetworkMonitor::BindSocketToNetwork(
int socket_fd,
const rtc::IPAddress& address) {
RTC_CHECK(thread_checker_.CalledOnValidThread());
+
+ jmethodID network_binding_supported_id = GetMethodID(
+ jni(), *j_network_monitor_class_, "networkBindingSupported", "()Z");
// Android prior to Lollipop didn't have support for binding sockets to
- // networks. In that case it should not have reached here because
- // |network_handle_by_address_| is only populated in Android Lollipop
- // and above.
- if (android_sdk_int_ < SDK_VERSION_LOLLIPOP) {
- LOG(LS_ERROR) << "BindSocketToNetwork is not supported in Android SDK "
- << android_sdk_int_;
+ // networks. This may also occur if there is no connectivity manager service.
+ if (!jni()->CallBooleanMethod(*j_network_monitor_,
magjed_webrtc 2017/02/15 12:27:26 Maybe you should add a CHECK_EXCEPTION(jni()) afte
Taylor Brandstetter 2017/02/15 18:32:24 Done.
+ network_binding_supported_id)) {
+ LOG(LS_WARNING) << "BindSocketToNetwork is not supported on this platform "
+ << "(Android SDK: " << android_sdk_int_ << ")";
return rtc::NetworkBindingResult::NOT_IMPLEMENTED;
}
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/NetworkMonitorAutoDetect.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698