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
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index f760d3b..986b108 100644
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -9252,7 +9252,18 @@
             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