Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29ffdcb6 authored by xshu's avatar xshu
Browse files

[Mac rand] recording when the randomized mac is last changed

Bug:137796328
Test: unit tests
Change-Id: Ifc03c0a117675c61328d21dc0f413540b47ada89
parent 77e92729
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1029,6 +1029,13 @@ public class WifiConfiguration implements Parcelable {
    @NonNull
    private MacAddress mRandomizedMacAddress;

    /**
     * @hide
     * The wall clock time of when |mRandomizedMacAddress| last changed.
     * Used to determine when we should re-randomize in aggressive mode.
     */
    public long randomizedMacLastModifiedTimeMs = 0;

    /**
     * @hide
     * Checks if the given MAC address can be used for Connected Mac Randomization
@@ -1908,6 +1915,8 @@ 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(" KeyMgmt:");
        for (int k = 0; k < this.allowedKeyManagement.size(); k++) {
            if (this.allowedKeyManagement.get(k)) {
@@ -2429,6 +2438,7 @@ public class WifiConfiguration implements Parcelable {
            recentFailure.setAssociationStatus(source.recentFailure.getAssociationStatus());
            mRandomizedMacAddress = source.mRandomizedMacAddress;
            macRandomizationSetting = source.macRandomizationSetting;
            randomizedMacLastModifiedTimeMs = source.randomizedMacLastModifiedTimeMs;
            requirePMF = source.requirePMF;
            updateIdentifier = source.updateIdentifier;
        }
@@ -2502,6 +2512,7 @@ public class WifiConfiguration implements Parcelable {
        dest.writeParcelable(mRandomizedMacAddress, flags);
        dest.writeInt(macRandomizationSetting);
        dest.writeInt(osu ? 1 : 0);
        dest.writeLong(randomizedMacLastModifiedTimeMs);
    }

    /** Implement the Parcelable interface {@hide} */
@@ -2575,6 +2586,7 @@ public class WifiConfiguration implements Parcelable {
                config.mRandomizedMacAddress = in.readParcelable(null);
                config.macRandomizationSetting = in.readInt();
                config.osu = in.readInt() != 0;
                config.randomizedMacLastModifiedTimeMs = in.readLong();
                return config;
            }