wpa_supplicant(hidl): Prepend length for WFD IE

|wifi_display_subelem_set| expects the first 2 bytes of each IE being
set to contain the length of that IE. So, prepend that in the info
string being constructed in the HIDL interface.

Bug: 38222615
Test: Compiles
Change-Id: I190b9b5ad27d9fda17393302c697a8ea1c23df6c
diff --git a/wpa_supplicant/hidl/p2p_iface.cpp b/wpa_supplicant/hidl/p2p_iface.cpp
index 1dddb34..252266b 100644
--- a/wpa_supplicant/hidl/p2p_iface.cpp
+++ b/wpa_supplicant/hidl/p2p_iface.cpp
@@ -24,6 +24,7 @@
 const char kConfigMethodStrKeypad[] = "keypad";
 constexpr char kSetMiracastMode[] = "MIRACAST ";
 constexpr uint8_t kWfdDeviceInfoSubelemId = 0;
+constexpr char kWfdDeviceInfoSubelemLenHexStr[] = "0006";
 
 using android::hardware::wifi::supplicant::V1_0::ISupplicantP2pIface;
 uint8_t convertHidlMiracastModeToInternal(
@@ -1138,14 +1139,16 @@
     const std::array<uint8_t, 6>& info)
 {
 	struct wpa_supplicant* wpa_s = retrieveIfacePtr();
-	uint32_t wfd_device_info_hex_len = info.size() * 2 + 1;
-	std::vector<char> wfd_device_info_hex(wfd_device_info_hex_len);
+	std::vector<char> wfd_device_info_hex(info.size() * 2 + 1);
 	wpa_snprintf_hex(
 	    wfd_device_info_hex.data(), wfd_device_info_hex.size(), info.data(),
 	    info.size());
+	// |wifi_display_subelem_set| expects the first 2 bytes
+	// to hold the lenght of the subelement. In this case it's
+	// fixed to 6, so prepend that.
 	std::string wfd_device_info_set_cmd_str =
 	    std::to_string(kWfdDeviceInfoSubelemId) + " " +
-	    wfd_device_info_hex.data();
+	    kWfdDeviceInfoSubelemLenHexStr + wfd_device_info_hex.data();
 	std::vector<char> wfd_device_info_set_cmd(
 	    wfd_device_info_set_cmd_str.c_str(),
 	    wfd_device_info_set_cmd_str.c_str() +