Move Android network monitor to separate target/directory.

Not sure why it was lumped in with base in the first place.
But now that it's not set via a static method, it makes less sense.

Bug: webrtc:9883
Change-Id: Ia46834865fa485c9949a01fec10cecba465246ba
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180741
Commit-Queue: Taylor <deadbeef@webrtc.org>
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31852}
This commit is contained in:
Taylor Brandstetter 2020-08-04 19:10:02 +00:00 committed by Commit Bot
parent 702dcb6bc3
commit ebf31b346b
4 changed files with 58 additions and 23 deletions

View File

@ -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 = [ "*" ]

View File

@ -11,26 +11,8 @@
#ifndef SDK_ANDROID_NATIVE_API_BASE_NETWORK_MONITOR_H_
#define SDK_ANDROID_NATIVE_API_BASE_NETWORK_MONITOR_H_
#include <jni.h>
#include <memory>
#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<rtc::NetworkMonitorFactory> CreateAndroidNetworkMonitorFactory(
JNIEnv* env,
jobject application_context);
// Deprecated. Pass in application context instead.
std::unique_ptr<rtc::NetworkMonitorFactory>
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_

View File

@ -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 <memory>

View File

@ -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 <jni.h>
#include <memory>
#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<rtc::NetworkMonitorFactory> CreateAndroidNetworkMonitorFactory(
JNIEnv* env,
jobject application_context);
// Deprecated. Pass in application context instead.
std::unique_ptr<rtc::NetworkMonitorFactory>
CreateAndroidNetworkMonitorFactory();
} // namespace webrtc
#endif // SDK_ANDROID_NATIVE_API_NETWORK_MONITOR_NETWORK_MONITOR_H_