Always have an AutomaticOnOffKeepalive to manage a KI

Test: FrameworksNetTests 'CtsNetTestCases' CtsHostsideNetworkTests
Change-Id: Ic216b525d8297fce0f390daae327e667a14b7775
This commit is contained in:
Chalard Jean
2023-01-24 17:11:27 +09:00
committed by chiachangwang
parent 210f3b234e
commit 23f1bfd471
5 changed files with 131 additions and 97 deletions

View File

@@ -2287,6 +2287,13 @@ public class ConnectivityManager {
mExecutor.execute(() -> {
try {
if (mSlot != null) {
// TODO : this is incorrect, because in the presence of auto on/off
// keepalive the slot associated with this keepalive can have
// changed. Also, this actually causes another problem where some other
// app might stop your keepalive if it just knows the network and
// the slot and goes through the trouble of grabbing the aidl object.
// This code should use the callback to identify what keepalive to
// stop instead.
mService.stopKeepalive(mNetwork, mSlot);
}
} catch (RemoteException e) {

View File

@@ -281,7 +281,7 @@ public abstract class NetworkAgent {
*
* arg1 = the hardware slot number of the keepalive to start
* arg2 = interval in seconds
* obj = KeepalivePacketData object describing the data to be sent
* obj = AutomaticKeepaliveInfo object
*
* Also used internally by ConnectivityService / KeepaliveTracker, with different semantics.
* @hide
@@ -491,8 +491,7 @@ public abstract class NetworkAgent {
* TCP sockets are open over a VPN. The system will check periodically for presence of
* such open sockets, and this message is what triggers the re-evaluation.
*
* arg1 = hardware slot number of the keepalive
* obj = {@link Network} that the keepalive is started on.
* obj = AutomaticOnOffKeepaliveObject.
* @hide
*/
public static final int CMD_MONITOR_AUTOMATIC_KEEPALIVE = BASE + 30;