Add new onDeviceFoundWithParams callback to the

Supplicant AIDL interface.

Also mark the previous onDeviceFound callbacks
as deprecated.

Bug: 296069900
Test: atest VtsHalWifiSupplicantP2pIfaceTargetTest

Change-Id: Ibeaf20832292a680adf94703b7a0eda1dc9f82d5
This commit is contained in:
Vinay Gannevaram
2023-12-05 17:34:04 +05:30
committed by Gabriel Biren
parent 7d1bdeb2d4
commit 0fe91de0cd
5 changed files with 166 additions and 0 deletions

View File

@@ -34,6 +34,9 @@
package android.hardware.wifi.supplicant;
@VintfStability
interface ISupplicantP2pIfaceCallback {
/**
* @deprecated This callback is deprecated from AIDL v2, newer HAL should call onDeviceFoundWithParams.
*/
oneway void onDeviceFound(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo);
oneway void onDeviceLost(in byte[] p2pDeviceAddress);
oneway void onFindStopped();
@@ -60,9 +63,13 @@ interface ISupplicantP2pIfaceCallback {
*/
oneway void onStaDeauthorized(in byte[] srcAddress, in byte[] p2pDeviceAddress);
oneway void onGroupFrequencyChanged(in String groupIfname, in int frequency);
/**
* @deprecated This callback is deprecated from AIDL v3, newer HAL should call onDeviceFoundWithParams.
*/
oneway void onDeviceFoundWithVendorElements(in byte[] srcAddress, in byte[] p2pDeviceAddress, in byte[] primaryDeviceType, in String deviceName, in android.hardware.wifi.supplicant.WpsConfigMethods configMethods, in byte deviceCapabilities, in android.hardware.wifi.supplicant.P2pGroupCapabilityMask groupCapabilities, in byte[] wfdDeviceInfo, in byte[] wfdR2DeviceInfo, in byte[] vendorElemBytes);
oneway void onGroupStartedWithParams(in android.hardware.wifi.supplicant.P2pGroupStartedEventParams groupStartedEventParams);
oneway void onPeerClientJoined(in android.hardware.wifi.supplicant.P2pPeerClientJoinedEventParams clientJoinedEventParams);
oneway void onPeerClientDisconnected(in android.hardware.wifi.supplicant.P2pPeerClientDisconnectedEventParams clientDisconnectedEventParams);
oneway void onProvisionDiscoveryCompletedEvent(in android.hardware.wifi.supplicant.P2pProvisionDiscoveryCompletedEventParams provisionDiscoveryCompletedEventParams);
oneway void onDeviceFoundWithParams(in android.hardware.wifi.supplicant.P2pDeviceFoundEventParams deviceFoundEventParams);
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
///////////////////////////////////////////////////////////////////////////////
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
// the interface (from the latest frozen version), the build system will
// prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.wifi.supplicant;
@VintfStability
parcelable P2pDeviceFoundEventParams {
byte[6] srcAddress;
byte[6] p2pDeviceAddress;
byte[] primaryDeviceType;
String deviceName;
int configMethods;
byte deviceCapabilities;
int groupCapabilities;
byte[] wfdDeviceInfo;
byte[] wfdR2DeviceInfo;
byte[] vendorElemBytes;
@nullable android.hardware.wifi.common.OuiKeyedData[] vendorData;
}

View File

@@ -16,6 +16,7 @@
package android.hardware.wifi.supplicant;
import android.hardware.wifi.supplicant.P2pDeviceFoundEventParams;
import android.hardware.wifi.supplicant.P2pGroupCapabilityMask;
import android.hardware.wifi.supplicant.P2pGroupStartedEventParams;
import android.hardware.wifi.supplicant.P2pPeerClientDisconnectedEventParams;
@@ -38,6 +39,9 @@ import android.hardware.wifi.supplicant.WpsDevPasswordId;
oneway interface ISupplicantP2pIfaceCallback {
/**
* Used to indicate that a P2P device has been found.
* <p>
* @deprecated This callback is deprecated from AIDL v2, newer HAL should call
* onDeviceFoundWithParams.
*
* @param srcAddress MAC address of the device found. This must either
* be the P2P device address or the P2P interface address.
@@ -228,6 +232,9 @@ oneway interface ISupplicantP2pIfaceCallback {
/**
* Used to indicate that a P2P device has been found.
* <p>
* @deprecated This callback is deprecated from AIDL v3, newer HAL should call
* onDeviceFoundWithParams.
*
* @param srcAddress MAC address of the device found. This must either
* be the P2P device address for a peer which is not in a group,
@@ -288,4 +295,11 @@ oneway interface ISupplicantP2pIfaceCallback {
*/
void onProvisionDiscoveryCompletedEvent(
in P2pProvisionDiscoveryCompletedEventParams provisionDiscoveryCompletedEventParams);
/**
* Used to indicate that a P2P device has been found.
*
* @param deviceFoundEventParams Parameters associated with the device found event.
*/
void onDeviceFoundWithParams(in P2pDeviceFoundEventParams deviceFoundEventParams);
}

View File

@@ -0,0 +1,92 @@
/*
* Copyright (C) 2023 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.wifi.supplicant;
import android.hardware.wifi.common.OuiKeyedData;
/**
* Parameters passed as a part of a P2P Device found event.
*/
@VintfStability
parcelable P2pDeviceFoundEventParams {
/**
* MAC address of the device found. This must either be the P2P device address
* for a peer which is not in a group, or the P2P interface address for
* a peer which is a Group Owner.
*/
byte[6] srcAddress;
/**
* P2P device address.
*/
byte[6] p2pDeviceAddress;
/**
* Type of device. Refer to section B.1 of the Wifi P2P Technical
* specification v1.2.
*/
byte[] primaryDeviceType;
/**
* Name of the device.
*/
String deviceName;
/**
* Mask of |WpsConfigMethods| indicating the WPS configuration methods
* supported by the device.
*/
int configMethods;
/**
* Refer to section 4.1.4 of the Wifi P2P Technical specification v1.2.
*/
byte deviceCapabilities;
/**
* Mask of |P2pGroupCapabilityMask| indicating the group capabilities.
* Refer to section 4.1.4 of the Wifi P2P Technical specification v1.2.
*/
int groupCapabilities;
/**
* WFD device info as described in section 5.1.2 of the WFD technical
* specification v1.0.0.
*/
byte[] wfdDeviceInfo;
/**
* WFD R2 device info as described in section 5.1.12 of WFD technical
* specification v2.1.
*/
byte[] wfdR2DeviceInfo;
/**
* Vendor-specific information element bytes. The format of an
* information element is EID (1 byte) + Length (1 Byte) + Payload which is
* defined in Section 9.4.4 TLV encodings of 802.11-2016 IEEE Standard for
* Information technology. The length indicates the size of the payload.
* Multiple information elements may be appended within the byte array.
*/
byte[] vendorElemBytes;
/**
* Optional vendor-specific data.
* Null value indicates that no vendor data is provided.
*/
@nullable OuiKeyedData[] vendorData;
}

View File

@@ -35,6 +35,7 @@ using aidl::android::hardware::wifi::supplicant::IfaceType;
using aidl::android::hardware::wifi::supplicant::ISupplicant;
using aidl::android::hardware::wifi::supplicant::ISupplicantP2pIface;
using aidl::android::hardware::wifi::supplicant::MiracastMode;
using aidl::android::hardware::wifi::supplicant::P2pDeviceFoundEventParams;
using aidl::android::hardware::wifi::supplicant::P2pFrameTypeMask;
using aidl::android::hardware::wifi::supplicant::P2pGroupCapabilityMask;
using aidl::android::hardware::wifi::supplicant::P2pGroupStartedEventParams;
@@ -199,6 +200,10 @@ class SupplicantP2pIfaceCallback : public BnSupplicantP2pIfaceCallback {
/* provisionDiscoveryCompletedEventParams */) override {
return ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus onDeviceFoundWithParams(
const P2pDeviceFoundEventParams& /* deviceFoundEventParams */) override {
return ndk::ScopedAStatus::ok();
}
};
class SupplicantP2pIfaceAidlTest : public testing::TestWithParam<std::string> {