Remove logic from NetworkMonitorManager wrapper

NetworkMonitorManager should just be a passthrough wrapper for
INetworkMonitor. Move logic to choose the notifyNetworkConnected version
to call to its only caller, ConnectivityService.

This allows removing the dependency on modules-utils-build, which makes
the networkstack-client library less portable; for example it would add
duplicate classes if networkstack-client is included into service-wifi,
as service-wifi can already use modules-utils-build from framework-wifi.

Fixes: 227161380
Test: atest ConnectivityServiceTest
Change-Id: Ie50f586c5d1ffe021cb0a96294f13f478fd3a2dd
This commit is contained in:
Remi NGUYEN VAN 2022-05-31 11:17:02 +09:00
commit 9ada184a2b

View file

@ -9252,7 +9252,18 @@ public class ConnectivityService extends IConnectivityManager.Stub
params.networkCapabilities = networkAgent.networkCapabilities;
params.linkProperties = new LinkProperties(networkAgent.linkProperties,
true /* parcelSensitiveFields */);
networkAgent.networkMonitor().notifyNetworkConnected(params);
// isAtLeastT() is conservative here, as recent versions of NetworkStack support the
// newer callback even before T. However getInterfaceVersion is a synchronized binder
// call that would cause a Log.wtf to be emitted from the system_server process, and
// in the absence of a satisfactory, scalable solution which follows an easy/standard
// process to check the interface version, just use an SDK check. NetworkStack will
// always be new enough when running on T+.
if (SdkLevel.isAtLeastT()) {
networkAgent.networkMonitor().notifyNetworkConnected(params);
} else {
networkAgent.networkMonitor().notifyNetworkConnected(params.linkProperties,
params.networkCapabilities);
}
scheduleUnvalidatedPrompt(networkAgent);
// Whether a particular NetworkRequest listen should cause signal strength thresholds to