Merge "follow up aosp/2600007" am: dc8df135cb am: 957d205a59
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2628993
Change-Id: Ie7d5fc18b33054307db58ea596870aab3094c1f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/service/src/com/android/server/connectivity/KeepaliveTracker.java b/service/src/com/android/server/connectivity/KeepaliveTracker.java
index 10bec64..76e97e2 100644
--- a/service/src/com/android/server/connectivity/KeepaliveTracker.java
+++ b/service/src/com/android/server/connectivity/KeepaliveTracker.java
@@ -528,8 +528,12 @@
if (networkKeepalives != null) {
final ArrayList<KeepaliveInfo> kalist = new ArrayList(networkKeepalives.values());
for (KeepaliveInfo ki : kalist) {
- // Check if keepalive is already stopped
+ // If the keepalive is paused, then it is already stopped with the hardware and so
+ // continue. Note that to send the appropriate stop reason callback,
+ // AutomaticOnOffKeepaliveTracker will call finalizePausedKeepalive which will also
+ // finally remove this keepalive slot from the array.
if (ki.mStopReason == SUCCESS_PAUSED) continue;
+
ki.stop(reason);
// Clean up keepalives since the network agent is disconnected and unable to pass
// back asynchronous result of stop().