summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java21
1 files changed, 13 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 12c45e90f..9cf1d6981 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -5300,12 +5300,17 @@ public class ClientModeImpl extends StateMachine {
final WifiConfiguration currentConfig = getCurrentWifiConfiguration();
final boolean isUsingStaticIp =
(currentConfig.getIpAssignment() == IpConfiguration.IpAssignment.STATIC);
+ final boolean isUsingMacRandomization =
+ currentConfig.macRandomizationSetting
+ == WifiConfiguration.RANDOMIZATION_PERSISTENT
+ && isConnectedMacRandomizationEnabled();
if (mVerboseLoggingEnabled) {
final String key = currentConfig.configKey();
log("enter ObtainingIpState netId=" + Integer.toString(mLastNetworkId)
+ " " + key + " "
+ " roam=" + mIsAutoRoaming
- + " static=" + isUsingStaticIp);
+ + " static=" + isUsingStaticIp
+ + " randomMac=" + isUsingMacRandomization);
}
// Send event to CM & network change broadcast
@@ -5334,26 +5339,26 @@ public class ClientModeImpl extends StateMachine {
mIpClient.setTcpBufferSizes(mTcpBufferSizes);
}
}
- final ProvisioningConfiguration prov;
+ final ProvisioningConfiguration.Builder prov;
if (!isUsingStaticIp) {
prov = new ProvisioningConfiguration.Builder()
.withPreDhcpAction()
.withApfCapabilities(mWifiNative.getApfCapabilities(mInterfaceName))
.withNetwork(getCurrentNetwork())
- .withDisplayName(currentConfig.SSID)
- .withRandomMacAddress()
- .build();
+ .withDisplayName(currentConfig.SSID);
+ if (isUsingMacRandomization) {
+ prov.withRandomMacAddress();
+ }
} else {
StaticIpConfiguration staticIpConfig = currentConfig.getStaticIpConfiguration();
prov = new ProvisioningConfiguration.Builder()
.withStaticConfiguration(staticIpConfig)
.withApfCapabilities(mWifiNative.getApfCapabilities(mInterfaceName))
.withNetwork(getCurrentNetwork())
- .withDisplayName(currentConfig.SSID)
- .build();
+ .withDisplayName(currentConfig.SSID);
}
if (mIpClient != null) {
- mIpClient.startProvisioning(prov);
+ mIpClient.startProvisioning(prov.build());
}
// Get Link layer stats so as we get fresh tx packet counters
getWifiLinkLayerStats();