Merge "Create DhcpOption object and make it a SystemApi" am: 0a416b65b1 am: 55cbbe7d15
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1875313 Change-Id: Ie43b638ad7617e82089da88bf3fec343d10ca4ac
This commit is contained in:
20
framework/aidl-export/android/net/DhcpOption.aidl
Normal file
20
framework/aidl-export/android/net/DhcpOption.aidl
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2021, The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.net;
|
||||||
|
|
||||||
|
parcelable DhcpOption;
|
||||||
|
|
||||||
@@ -99,6 +99,15 @@ package android.net {
|
|||||||
field public static final int PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = 3; // 0x3
|
field public static final int PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = 3; // 0x3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class DhcpOption implements android.os.Parcelable {
|
||||||
|
ctor public DhcpOption(byte, @Nullable byte[]);
|
||||||
|
method public int describeContents();
|
||||||
|
method public byte getType();
|
||||||
|
method @Nullable public byte[] getValue();
|
||||||
|
method public void writeToParcel(@NonNull android.os.Parcel, int);
|
||||||
|
field @NonNull public static final android.os.Parcelable.Creator<android.net.DhcpOption> CREATOR;
|
||||||
|
}
|
||||||
|
|
||||||
public final class NetworkAgentConfig implements android.os.Parcelable {
|
public final class NetworkAgentConfig implements android.os.Parcelable {
|
||||||
method @Nullable public String getSubscriberId();
|
method @Nullable public String getSubscriberId();
|
||||||
method public boolean isBypassableVpn();
|
method public boolean isBypassableVpn();
|
||||||
|
|||||||
7
framework/api/module-lib-lint-baseline.txt
Normal file
7
framework/api/module-lib-lint-baseline.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// Baseline format: 1.0
|
||||||
|
NoByteOrShort: android.net.DhcpOption#DhcpOption(byte, byte[]) parameter #0:
|
||||||
|
Should avoid odd sized primitives; use `int` instead of `byte` in parameter type in android.net.DhcpOption(byte type, byte[] value)
|
||||||
|
NoByteOrShort: android.net.DhcpOption#describeContents():
|
||||||
|
Should avoid odd sized primitives; use `int` instead of `byte` in method android.net.DhcpOption.describeContents()
|
||||||
|
NoByteOrShort: android.net.DhcpOption#getType():
|
||||||
|
Should avoid odd sized primitives; use `int` instead of `byte` in method android.net.DhcpOption.getType()
|
||||||
80
framework/src/android/net/DhcpOption.java
Normal file
80
framework/src/android/net/DhcpOption.java
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2021 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.net;
|
||||||
|
|
||||||
|
import android.annotation.NonNull;
|
||||||
|
import android.annotation.Nullable;
|
||||||
|
import android.annotation.SystemApi;
|
||||||
|
import android.os.Parcel;
|
||||||
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing an option in the DHCP protocol.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
|
||||||
|
public final class DhcpOption implements Parcelable {
|
||||||
|
private final byte mType;
|
||||||
|
private final byte[] mValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a DhcpOption object.
|
||||||
|
*
|
||||||
|
* @param type the type of this option
|
||||||
|
* @param value the value of this option. If {@code null}, DHCP packets containing this option
|
||||||
|
* will include the option type in the Parameter Request List. Otherwise, DHCP
|
||||||
|
* packets containing this option will include the option in the options section.
|
||||||
|
*/
|
||||||
|
public DhcpOption(byte type, @Nullable byte[] value) {
|
||||||
|
mType = type;
|
||||||
|
mValue = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int describeContents() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToParcel(@NonNull Parcel dest, int flags) {
|
||||||
|
dest.writeByte(mType);
|
||||||
|
dest.writeByteArray(mValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Implement the Parcelable interface */
|
||||||
|
public static final @NonNull Creator<DhcpOption> CREATOR =
|
||||||
|
new Creator<DhcpOption>() {
|
||||||
|
public DhcpOption createFromParcel(Parcel in) {
|
||||||
|
return new DhcpOption(in.readByte(), in.createByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DhcpOption[] newArray(int size) {
|
||||||
|
return new DhcpOption[size];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Get the type of DHCP option */
|
||||||
|
public byte getType() {
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Get the value of DHCP option */
|
||||||
|
@Nullable public byte[] getValue() {
|
||||||
|
return mValue == null ? null : mValue.clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user