[MAC rand] Repurpose existing field

Repurposing an old field to suit the new design of throttling MAC
address changes based on DHCP lease duration.

Bug: 141950243
Test: unit tests
Change-Id: Ide71816895eb088f728105d1f675a6823490423f
This commit is contained in:
xshu
2019-10-01 15:53:57 -07:00
parent a55998b536
commit 1575e5d30c

View File

@@ -1038,10 +1038,10 @@ public class WifiConfiguration implements Parcelable {
/**
* @hide
* The wall clock time of when |mRandomizedMacAddress| last changed.
* Used to determine when we should re-randomize in aggressive mode.
* The wall clock time of when |mRandomizedMacAddress| should be re-randomized in aggressive
* randomization mode.
*/
public long randomizedMacLastModifiedTimeMs = 0;
public long randomizedMacExpirationTimeMs = 0;
/**
* @hide
@@ -1902,8 +1902,9 @@ public class WifiConfiguration implements Parcelable {
}
sbuf.append(" macRandomizationSetting: ").append(macRandomizationSetting).append("\n");
sbuf.append(" mRandomizedMacAddress: ").append(mRandomizedMacAddress).append("\n");
sbuf.append(" randomizedMacLastModifiedTimeMs: ").append(randomizedMacLastModifiedTimeMs)
.append("\n");
sbuf.append(" randomizedMacExpirationTimeMs: ")
.append(randomizedMacExpirationTimeMs == 0 ? "<none>"
: TimeUtils.logTimeOfDay(randomizedMacExpirationTimeMs)).append("\n");
sbuf.append(" KeyMgmt:");
for (int k = 0; k < this.allowedKeyManagement.size(); k++) {
if (this.allowedKeyManagement.get(k)) {
@@ -2429,7 +2430,7 @@ public class WifiConfiguration implements Parcelable {
recentFailure.setAssociationStatus(source.recentFailure.getAssociationStatus());
mRandomizedMacAddress = source.mRandomizedMacAddress;
macRandomizationSetting = source.macRandomizationSetting;
randomizedMacLastModifiedTimeMs = source.randomizedMacLastModifiedTimeMs;
randomizedMacExpirationTimeMs = source.randomizedMacExpirationTimeMs;
requirePMF = source.requirePMF;
updateIdentifier = source.updateIdentifier;
}
@@ -2504,7 +2505,7 @@ public class WifiConfiguration implements Parcelable {
dest.writeParcelable(mRandomizedMacAddress, flags);
dest.writeInt(macRandomizationSetting);
dest.writeInt(osu ? 1 : 0);
dest.writeLong(randomizedMacLastModifiedTimeMs);
dest.writeLong(randomizedMacExpirationTimeMs);
}
/** Implement the Parcelable interface {@hide} */
@@ -2579,7 +2580,7 @@ public class WifiConfiguration implements Parcelable {
config.mRandomizedMacAddress = in.readParcelable(null);
config.macRandomizationSetting = in.readInt();
config.osu = in.readInt() != 0;
config.randomizedMacLastModifiedTimeMs = in.readLong();
config.randomizedMacExpirationTimeMs = in.readLong();
return config;
}