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

Side by Side Diff: webrtc/sdk/android/src/jni/androidnetworkmonitor_jni.cc

Issue 2951803003: Listen for Wifi-Direct networks and include them in the network list (Closed)
Patch Set: Suppress InlinedApi warning Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « webrtc/sdk/android/api/org/webrtc/NetworkMonitorAutoDetect.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 network_info_by_handle_.clear(); 222 network_info_by_handle_.clear();
223 } 223 }
224 224
225 // The implementation is largely taken from UDPSocketPosix::BindToNetwork in 225 // The implementation is largely taken from UDPSocketPosix::BindToNetwork in
226 // https://cs.chromium.org/chromium/src/net/udp/udp_socket_posix.cc 226 // https://cs.chromium.org/chromium/src/net/udp/udp_socket_posix.cc
227 rtc::NetworkBindingResult AndroidNetworkMonitor::BindSocketToNetwork( 227 rtc::NetworkBindingResult AndroidNetworkMonitor::BindSocketToNetwork(
228 int socket_fd, 228 int socket_fd,
229 const rtc::IPAddress& address) { 229 const rtc::IPAddress& address) {
230 RTC_CHECK(thread_checker_.CalledOnValidThread()); 230 RTC_CHECK(thread_checker_.CalledOnValidThread());
231 231
232 if (socket_fd == 0 /* NETWORK_UNSPECIFIED */) {
233 return rtc::NetworkBindingResult::NOT_IMPLEMENTED;
234 }
235
232 jmethodID network_binding_supported_id = GetMethodID( 236 jmethodID network_binding_supported_id = GetMethodID(
233 jni(), *j_network_monitor_class_, "networkBindingSupported", "()Z"); 237 jni(), *j_network_monitor_class_, "networkBindingSupported", "()Z");
234 // Android prior to Lollipop didn't have support for binding sockets to 238 // Android prior to Lollipop didn't have support for binding sockets to
235 // networks. This may also occur if there is no connectivity manager service. 239 // networks. This may also occur if there is no connectivity manager service.
236 bool network_binding_supported = jni()->CallBooleanMethod( 240 bool network_binding_supported = jni()->CallBooleanMethod(
237 *j_network_monitor_, network_binding_supported_id); 241 *j_network_monitor_, network_binding_supported_id);
238 CHECK_EXCEPTION(jni()) 242 CHECK_EXCEPTION(jni())
239 << "Error during NetworkMonitor.networkBindingSupported"; 243 << "Error during NetworkMonitor.networkBindingSupported";
240 if (!network_binding_supported) { 244 if (!network_binding_supported) {
241 LOG(LS_WARNING) << "BindSocketToNetwork is not supported on this platform " 245 LOG(LS_WARNING) << "BindSocketToNetwork is not supported on this platform "
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( 424 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)(
421 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, 425 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor,
422 jlong network_handle) { 426 jlong network_handle) {
423 AndroidNetworkMonitor* network_monitor = 427 AndroidNetworkMonitor* network_monitor =
424 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); 428 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor);
425 network_monitor->OnNetworkDisconnected( 429 network_monitor->OnNetworkDisconnected(
426 static_cast<NetworkHandle>(network_handle)); 430 static_cast<NetworkHandle>(network_handle));
427 } 431 }
428 432
429 } // namespace webrtc_jni 433 } // namespace webrtc_jni
OLDNEW
« 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