diff options
| author | 2010-08-04 15:15:49 -0700 | |
|---|---|---|
| committer | 2010-08-04 15:15:49 -0700 | |
| commit | 1cf56ab9c68334d9124c52bcede06aaa0b17c730 (patch) | |
| tree | 8c491014e6dd14bfb54c2a0237f0114cabc4ab77 | |
| parent | d4b502017416113ce50112787ab9fcae39649806 (diff) | |
Avoid hostname lookup in NetworkProperties
Bug: 2870816
Change-Id: Iba98d7d25da5068051dba19aa04702cc93b7cc05
| -rw-r--r-- | core/java/android/net/NetworkProperties.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/core/java/android/net/NetworkProperties.java b/core/java/android/net/NetworkProperties.java index 56e1f1a485b0..da2a2d4258b1 100644 --- a/core/java/android/net/NetworkProperties.java +++ b/core/java/android/net/NetworkProperties.java @@ -123,18 +123,17 @@ public class NetworkProperties implements Parcelable { public synchronized void writeToParcel(Parcel dest, int flags) { dest.writeString(getInterfaceName()); dest.writeInt(mAddresses.size()); + //TODO: explore an easy alternative to preserve hostname + // without doing a lookup for(InetAddress a : mAddresses) { - dest.writeString(a.getHostName()); dest.writeByteArray(a.getAddress()); } dest.writeInt(mDnses.size()); for(InetAddress d : mDnses) { - dest.writeString(d.getHostName()); dest.writeByteArray(d.getAddress()); } if (mGateway != null) { dest.writeByte((byte)1); - dest.writeString(mGateway.getHostName()); dest.writeByteArray(mGateway.getAddress()); } else { dest.writeByte((byte)0); @@ -166,21 +165,18 @@ public class NetworkProperties implements Parcelable { int addressCount = in.readInt(); for (int i=0; i<addressCount; i++) { try { - netProp.addAddress(InetAddress.getByAddress(in.readString(), - in.createByteArray())); + netProp.addAddress(InetAddress.getByAddress(in.createByteArray())); } catch (UnknownHostException e) { } } addressCount = in.readInt(); for (int i=0; i<addressCount; i++) { try { - netProp.addDns(InetAddress.getByAddress(in.readString(), - in.createByteArray())); + netProp.addDns(InetAddress.getByAddress(in.createByteArray())); } catch (UnknownHostException e) { } } if (in.readByte() == 1) { try { - netProp.setGateway(InetAddress.getByAddress(in.readString(), - in.createByteArray())); + netProp.setGateway(InetAddress.getByAddress(in.createByteArray())); } catch (UnknownHostException e) {} } if (in.readByte() == 1) { |