Always have an AutomaticOnOffKeepalive to manage a KI
Test: FrameworksNetTests 'CtsNetTestCases' CtsHostsideNetworkTests
Change-Id: Ic216b525d8297fce0f390daae327e667a14b7775
diff --git a/framework/src/android/net/ConnectivityManager.java b/framework/src/android/net/ConnectivityManager.java
index 40defd4..4224da9 100644
--- a/framework/src/android/net/ConnectivityManager.java
+++ b/framework/src/android/net/ConnectivityManager.java
@@ -2287,6 +2287,13 @@
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) {
diff --git a/framework/src/android/net/NetworkAgent.java b/framework/src/android/net/NetworkAgent.java
index 732bd87..62e4fe1 100644
--- a/framework/src/android/net/NetworkAgent.java
+++ b/framework/src/android/net/NetworkAgent.java
@@ -281,7 +281,7 @@
*
* 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 @@
* 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;