diff options
| author | 2018-01-11 12:44:07 -0800 | |
|---|---|---|
| committer | 2018-01-12 11:18:38 -0800 | |
| commit | 8100a8ae267819e3ea62d92230def64bfdd2e6ee (patch) | |
| tree | b478f907f888e84d70b0d64c85bdda141f0b1baf | |
| parent | 54da93b9811832c1d08faccd7d5c207890684339 (diff) | |
Used LinkAddress insteaad of InterfaceAddress
Also removed InterfaceAddress which was added
in aosp/561351 since LinkAddress is exactly same
as InterfaceAddress.
Test: Telephony sanity tests
bug: 64132030
Merged-In: Ib7965a44b307c4cff2581abf0b7c12fcb1b9526a
Change-Id: Ib7965a44b307c4cff2581abf0b7c12fcb1b9526a
| -rw-r--r-- | api/system-current.txt | 15 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/DataCallResponse.java | 11 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/InterfaceAddress.aidl | 20 | ||||
| -rw-r--r-- | telephony/java/android/telephony/data/InterfaceAddress.java | 127 |
4 files changed, 8 insertions, 165 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 2a757efee4e9..d8f32d94120f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -4068,11 +4068,11 @@ package android.telephony { package android.telephony.data { public final class DataCallResponse implements android.os.Parcelable { - ctor public DataCallResponse(int, int, int, int, java.lang.String, java.lang.String, java.util.List<android.telephony.data.InterfaceAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.lang.String>, int); + ctor public DataCallResponse(int, int, int, int, java.lang.String, java.lang.String, java.util.List<android.net.LinkAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.net.InetAddress>, java.util.List<java.lang.String>, int); ctor public DataCallResponse(android.os.Parcel); method public int describeContents(); method public int getActive(); - method public java.util.List<android.telephony.data.InterfaceAddress> getAddresses(); + method public java.util.List<android.net.LinkAddress> getAddresses(); method public int getCallId(); method public java.util.List<java.net.InetAddress> getDnses(); method public java.util.List<java.net.InetAddress> getGateways(); @@ -4115,17 +4115,6 @@ package android.telephony.data { field public static final int TYPE_COMMON = 0; // 0x0 } - public final class InterfaceAddress implements android.os.Parcelable { - ctor public InterfaceAddress(java.net.InetAddress, int); - ctor public InterfaceAddress(java.lang.String, int) throws java.net.UnknownHostException; - ctor public InterfaceAddress(android.os.Parcel); - method public int describeContents(); - method public java.net.InetAddress getAddress(); - method public int getNetworkPrefixLength(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator<android.telephony.data.InterfaceAddress> CREATOR; - } - } package android.telephony.ims { diff --git a/telephony/java/android/telephony/data/DataCallResponse.java b/telephony/java/android/telephony/data/DataCallResponse.java index da51c86151d2..ef3a183f7800 100644 --- a/telephony/java/android/telephony/data/DataCallResponse.java +++ b/telephony/java/android/telephony/data/DataCallResponse.java @@ -20,6 +20,7 @@ package android.telephony.data; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; +import android.net.LinkAddress; import android.os.Parcel; import android.os.Parcelable; @@ -40,7 +41,7 @@ public final class DataCallResponse implements Parcelable { private final int mActive; private final String mType; private final String mIfname; - private final List<InterfaceAddress> mAddresses; + private final List<LinkAddress> mAddresses; private final List<InetAddress> mDnses; private final List<InetAddress> mGateways; private final List<String> mPcscfs; @@ -71,7 +72,7 @@ public final class DataCallResponse implements Parcelable { */ public DataCallResponse(int status, int suggestedRetryTime, int cid, int active, @Nullable String type, @Nullable String ifname, - @Nullable List<InterfaceAddress> addresses, + @Nullable List<LinkAddress> addresses, @Nullable List<InetAddress> dnses, @Nullable List<InetAddress> gateways, @Nullable List<String> pcscfs, int mtu) { @@ -96,7 +97,7 @@ public final class DataCallResponse implements Parcelable { mType = source.readString(); mIfname = source.readString(); mAddresses = new ArrayList<>(); - source.readList(mAddresses, InterfaceAddress.class.getClassLoader()); + source.readList(mAddresses, LinkAddress.class.getClassLoader()); mDnses = new ArrayList<>(); source.readList(mDnses, InetAddress.class.getClassLoader()); mGateways = new ArrayList<>(); @@ -140,10 +141,10 @@ public final class DataCallResponse implements Parcelable { public String getIfname() { return mIfname; } /** - * @return A list of {@link InterfaceAddress} + * @return A list of {@link LinkAddress} */ @NonNull - public List<InterfaceAddress> getAddresses() { return mAddresses; } + public List<LinkAddress> getAddresses() { return mAddresses; } /** * @return A list of DNS server addresses, e.g., "192.0.1.3" or diff --git a/telephony/java/android/telephony/data/InterfaceAddress.aidl b/telephony/java/android/telephony/data/InterfaceAddress.aidl deleted file mode 100644 index d750363b9cd2..000000000000 --- a/telephony/java/android/telephony/data/InterfaceAddress.aidl +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 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. - */ - -/** @hide */ -package android.telephony.data; - -parcelable InterfaceAddress; diff --git a/telephony/java/android/telephony/data/InterfaceAddress.java b/telephony/java/android/telephony/data/InterfaceAddress.java deleted file mode 100644 index 00d212a54c6f..000000000000 --- a/telephony/java/android/telephony/data/InterfaceAddress.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2017 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.telephony.data; - -import android.annotation.SystemApi; -import android.net.NetworkUtils; -import android.os.Parcel; -import android.os.Parcelable; - -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * This class represents a Network Interface address. In short it's an IP address, a subnet mask - * when the address is an IPv4 one. An IP address and a network prefix length in the case of IPv6 - * address. - * - * @hide - */ -@SystemApi -public final class InterfaceAddress implements Parcelable { - - private final InetAddress mInetAddress; - - private final int mPrefixLength; - - /** - * @param inetAddress A {@link InetAddress} of the address - * @param prefixLength The network prefix length for this address. - */ - public InterfaceAddress(InetAddress inetAddress, int prefixLength) { - mInetAddress = inetAddress; - mPrefixLength = prefixLength; - } - - /** - * @param address The address in string format - * @param prefixLength The network prefix length for this address. - * @throws UnknownHostException - */ - public InterfaceAddress(String address, int prefixLength) throws UnknownHostException { - InetAddress ia; - try { - ia = NetworkUtils.numericToInetAddress(address); - } catch (IllegalArgumentException e) { - throw new UnknownHostException("Non-numeric ip addr=" + address); - } - mInetAddress = ia; - mPrefixLength = prefixLength; - } - - public InterfaceAddress(Parcel source) { - mInetAddress = (InetAddress) source.readSerializable(); - mPrefixLength = source.readInt(); - } - - /** - * @return an InetAddress for this address. - */ - public InetAddress getAddress() { return mInetAddress; } - - /** - * @return The network prefix length for this address. - */ - public int getNetworkPrefixLength() { return mPrefixLength; } - - @Override - public boolean equals (Object o) { - if (this == o) return true; - - if (o == null || !(o instanceof InterfaceAddress)) { - return false; - } - - InterfaceAddress other = (InterfaceAddress) o; - return this.mInetAddress.equals(other.mInetAddress) - && this.mPrefixLength == other.mPrefixLength; - } - - @Override - public int hashCode() { - return mInetAddress.hashCode() * 31 + mPrefixLength * 37; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public String toString() { - return mInetAddress + "/" + mPrefixLength; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeSerializable(mInetAddress); - dest.writeInt(mPrefixLength); - } - - public static final Parcelable.Creator<InterfaceAddress> CREATOR = - new Parcelable.Creator<InterfaceAddress>() { - @Override - public InterfaceAddress createFromParcel(Parcel source) { - return new InterfaceAddress(source); - } - - @Override - public InterfaceAddress[] newArray(int size) { - return new InterfaceAddress[size]; - } - }; -} |