Remove Protocol.BASE_* usage in Connectivity
ConnectivityManager and NetworkAgent do not share their handler with any other component, so there is no reason to use addresses that do not overlap. Protocol.BASE_* was written to allow for interaction "between different StateMachine implementations without a conflict", but the classes do not use StateMachine, and they do not have such interactions. Bug: 177046265 Test: atest FrameworksNetTests Change-Id: I18c341d4a2c01cb9559d682a9ad1ff259e6b5855
This commit is contained in:
@@ -77,7 +77,6 @@ import android.util.SparseIntArray;
|
|||||||
import com.android.connectivity.aidl.INetworkAgent;
|
import com.android.connectivity.aidl.INetworkAgent;
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
import com.android.internal.util.Protocol;
|
|
||||||
|
|
||||||
import libcore.net.event.NetworkEventDispatcher;
|
import libcore.net.event.NetworkEventDispatcher;
|
||||||
|
|
||||||
@@ -3551,29 +3550,28 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int BASE = Protocol.BASE_CONNECTIVITY_MANAGER;
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_PRECHECK = BASE + 1;
|
public static final int CALLBACK_PRECHECK = 1;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_AVAILABLE = BASE + 2;
|
public static final int CALLBACK_AVAILABLE = 2;
|
||||||
/** @hide arg1 = TTL */
|
/** @hide arg1 = TTL */
|
||||||
public static final int CALLBACK_LOSING = BASE + 3;
|
public static final int CALLBACK_LOSING = 3;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_LOST = BASE + 4;
|
public static final int CALLBACK_LOST = 4;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_UNAVAIL = BASE + 5;
|
public static final int CALLBACK_UNAVAIL = 5;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_CAP_CHANGED = BASE + 6;
|
public static final int CALLBACK_CAP_CHANGED = 6;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_IP_CHANGED = BASE + 7;
|
public static final int CALLBACK_IP_CHANGED = 7;
|
||||||
/** @hide obj = NetworkCapabilities, arg1 = seq number */
|
/** @hide obj = NetworkCapabilities, arg1 = seq number */
|
||||||
private static final int EXPIRE_LEGACY_REQUEST = BASE + 8;
|
private static final int EXPIRE_LEGACY_REQUEST = 8;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_SUSPENDED = BASE + 9;
|
public static final int CALLBACK_SUSPENDED = 9;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_RESUMED = BASE + 10;
|
public static final int CALLBACK_RESUMED = 10;
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static final int CALLBACK_BLK_CHANGED = BASE + 11;
|
public static final int CALLBACK_BLK_CHANGED = 11;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public static String getCallbackName(int whichCallback) {
|
public static String getCallbackName(int whichCallback) {
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ import android.util.Log;
|
|||||||
import com.android.connectivity.aidl.INetworkAgent;
|
import com.android.connectivity.aidl.INetworkAgent;
|
||||||
import com.android.connectivity.aidl.INetworkAgentRegistry;
|
import com.android.connectivity.aidl.INetworkAgentRegistry;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.util.Protocol;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
@@ -125,7 +124,10 @@ public abstract class NetworkAgent {
|
|||||||
*/
|
*/
|
||||||
public final int providerId;
|
public final int providerId;
|
||||||
|
|
||||||
private static final int BASE = Protocol.BASE_NETWORK_AGENT;
|
// ConnectivityService parses message constants from itself and NetworkAgent with MessageUtils
|
||||||
|
// for debugging purposes, and crashes if some messages have the same values.
|
||||||
|
// TODO: have ConnectivityService store message names in different maps and remove this base
|
||||||
|
private static final int BASE = 200;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent by ConnectivityService to the NetworkAgent to inform it of
|
* Sent by ConnectivityService to the NetworkAgent to inform it of
|
||||||
|
|||||||
Reference in New Issue
Block a user