Separate events usage for starting socket keepalives

This is a clean up commit to correct the javadoc of
NetworkAgent.CMD_START_SOCKET_KEEPALIVE. This event was used
between ConnectivityService/NetworkAgent, and also
ConnectivityService/KeepaliveTracker with different semantics.
This may confuse the developers to update the doc incorrectly,
so also separate the usage to different events.

Also move the event definitions together so that a new event
definition will not mis-use the existing values.

Test: atest FrameworksNetTests
Change-Id: I73ebd8abcc610531da3057da2d643a41befb2099
This commit is contained in:
chiachangwang
2023-04-14 07:32:43 +00:00
parent e2294fb13e
commit f1b1fb4b7f
4 changed files with 50 additions and 41 deletions

View File

@@ -47,7 +47,6 @@ import android.net.LinkProperties;
import android.net.MarkMaskParcel;
import android.net.NattKeepalivePacketData;
import android.net.Network;
import android.net.NetworkAgent;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Binder;
@@ -268,11 +267,11 @@ public class AutomaticOnOffKeepaliveTrackerTest {
@Override
public void handleMessage(@NonNull final Message msg) {
switch (msg.what) {
case NetworkAgent.CMD_START_SOCKET_KEEPALIVE:
Log.d(TAG, "Test handler received CMD_START_SOCKET_KEEPALIVE : " + msg);
case AutomaticOnOffKeepaliveTracker.CMD_REQUEST_START_KEEPALIVE:
Log.d(TAG, "Test handler received CMD_REQUEST_START_KEEPALIVE : " + msg);
mAOOKeepaliveTracker.handleStartKeepalive(msg);
break;
case NetworkAgent.CMD_MONITOR_AUTOMATIC_KEEPALIVE:
case AutomaticOnOffKeepaliveTracker.CMD_MONITOR_AUTOMATIC_KEEPALIVE:
Log.d(TAG, "Test handler received CMD_MONITOR_AUTOMATIC_KEEPALIVE : " + msg);
mLastAutoKi = mAOOKeepaliveTracker.getKeepaliveForBinder((IBinder) msg.obj);
break;