Update fixed-size arrays in the supplicant service
to use std::array<>.

Bug: 273964536
Test: atest VtsHalWifiSupplicantStaIfaceTargetTest \
            VtsHalWifiSupplicantStaNetworkTargetTest \
	    VtsHalWifiSupplicantP2pIfaceTargetTes
Change-Id: I9b2d666e77fd5590956b69acc88c501bd21ef428
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index e2523d4..5c36301 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -364,6 +364,12 @@
 	return byteArrToVec(mac_addr, ETH_ALEN);
 }
 
+inline std::array<uint8_t, ETH_ALEN> macAddrToArray(const uint8_t* mac_addr) {
+	std::array<uint8_t, ETH_ALEN> arr;
+	std::copy(mac_addr, mac_addr + ETH_ALEN, std::begin(arr));
+	return arr;
+}
+
 // Raw pointer to the global structure maintained by the core.
 // Declared here to be accessible to onDeath()
 struct wpa_global *wpa_global_;
@@ -669,14 +675,14 @@
 		wpa_printf(MSG_INFO, "assoc key_mgmt 0x%x network key_mgmt 0x%x",
 			wpa_s->key_mgmt, wpa_s->current_ssid->key_mgmt);
 	}
-	std::vector<uint8_t> aidl_bssid;
+	std::array<uint8_t, ETH_ALEN> aidl_bssid;
 	// wpa_supplicant sets the |pending_bssid| field when it starts a
 	// connection. Only after association state does it update the |bssid|
 	// field. So, in the AIDL callback send the appropriate bssid.
 	if (wpa_s->wpa_state <= WPA_ASSOCIATED) {
-		aidl_bssid = macAddrToVec(wpa_s->pending_bssid);
+		aidl_bssid = macAddrToArray(wpa_s->pending_bssid);
 	} else {
-		aidl_bssid = macAddrToVec(wpa_s->bssid);
+		aidl_bssid = macAddrToArray(wpa_s->bssid);
 	}
 	aidl_state_change_data.bssid = aidl_bssid;
 
@@ -1391,9 +1397,9 @@
 	params.psk = aidl_psk;
 	params.passphrase = misc_utils::charBufToString(ssid->passphrase);
 	params.isPersistent = aidl_is_persistent;
-	params.goDeviceAddress = macAddrToVec(wpa_group_s->go_dev_addr);
-	params.goInterfaceAddress = aidl_is_go ? macAddrToVec(wpa_group_s->own_addr) :
-			macAddrToVec(wpa_group_s->current_bss->bssid);
+	params.goDeviceAddress = macAddrToArray(wpa_group_s->go_dev_addr);
+	params.goInterfaceAddress = aidl_is_go ? macAddrToArray(wpa_group_s->own_addr) :
+			macAddrToArray(wpa_group_s->current_bss->bssid);
 	if (NULL != ip && !aidl_is_go) {
 		params.isP2pClientEapolIpAddressInfoPresent = true;
 		os_memcpy(&params.p2pClientIpInfo.ipAddressClient, &ip[0], 4);
@@ -1791,7 +1797,7 @@
 	std::string aidl_ifname = misc_utils::charBufToString(wpa_s->ifname);
 
 	PmkSaCacheData aidl_pmksa_data = {};
-	aidl_pmksa_data.bssid = macAddrToVec(pmksa_entry->aa);
+	aidl_pmksa_data.bssid = macAddrToArray(pmksa_entry->aa);
 	// Serialize PmkCacheEntry into blob.
 	std::stringstream ss(
 		std::stringstream::in | std::stringstream::out | std::stringstream::binary);
diff --git a/wpa_supplicant/aidl/sta_iface.cpp b/wpa_supplicant/aidl/sta_iface.cpp
index 7538504..674b30c 100644
--- a/wpa_supplicant/aidl/sta_iface.cpp
+++ b/wpa_supplicant/aidl/sta_iface.cpp
@@ -290,6 +290,12 @@
 	WPA_ASSERT(false);
 }
 
+inline std::array<uint8_t, ETH_ALEN> macAddrToArray(const uint8_t* mac_addr) {
+	std::array<uint8_t, ETH_ALEN> arr;
+	std::copy(mac_addr, mac_addr + ETH_ALEN, std::begin(arr));
+	return arr;
+}
+
 }  // namespace
 
 namespace aidl {
@@ -2006,8 +2012,7 @@
 	MloLinksInfo linksInfo;
 	MloLink link;
 
-	linksInfo.apMldMacAddress->assign(
-	    wpa_s->ap_mld_addr, wpa_s->ap_mld_addr + ETH_ALEN);
+	linksInfo.apMldMacAddress = macAddrToArray(wpa_s->ap_mld_addr);
 	if (!wpa_s->valid_links)
 		 return {linksInfo, ndk::ScopedAStatus::ok()};
 
@@ -2023,8 +2028,7 @@
 		link.linkId = i;
 		link.staLinkMacAddress.assign(
 		    wpa_s->links[i].addr, wpa_s->links[i].addr + ETH_ALEN);
-		link.apLinkMacAddress->assign(
-		    wpa_s->links[i].bssid, wpa_s->links[i].bssid + ETH_ALEN);
+		link.apLinkMacAddress = macAddrToArray(wpa_s->links[i].bssid);
 		link.frequencyMHz = wpa_s->links[i].freq;
 		// TODO (b/259710591): Once supplicant implements TID-to-link
 		// mapping, copy it here. Mapping can be changed in two