Snap for 11200327 from 10066c03ce9fa8f0bd6c4ce6272342ae3239aa1f to 24Q1-release
Change-Id: Ic758db08bee2cdc3e785e7ed5fb7c78d7d6b7a05
diff --git a/wpa_supplicant/aidl/aidl_manager.cpp b/wpa_supplicant/aidl/aidl_manager.cpp
index fba84fe..cac9ddb 100644
--- a/wpa_supplicant/aidl/aidl_manager.cpp
+++ b/wpa_supplicant/aidl/aidl_manager.cpp
@@ -1344,16 +1344,35 @@
std::back_inserter(aidl_vendor_elems));
}
- const std::function<
- ndk::ScopedAStatus(std::shared_ptr<ISupplicantP2pIfaceCallback>)>
- func = std::bind(
- &ISupplicantP2pIfaceCallback::onDeviceFoundWithVendorElements,
- std::placeholders::_1, macAddrToVec(addr), macAddrToVec(info->p2p_device_addr),
- byteArrToVec(info->pri_dev_type, 8), misc_utils::charBufToString(info->device_name),
- static_cast<WpsConfigMethods>(info->config_methods),
- info->dev_capab, static_cast<P2pGroupCapabilityMask>(info->group_capab), aidl_peer_wfd_device_info,
- aidl_peer_wfd_r2_device_info, aidl_vendor_elems);
- callWithEachP2pIfaceCallback(wpa_s->ifname, func);
+ if (isAidlServiceVersionAtLeast(3)) {
+ P2pDeviceFoundEventParams params;
+ params.srcAddress = macAddrToArray(addr);
+ params.p2pDeviceAddress = macAddrToArray(info->p2p_device_addr);
+ params.primaryDeviceType = byteArrToVec(info->pri_dev_type, 8);
+ params.deviceName = misc_utils::charBufToString(info->device_name);
+ params.configMethods = info->config_methods;
+ params.deviceCapabilities = info->dev_capab;
+ params.groupCapabilities = info->group_capab;
+ params.wfdDeviceInfo = aidl_peer_wfd_device_info;
+ params.wfdR2DeviceInfo = aidl_peer_wfd_r2_device_info;
+ params.vendorElemBytes = aidl_vendor_elems;
+ callWithEachP2pIfaceCallback(
+ misc_utils::charBufToString(wpa_s->ifname),
+ std::bind(
+ &ISupplicantP2pIfaceCallback::onDeviceFoundWithParams,
+ std::placeholders::_1, params));
+ } else {
+ const std::function<
+ ndk::ScopedAStatus(std::shared_ptr<ISupplicantP2pIfaceCallback>)>
+ func = std::bind(
+ &ISupplicantP2pIfaceCallback::onDeviceFoundWithVendorElements,
+ std::placeholders::_1, macAddrToVec(addr), macAddrToVec(info->p2p_device_addr),
+ byteArrToVec(info->pri_dev_type, 8), misc_utils::charBufToString(info->device_name),
+ static_cast<WpsConfigMethods>(info->config_methods),
+ info->dev_capab, static_cast<P2pGroupCapabilityMask>(info->group_capab), aidl_peer_wfd_device_info,
+ aidl_peer_wfd_r2_device_info, aidl_vendor_elems);
+ callWithEachP2pIfaceCallback(wpa_s->ifname, func);
+ }
}
void AidlManager::notifyP2pDeviceLost(