[DK2]Add new SocketKeepalive.start to dynamically control keepalive

Add SocketKeepalive.start with parameter to enable dynamic
keepalive mode based on the existence of TCP connections.

This supports IPSec mode to notify KeepaliveTracker to disable
keepalive when keepalive is unnecessary to improve battery life.

Keepalive is controlled by periodically TCP socket status check
for both enable and disable. This is a transition commit and
is expected to be updated based on the socket creation or
destroy.

Bug: 259000745
Test: m ; atest FrameworksNetTests
Change-Id: Ie4d598d69a73c4931c7d0b6dfde0e459e5dca6b4
This commit is contained in:
chiachangwang
2023-01-18 01:19:27 +00:00
committed by Chalard Jean
parent 3d60bacfa0
commit 9ef4ffe8d4
10 changed files with 504 additions and 68 deletions

View File

@@ -50,7 +50,11 @@ public final class TcpSocketKeepalive extends SocketKeepalive {
* acknowledgement.
*/
@Override
protected void startImpl(int intervalSec) {
protected void startImpl(int intervalSec, int flags) {
if (0 != flags) {
throw new IllegalArgumentException("Illegal flag value for "
+ this.getClass().getSimpleName() + " : " + flags);
}
mExecutor.execute(() -> {
try {
mService.startTcpKeepalive(mNetwork, mPfd, intervalSec, mCallback);