diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index 07aa070b44..ac78d065fd 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -66,6 +66,7 @@ if (is_android) { ":native_api_base", ":native_api_codecs", ":native_api_jni", + ":native_api_network_monitor", ":native_api_peerconnection", ":native_api_stacktrace", ":native_api_video", @@ -846,13 +847,16 @@ if (current_os == "linux" || is_android) { sources = [ "native_api/base/init.cc", "native_api/base/init.h", - "native_api/base/network_monitor.cc", "native_api/base/network_monitor.h", ] deps = [ ":base_jni", ":native_api_jni", + + # TODO(deadbeef): Remove this once clients start depending on + # native_network_monitor directly. + ":native_api_network_monitor", "//rtc_base", "//rtc_base:checks", ] @@ -904,6 +908,19 @@ if (current_os == "linux" || is_android) { ] } + rtc_library("native_api_network_monitor") { + visibility = [ "*" ] + sources = [ + "native_api/network_monitor/network_monitor.cc", + "native_api/network_monitor/network_monitor.h", + ] + + deps = [ + ":base_jni", + "//rtc_base", + ] + } + # API for creating Java PeerConnectionFactory from C++ equivalents. rtc_library("native_api_peerconnection") { visibility = [ "*" ] diff --git a/sdk/android/native_api/base/network_monitor.h b/sdk/android/native_api/base/network_monitor.h index d0d354961f..fc7d3e54c5 100644 --- a/sdk/android/native_api/base/network_monitor.h +++ b/sdk/android/native_api/base/network_monitor.h @@ -11,26 +11,8 @@ #ifndef SDK_ANDROID_NATIVE_API_BASE_NETWORK_MONITOR_H_ #define SDK_ANDROID_NATIVE_API_BASE_NETWORK_MONITOR_H_ -#include - -#include - -#include "rtc_base/network_monitor_factory.h" - -namespace webrtc { - -// Creates an Android-specific network monitor, which is capable of detecting -// network changes as soon as they occur, requesting a cellular interface -// (dependent on permissions), and binding sockets to network interfaces (more -// reliable than binding to IP addresses on Android). -std::unique_ptr CreateAndroidNetworkMonitorFactory( - JNIEnv* env, - jobject application_context); - -// Deprecated. Pass in application context instead. -std::unique_ptr -CreateAndroidNetworkMonitorFactory(); - -} // namespace webrtc +// TODO(deadbeef): Remove this forwarding header once clients switch to the +// new one. +#include "sdk/android/native_api/network_monitor/network_monitor.h" #endif // SDK_ANDROID_NATIVE_API_BASE_NETWORK_MONITOR_H_ diff --git a/sdk/android/native_api/base/network_monitor.cc b/sdk/android/native_api/network_monitor/network_monitor.cc similarity index 93% rename from sdk/android/native_api/base/network_monitor.cc rename to sdk/android/native_api/network_monitor/network_monitor.cc index 515e9f21fb..38be7fdef7 100644 --- a/sdk/android/native_api/base/network_monitor.cc +++ b/sdk/android/native_api/network_monitor/network_monitor.cc @@ -8,7 +8,7 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "sdk/android/native_api/base/network_monitor.h" +#include "sdk/android/native_api/network_monitor/network_monitor.h" #include diff --git a/sdk/android/native_api/network_monitor/network_monitor.h b/sdk/android/native_api/network_monitor/network_monitor.h new file mode 100644 index 0000000000..45ecd75543 --- /dev/null +++ b/sdk/android/native_api/network_monitor/network_monitor.h @@ -0,0 +1,36 @@ +/* + * Copyright 2018 The WebRTC project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef SDK_ANDROID_NATIVE_API_NETWORK_MONITOR_NETWORK_MONITOR_H_ +#define SDK_ANDROID_NATIVE_API_NETWORK_MONITOR_NETWORK_MONITOR_H_ + +#include + +#include + +#include "rtc_base/network_monitor_factory.h" + +namespace webrtc { + +// Creates an Android-specific network monitor, which is capable of detecting +// network changes as soon as they occur, requesting a cellular interface +// (dependent on permissions), and binding sockets to network interfaces (more +// reliable than binding to IP addresses on Android). +std::unique_ptr CreateAndroidNetworkMonitorFactory( + JNIEnv* env, + jobject application_context); + +// Deprecated. Pass in application context instead. +std::unique_ptr +CreateAndroidNetworkMonitorFactory(); + +} // namespace webrtc + +#endif // SDK_ANDROID_NATIVE_API_NETWORK_MONITOR_NETWORK_MONITOR_H_