diff options
Diffstat (limited to 'java/com/android/server/ethernet/EthernetTracker.java')
-rw-r--r-- | java/com/android/server/ethernet/EthernetTracker.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/java/com/android/server/ethernet/EthernetTracker.java b/java/com/android/server/ethernet/EthernetTracker.java index 53af955..9784512 100644 --- a/java/com/android/server/ethernet/EthernetTracker.java +++ b/java/com/android/server/ethernet/EthernetTracker.java @@ -190,6 +190,18 @@ public class EthernetTracker { mFactory.updateInterface(iface, ipConfig, capabilities, listener)); } + @VisibleForTesting(visibility = PACKAGE) + protected void connectNetwork(@NonNull final String iface, + @Nullable final IInternalNetworkManagementListener listener) { + mHandler.post(() -> updateInterfaceState(iface, true, listener)); + } + + @VisibleForTesting(visibility = PACKAGE) + protected void disconnectNetwork(@NonNull final String iface, + @Nullable final IInternalNetworkManagementListener listener) { + mHandler.post(() -> updateInterfaceState(iface, false, listener)); + } + IpConfiguration getIpConfiguration(String iface) { return mIpConfigurations.get(iface); } @@ -354,9 +366,14 @@ public class EthernetTracker { } private void updateInterfaceState(String iface, boolean up) { + updateInterfaceState(iface, up, null /* listener */); + } + + private void updateInterfaceState(@NonNull final String iface, final boolean up, + @Nullable final IInternalNetworkManagementListener listener) { final int mode = getInterfaceMode(iface); final boolean factoryLinkStateUpdated = (mode == INTERFACE_MODE_CLIENT) - && mFactory.updateInterfaceLinkState(iface, up); + && mFactory.updateInterfaceLinkState(iface, up, listener); if (factoryLinkStateUpdated) { boolean restricted = isRestrictedInterface(iface); |