Snap for 5698743 from cf890b898db562756455f405552ee85eff899041 to qt-release

Change-Id: Ia719e8c55d02bea2a45552d2fa94b17bb28f162c
diff --git a/wpa_supplicant/hidl/1.2/p2p_iface.cpp b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
index 7dddee9..ada7ee6 100644
--- a/wpa_supplicant/hidl/1.2/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/1.2/p2p_iface.cpp
@@ -1750,6 +1750,14 @@
 	bool currentEnabledState = !!wpa_s->conf->p2p_device_random_mac_addr;
 	u8 *addr = NULL;
 
+	// A dedicated p2p device is not managed by supplicant,
+	// supplicant could not change its MAC address.
+	if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_DEDICATED_P2P_DEVICE) {
+		wpa_printf(MSG_ERROR,
+			"Dedicated P2P device don't support MAC randomization");
+		return {SupplicantStatusCode::FAILURE_ARGS_INVALID, "NotSupported"};
+	}
+
 	// The same state, no change is needed.
 	if (currentEnabledState == enable) {
 		wpa_printf(MSG_DEBUG, "The random MAC is %s already.",