Always have an AutomaticOnOffKeepalive to manage a KI
Test: FrameworksNetTests 'CtsNetTestCases' CtsHostsideNetworkTests
Change-Id: Ic216b525d8297fce0f390daae327e667a14b7775
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index eef4a0e..cd4421b 100755
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -270,6 +270,7 @@
import com.android.networkstack.apishim.common.UnsupportedApiLevelException;
import com.android.server.connectivity.AutodestructReference;
import com.android.server.connectivity.AutomaticOnOffKeepaliveTracker;
+import com.android.server.connectivity.AutomaticOnOffKeepaliveTracker.AutomaticOnOffKeepalive;
import com.android.server.connectivity.CarrierPrivilegeAuthenticator;
import com.android.server.connectivity.ClatCoordinator;
import com.android.server.connectivity.ConnectivityFlags;
@@ -5546,9 +5547,9 @@
break;
}
case NetworkAgent.CMD_MONITOR_AUTOMATIC_KEEPALIVE: {
- final Network network = (Network) msg.obj;
- final int slot = msg.arg1;
+ final AutomaticOnOffKeepalive ki = (AutomaticOnOffKeepalive) msg.obj;
+ final Network network = ki.getNetwork();
boolean networkFound = false;
final ArrayList<NetworkAgentInfo> vpnsRunningOnThisNetwork = new ArrayList<>();
for (NetworkAgentInfo n : mNetworkAgentInfos) {
@@ -5563,12 +5564,12 @@
if (!networkFound) return;
if (!vpnsRunningOnThisNetwork.isEmpty()) {
- mKeepaliveTracker.handleMonitorAutomaticKeepalive(network, slot,
+ mKeepaliveTracker.handleMonitorAutomaticKeepalive(ki,
// TODO: check all the VPNs running on top of this network
vpnsRunningOnThisNetwork.get(0).network.netId);
} else {
// If no VPN, then make sure the keepalive is running.
- mKeepaliveTracker.handleMaybeResumeKeepalive(network, slot);
+ mKeepaliveTracker.handleMaybeResumeKeepalive(ki);
}
break;
}