Always have an AutomaticOnOffKeepalive to manage a KI
Test: FrameworksNetTests 'CtsNetTestCases' CtsHostsideNetworkTests Change-Id: Ic216b525d8297fce0f390daae327e667a14b7775
This commit is contained in:
parent
210f3b234e
commit
23f1bfd471
1 changed files with 130 additions and 96 deletions
|
|
@ -270,6 +270,7 @@ import com.android.networkstack.apishim.common.BroadcastOptionsShim;
|
|||
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 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
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 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue