Cleanup the TetheredClients API

Add comments to getters as requested in API review, and remove the
expirationTime private field that was planned to be replaced with
LinkAddress expiration.

Test: atest TetheringTests
Fixes: 150878126
Change-Id: Iecf65859cdeeaac2fa7b817b4f505c510424ac89
Merged-In: Iecf65859cdeeaac2fa7b817b4f505c510424ac89
(cherry picked from commit 594d0eae38c13e2bb03de0b3ae1f8781991c321e)
This commit is contained in:
Automerger Merge Worker
2020-03-16 04:06:46 +00:00
committed by Remi NGUYEN VAN
parent 943fb5b686
commit 0010ca0c70
4 changed files with 53 additions and 25 deletions

View File

@@ -24,6 +24,7 @@ import static android.net.util.NetworkConstants.FF;
import static android.net.util.NetworkConstants.RFC7421_PREFIX_LENGTH;
import static android.net.util.NetworkConstants.asByte;
import static android.net.util.TetheringMessageBase.BASE_IPSERVER;
import static android.system.OsConstants.RT_SCOPE_UNIVERSE;
import android.net.INetd;
import android.net.INetworkStackStatusCallback;
@@ -448,7 +449,9 @@ public class IpServer extends StateMachine {
final ArrayList<TetheredClient> leases = new ArrayList<>();
for (DhcpLeaseParcelable lease : leaseParcelables) {
final LinkAddress address = new LinkAddress(
intToInet4AddressHTH(lease.netAddr), lease.prefixLength);
intToInet4AddressHTH(lease.netAddr), lease.prefixLength,
0 /* flags */, RT_SCOPE_UNIVERSE /* as per RFC6724#3.2 */,
lease.expTime /* deprecationTime */, lease.expTime /* expirationTime */);
final MacAddress macAddress;
try {
@@ -460,7 +463,7 @@ public class IpServer extends StateMachine {
}
final TetheredClient.AddressInfo addressInfo = new TetheredClient.AddressInfo(
address, lease.hostname, lease.expTime);
address, lease.hostname);
leases.add(new TetheredClient(
macAddress,
Collections.singletonList(addressInfo),