Move the DscpPolicy status constants and IntDef to NetworkAgent.
As requested by API council. Also fix lint errors in the test. Fix: 217366078 Test: existing tests modified in this CL Change-Id: I8f7cd0e78bf29aeb52ec6a08a5d635d25fa2205d
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package android.net;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.SystemApi;
|
||||
@@ -26,8 +25,6 @@ import android.util.Range;
|
||||
|
||||
import com.android.net.module.util.InetAddressUtils;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Objects;
|
||||
@@ -49,36 +46,6 @@ public final class DscpPolicy implements Parcelable {
|
||||
*/
|
||||
public static final int SOURCE_PORT_ANY = -1;
|
||||
|
||||
/**
|
||||
* Policy was successfully added.
|
||||
*/
|
||||
public static final int STATUS_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* Policy was rejected for any reason besides invalid classifier or insufficient resources.
|
||||
*/
|
||||
public static final int STATUS_REQUEST_DECLINED = 1;
|
||||
|
||||
/**
|
||||
* Requested policy contained a classifier which is not supported.
|
||||
*/
|
||||
public static final int STATUS_REQUESTED_CLASSIFIER_NOT_SUPPORTED = 2;
|
||||
|
||||
/**
|
||||
* TODO: should this error case be supported?
|
||||
*/
|
||||
public static final int STATUS_INSUFFICIENT_PROCESSING_RESOURCES = 3;
|
||||
|
||||
/**
|
||||
* Policy was deleted.
|
||||
*/
|
||||
public static final int STATUS_DELETED = 4;
|
||||
|
||||
/**
|
||||
* Policy was not found during deletion.
|
||||
*/
|
||||
public static final int STATUS_POLICY_NOT_FOUND = 5;
|
||||
|
||||
/** The unique policy ID. Each requesting network is responsible for maintaining policy IDs
|
||||
* unique within that network. In the case where a policy with an existing ID is created, the
|
||||
* new policy will update the existing policy with the same ID.
|
||||
@@ -112,17 +79,6 @@ public final class DscpPolicy implements Parcelable {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = "STATUS_", value = {
|
||||
STATUS_SUCCESS,
|
||||
STATUS_REQUEST_DECLINED,
|
||||
STATUS_REQUESTED_CLASSIFIER_NOT_SUPPORTED,
|
||||
STATUS_INSUFFICIENT_PROCESSING_RESOURCES,
|
||||
STATUS_DELETED
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DscpPolicyStatus {}
|
||||
|
||||
/* package */ DscpPolicy(
|
||||
int policyId,
|
||||
int dscp,
|
||||
|
||||
@@ -25,7 +25,6 @@ import android.annotation.SystemApi;
|
||||
import android.annotation.TestApi;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.Context;
|
||||
import android.net.DscpPolicy.DscpPolicyStatus;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.ConditionVariable;
|
||||
@@ -434,6 +433,48 @@ public abstract class NetworkAgent {
|
||||
*/
|
||||
public static final int CMD_DSCP_POLICY_STATUS = BASE + 28;
|
||||
|
||||
/**
|
||||
* DSCP policy was successfully added.
|
||||
*/
|
||||
public static final int DSCP_POLICY_STATUS_SUCCESS = 0;
|
||||
|
||||
/**
|
||||
* DSCP policy was rejected for any reason besides invalid classifier or insufficient resources.
|
||||
*/
|
||||
public static final int DSCP_POLICY_STATUS_REQUEST_DECLINED = 1;
|
||||
|
||||
/**
|
||||
* Requested DSCP policy contained a classifier which is not supported.
|
||||
*/
|
||||
public static final int DSCP_POLICY_STATUS_REQUESTED_CLASSIFIER_NOT_SUPPORTED = 2;
|
||||
|
||||
/**
|
||||
* Requested DSCP policy was not added due to insufficient processing resources.
|
||||
*/
|
||||
// TODO: should this error case be supported?
|
||||
public static final int DSCP_POLICY_STATUS_INSUFFICIENT_PROCESSING_RESOURCES = 3;
|
||||
|
||||
/**
|
||||
* DSCP policy was deleted.
|
||||
*/
|
||||
public static final int DSCP_POLICY_STATUS_DELETED = 4;
|
||||
|
||||
/**
|
||||
* DSCP policy was not found during deletion.
|
||||
*/
|
||||
public static final int DSCP_POLICY_STATUS_POLICY_NOT_FOUND = 5;
|
||||
|
||||
/** @hide */
|
||||
@IntDef(prefix = "DSCP_POLICY_STATUS_", value = {
|
||||
DSCP_POLICY_STATUS_SUCCESS,
|
||||
DSCP_POLICY_STATUS_REQUEST_DECLINED,
|
||||
DSCP_POLICY_STATUS_REQUESTED_CLASSIFIER_NOT_SUPPORTED,
|
||||
DSCP_POLICY_STATUS_INSUFFICIENT_PROCESSING_RESOURCES,
|
||||
DSCP_POLICY_STATUS_DELETED
|
||||
})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface DscpPolicyStatus {}
|
||||
|
||||
/**
|
||||
* Sent by the NetworkAgent to ConnectivityService to notify that this network is expected to be
|
||||
* replaced within the specified time by a similar network.
|
||||
|
||||
Reference in New Issue
Block a user