Replace InetAddress#parseNumericAddress
-Connectivity is becoming a mainline module in S but mainline modules are not allowed to use non-formal APIs. Thus, replace non-formal API InetAddress#parseNumericAddress to InetAddresses#parseNumericAddress. - Add deprecated method legacyParseIpAndMask() for IpPrefix and LinkAddress. Because InetAddresses#parseNumericAddress has a little different behavior in some case, but these two classes should keep working as before. So these two classes will use the new deprecated method. Bug: 181756157 Test: FrameworksNetTests Change-Id: I1c96b75f0b8d5e93304a39b4a8c8849964e5e810
This commit is contained in:
@@ -325,7 +325,7 @@ public class LinkAddress implements Parcelable {
|
||||
public LinkAddress(@NonNull String address, int flags, int scope) {
|
||||
// This may throw an IllegalArgumentException; catching it is the caller's responsibility.
|
||||
// TODO: consider rejecting mapped IPv4 addresses such as "::ffff:192.0.2.5/24".
|
||||
Pair<InetAddress, Integer> ipAndMask = NetworkUtils.parseIpAndMask(address);
|
||||
Pair<InetAddress, Integer> ipAndMask = NetworkUtils.legacyParseIpAndMask(address);
|
||||
init(ipAndMask.first, ipAndMask.second, flags, scope, LIFETIME_UNKNOWN, LIFETIME_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user