Offset 1, 31 lines modifiedOffset 1, 28 lines modified
  
1 package·com.android.wifi.x.android.net.ipmemorystore;1 package·com.android.wifi.x.android.net.ipmemorystore;
  
2 import·java.util.Iterator;2 import·java.util.Iterator;
3 import·java.util.StringJoiner;3 import·java.util.StringJoiner;
4 import·android.net.networkstack.aidl.quirks.IPv6ProvisioningLossQuirkParcelable; 
5 import·java.util.Objects;4 import·java.util.Objects;
6 import·java.net.UnknownHostException;5 import·java.net.UnknownHostException;
7 import·java.net.InetAddress;6 import·java.net.InetAddress;
8 import·java.util.Collections;7 import·java.util.Collections;
9 import·java.util.Collection;8 import·java.util.Collection;
10 import·java.util.ArrayList;9 import·java.util.ArrayList;
11 import·android.net.networkstack.aidl.quirks.IPv6ProvisioningLossQuirk; 
12 import·java.util.List;10 import·java.util.List;
13 import·java.net.Inet4Address;11 import·java.net.Inet4Address;
  
14 public·class·NetworkAttributes12 public·class·NetworkAttributes
15 {13 {
16 ····public·static·final·float·TOTAL_WEIGHT·=·850.0f;14 ····public·static·final·float·TOTAL_WEIGHT·=·850.0f;
17 ····public·final·Inet4Address·assignedV4Address;15 ····public·final·Inet4Address·assignedV4Address;
18 ····public·final·Long·assignedV4AddressExpiry;16 ····public·final·Long·assignedV4AddressExpiry;
19 ····public·final·String·cluster;17 ····public·final·String·cluster;
20 ····public·final·List·dnsAddresses;18 ····public·final·List·dnsAddresses;
21 ····public·final·IPv6ProvisioningLossQuirk·ipv6ProvisioningLossQuirk; 
22 ····public·final·Integer·mtu;19 ····public·final·Integer·mtu;
23 ····20 ····
24 ····public·NetworkAttributes(final·NetworkAttributesParcelable·networkAttributesParcelable)·{21 ····public·NetworkAttributes(final·NetworkAttributesParcelable·networkAttributesParcelable)·{
25 ········final·Inet4Address·inet4Address·=·(Inet4Address)getByAddressOrNull(networkAttributesParcelable.assignedV4Address);22 ········final·Inet4Address·inet4Address·=·(Inet4Address)getByAddressOrNull(networkAttributesParcelable.assignedV4Address);
26 ········final·long·assignedV4AddressExpiry·=·networkAttributesParcelable.assignedV4AddressExpiry;23 ········final·long·assignedV4AddressExpiry·=·networkAttributesParcelable.assignedV4AddressExpiry;
27 ········Long·value;24 ········Long·value;
28 ········if·(assignedV4AddressExpiry·>·0L)·{25 ········if·(assignedV4AddressExpiry·>·0L)·{
Offset 40, 18 lines modifiedOffset 37, 18 lines modified
40 ········Integer·value2;37 ········Integer·value2;
41 ········if·(mtu·>=·0)·{38 ········if·(mtu·>=·0)·{
42 ············value2·=·mtu;39 ············value2·=·mtu;
43 ········}40 ········}
44 ········else·{41 ········else·{
45 ············value2·=·null;42 ············value2·=·null;
46 ········}43 ········}
47 ········this(inet4Address,·value,·cluster,·blobArrayToInetAddressList,·value2,·IPv6ProvisioningLossQuirk.fromStableParcelable(networkAttributesParcelable.ipv6ProvisioningLossQuirk));44 ········this(inet4Address,·value,·cluster,·blobArrayToInetAddressList,·value2);
48 ····}45 ····}
49 ····46 ····
50 ····public·NetworkAttributes(final·Inet4Address·assignedV4Address,·final·Long·assignedV4AddressExpiry,·final·String·cluster,·final·List·c,·final·Integer·mtu,·final·IPv6ProvisioningLossQuirk·ipv6ProvisioningLossQuirk)·{47 ····public·NetworkAttributes(final·Inet4Address·assignedV4Address,·final·Long·assignedV4AddressExpiry,·final·String·cluster,·final·List·c,·final·Integer·mtu)·{
51 ········if·(mtu·!=·null·&&·mtu·<·0)·{48 ········if·(mtu·!=·null·&&·mtu·<·0)·{
52 ············throw·new·IllegalArgumentException("MTU·can't·be·negative");49 ············throw·new·IllegalArgumentException("MTU·can't·be·negative");
53 ········}50 ········}
54 ········if·(assignedV4AddressExpiry·!=·null·&&·assignedV4AddressExpiry·<=·0L)·{51 ········if·(assignedV4AddressExpiry·!=·null·&&·assignedV4AddressExpiry·<=·0L)·{
55 ············throw·new·IllegalArgumentException("lease·expiry·can't·be·negative·or·zero");52 ············throw·new·IllegalArgumentException("lease·expiry·can't·be·negative·or·zero");
56 ········}53 ········}
57 ········this.assignedV4Address·=·assignedV4Address;54 ········this.assignedV4Address·=·assignedV4Address;
Offset 62, 15 lines modifiedOffset 59, 14 lines modified
62 ············unmodifiableList·=·null;59 ············unmodifiableList·=·null;
63 ········}60 ········}
64 ········else·{61 ········else·{
65 ············unmodifiableList·=·Collections.unmodifiableList((List<?>)new·ArrayList<Object>(c));62 ············unmodifiableList·=·Collections.unmodifiableList((List<?>)new·ArrayList<Object>(c));
66 ········}63 ········}
67 ········this.dnsAddresses·=·unmodifiableList;64 ········this.dnsAddresses·=·unmodifiableList;
68 ········this.mtu·=·mtu;65 ········this.mtu·=·mtu;
69 ········this.ipv6ProvisioningLossQuirk·=·ipv6ProvisioningLossQuirk; 
70 ····}66 ····}
71 ····67 ····
72 ····private·static·List·blobArrayToInetAddressList(final·Blob[]·array)·{68 ····private·static·List·blobArrayToInetAddressList(final·Blob[]·array)·{
73 ········if·(array·==·null)·{69 ········if·(array·==·null)·{
74 ············return·null;70 ············return·null;
75 ········}71 ········}
76 ········final·ArrayList<InetAddress>·list·=·new·ArrayList<InetAddress>(array.length);72 ········final·ArrayList<InetAddress>·list·=·new·ArrayList<InetAddress>(array.length);
Offset 114, 28 lines modifiedOffset 110, 27 lines modified
114 ····public·boolean·equals(final·Object·o)·{110 ····public·boolean·equals(final·Object·o)·{
115 ········final·boolean·b·=·o·instanceof·NetworkAttributes;111 ········final·boolean·b·=·o·instanceof·NetworkAttributes;
116 ········boolean·b2·=·false;112 ········boolean·b2·=·false;
117 ········if·(!b)·{113 ········if·(!b)·{
118 ············return·false;114 ············return·false;
119 ········}115 ········}
120 ········final·NetworkAttributes·networkAttributes·=·(NetworkAttributes)o;116 ········final·NetworkAttributes·networkAttributes·=·(NetworkAttributes)o;
121 ········if·(Objects.equals(this.assignedV4Address,·networkAttributes.assignedV4Address)·&&·Objects.equals(this.assignedV4AddressExpiry,·networkAttributes.assignedV4AddressExpiry)·&&·Objects.equals(this.cluster,·networkAttributes.cluster)·&&·Objects.equals(this.dnsAddresses,·networkAttributes.dnsAddresses)·&&·Objects.equals(this.mtu,·networkAttributes.mtu)·&&·Objects.equals(this.ipv6ProvisioningLossQuirk,·networkAttributes.ipv6ProvisioningLossQuirk))·{117 ········if·(Objects.equals(this.assignedV4Address,·networkAttributes.assignedV4Address)·&&·Objects.equals(this.assignedV4AddressExpiry,·networkAttributes.assignedV4AddressExpiry)·&&·Objects.equals(this.cluster,·networkAttributes.cluster)·&&·Objects.equals(this.dnsAddresses,·networkAttributes.dnsAddresses)·&&·Objects.equals(this.mtu,·networkAttributes.mtu))·{
122 ············b2·=·true;118 ············b2·=·true;
123 ········}119 ········}
124 ········return·b2;120 ········return·b2;
125 ····}121 ····}
126 ····122 ····
127 ····public·int·hashCode()·{123 ····public·int·hashCode()·{
128 ········return·Objects.hash(this.assignedV4Address,·this.assignedV4AddressExpiry,·this.cluster,·this.dnsAddresses,·this.mtu,·this.ipv6ProvisioningLossQuirk);124 ········return·Objects.hash(this.assignedV4Address,·this.assignedV4AddressExpiry,·this.cluster,·this.dnsAddresses,·this.mtu);
129 ····}125 ····}
130 ····126 ····
131 ····public·NetworkAttributesParcelable·toParcelable()·{127 ····public·NetworkAttributesParcelable·toParcelable()·{
132 ········final·NetworkAttributesParcelable·networkAttributesParcelable·=·new·NetworkAttributesParcelable();128 ········final·NetworkAttributesParcelable·networkAttributesParcelable·=·new·NetworkAttributesParcelable();
133 ········final·Inet4Address·assignedV4Address·=·this.assignedV4Address;129 ········final·Inet4Address·assignedV4Address·=·this.assignedV4Address;
134 ········IPv6ProvisioningLossQuirkParcelable·stableParcelable·=·null; 
135 ········byte[]·address;130 ········byte[]·address;
136 ········if·(assignedV4Address·==·null)·{131 ········if·(assignedV4Address·==·null)·{
137 ············address·=·null;132 ············address·=·null;
138 ········}133 ········}
139 ········else·{134 ········else·{
140 ············address·=·assignedV4Address.getAddress();135 ············address·=·assignedV4Address.getAddress();
141 ········}136 ········}
Offset 156, 19 lines modifiedOffset 151, 14 lines modified
156 ········if·(mtu·==·null)·{151 ········if·(mtu·==·null)·{
157 ············intValue·=·-1;152 ············intValue·=·-1;
158 ········}153 ········}
159 ········else·{154 ········else·{
160 ············intValue·=·mtu;155 ············intValue·=·mtu;
161 ········}156 ········}
162 ········networkAttributesParcelable.mtu·=·intValue;157 ········networkAttributesParcelable.mtu·=·intValue;
163 ········final·IPv6ProvisioningLossQuirk·ipv6ProvisioningLossQuirk·=·this.ipv6ProvisioningLossQuirk; 
164 ········if·(ipv6ProvisioningLossQuirk·!=·null)·{ 
165 ············stableParcelable·=·ipv6ProvisioningLossQuirk.toStableParcelable(); 
166 ········} 
167 ········networkAttributesParcelable.ipv6ProvisioningLossQuirk·=·stableParcelable; 
168 ········return·networkAttributesParcelable;158 ········return·networkAttributesParcelable;
169 ····}159 ····}
170 ····160 ····
171 ····public·String·toString()·{161 ····public·String·toString()·{
172 ········final·StringJoiner·stringJoiner·=·new·StringJoiner("·",·"{",·"}");162 ········final·StringJoiner·stringJoiner·=·new·StringJoiner("·",·"{",·"}");
173 ········final·ArrayList<String>·list·=·new·ArrayList<String>();163 ········final·ArrayList<String>·list·=·new·ArrayList<String>();
174 ········if·(this.assignedV4Address·!=·null)·{164 ········if·(this.assignedV4Address·!=·null)·{
Offset 189, 45 lines modifiedOffset 179, 37 lines modified
189 ············stringJoiner.add("cluster·:");179 ············stringJoiner.add("cluster·:");
190 ············stringJoiner.add(this.cluster);180 ············stringJoiner.add(this.cluster);
191 ········}181 ········}
192 ········else·{182 ········else·{
193 ············list.add("cluster");183 ············list.add("cluster");
194 ········}184 ········}
195 ········final·List·dnsAddresses·=·this.dnsAddresses;185 ········final·List·dnsAddresses·=·this.dnsAddresses;
196 ········final·String·newElement·=·"]";186 ········final·String·s·=·"]";
197 ········if·(dnsAddresses·!=·null)·{187 ········if·(dnsAddresses·!=·null)·{
198 ············stringJoiner.add("dnsAddr·:·[");188 ············stringJoiner.add("dnsAddr·:·[");
199 ············final·Iterator·iterator·=·this.dnsAddresses.iterator();189 ············final·Iterator·iterator·=·this.dnsAddresses.iterator();
200 ············while·(iterator.hasNext())·{190 ············while·(iterator.hasNext())·{
201 ················stringJoiner.add(((InetAddress)iterator.next()).getHostAddress());191 ················stringJoiner.add(((InetAddress)iterator.next()).getHostAddress());
202 ············}192 ············}
203 ············stringJoiner.add(newElement);193 ············stringJoiner.add(s);
204 ········}194 ········}
205 ········else·{195 ········else·{
206 ············list.add("dnsAddr");196 ············list.add("dnsAddr");
207 ········}197 ········}
208 ········if·(this.mtu·!=·null)·{198 ········if·(this.mtu·!=·null)·{
209 ············stringJoiner.add("mtu·:");199 ············stringJoiner.add("mtu·:");
210 ············stringJoiner.add(this.mtu.toString());200 ············stringJoiner.add(this.mtu.toString());
211 ········}201 ········}
212 ········else·{202 ········else·{
213 ············list.add("mtu");203 ············list.add("mtu");
214 ········}204 ········}
215 ········if·(this.ipv6ProvisioningLossQuirk·!=·null)·{ 
216 ············stringJoiner.add("ipv6ProvisioningLossQuirk·:·["); 
217 ············stringJoiner.add(this.ipv6ProvisioningLossQuirk.toString()); 
218 ············stringJoiner.add(newElement); 
219 ········} 
220 ········else·{ 
221 ············list.add("ipv6ProvisioningLossQuirk"); 
222 ········} 
223 ········if·(!list.isEmpty())·{205 ········if·(!list.isEmpty())·{
224 ············stringJoiner.add(";·Null·fields·:·[");206 ············stringJoiner.add(";·Null·fields·:·[");
225 ············final·Iterator<String>·iterator2·=·list.iterator();207 ············final·Iterator<String>·iterator2·=·list.iterator();
226 ············while·(iterator2.hasNext())·{208 ············while·(iterator2.hasNext())·{
227 ················stringJoiner.add(iterator2.next());209 ················stringJoiner.add(iterator2.next());
228 ············}210 ············}
229 ············stringJoiner.add(newElement);211 ············stringJoiner.add(s);
230 ········}212 ········}
231 ········return·stringJoiner.toString();213 ········return·stringJoiner.toString();
232 ····}214 ····}
233 }215 }