From fda43ac86a7fe42379932e58d2858a4acac36e83 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Wed, 10 Jan 2024 23:22:42 +0000 Subject: [PATCH] Wifi: Modified API for addGroupWithConfig Deprecated the existing addGroupWithConfig API which is used to setup a P2P group owner or join a group as a group client with the specified configuration(SSID, password, band/group). Added a new modified API called addGroupWithConfigurationParams to include the authentication key management used to setup a connection. Bug: 297426719 Test: Build successfully Change-Id: Iafc692bbbaac9f4d98f5983951dc87dc4438988a --- .../wifi/supplicant/ISupplicantP2pIface.aidl | 4 ++ .../hardware/wifi/supplicant/KeyMgmtMask.aidl | 1 + .../P2pAddGroupConfigurationParams.aidl | 44 ++++++++++++ .../wifi/supplicant/ISupplicantP2pIface.aidl | 16 +++++ .../hardware/wifi/supplicant/KeyMgmtMask.aidl | 4 ++ .../P2pAddGroupConfigurationParams.aidl | 68 +++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index 05a7548345..3babbe0c6b 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -36,6 +36,9 @@ package android.hardware.wifi.supplicant; interface ISupplicantP2pIface { void addBonjourService(in byte[] query, in byte[] response); void addGroup(in boolean persistent, in int persistentNetworkId); + /** + * @deprecated This method is deprecated from AIDL v3, newer HALs should use addGroupWithConfigurationParams. + */ void addGroupWithConfig(in byte[] ssid, in String pskPassphrase, in boolean persistent, in int freq, in byte[] peerAddress, in boolean joinExistingGroup); @PropagateAllowBlocking android.hardware.wifi.supplicant.ISupplicantP2pNetwork addNetwork(); void addUpnpService(in int version, in String serviceName); @@ -115,4 +118,5 @@ interface ISupplicantP2pIface { String connectWithParams(in android.hardware.wifi.supplicant.P2pConnectInfo connectInfo); void findWithParams(in android.hardware.wifi.supplicant.P2pDiscoveryInfo discoveryInfo); void configureExtListenWithParams(in android.hardware.wifi.supplicant.P2pExtListenInfo extListenInfo); + void addGroupWithConfigurationParams(in android.hardware.wifi.supplicant.P2pAddGroupConfigurationParams groupConfigurationParams); } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl index 35d51bc566..06c22cbde8 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/KeyMgmtMask.aidl @@ -51,4 +51,5 @@ enum KeyMgmtMask { WAPI_CERT = (1 << 13) /* 8192 */, FILS_SHA256 = (1 << 18) /* 262144 */, FILS_SHA384 = (1 << 19) /* 524288 */, + PASN = (1 << 25) /* 33554432 */, } diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl new file mode 100644 index 0000000000..8e6c5a05e5 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 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 -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 P2pAddGroupConfigurationParams { + byte[] ssid; + String passphrase; + boolean isPersistent; + int frequencyMHzOrBand; + byte[6] goInterfaceAddress; + boolean joinExistingGroup; + int keyMgmtMask; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl index 8b78a4a286..96239097ea 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl @@ -22,6 +22,7 @@ import android.hardware.wifi.supplicant.ISupplicantP2pIfaceCallback; import android.hardware.wifi.supplicant.ISupplicantP2pNetwork; import android.hardware.wifi.supplicant.IfaceType; import android.hardware.wifi.supplicant.MiracastMode; +import android.hardware.wifi.supplicant.P2pAddGroupConfigurationParams; import android.hardware.wifi.supplicant.P2pConnectInfo; import android.hardware.wifi.supplicant.P2pDiscoveryInfo; import android.hardware.wifi.supplicant.P2pExtListenInfo; @@ -74,6 +75,9 @@ interface ISupplicantP2pIface { * whose network name and group owner's MAC address matches the specified SSID * and peer address without WPS process. If peerAddress is 00:00:00:00:00:00, the first found * group whose network name matches the specified SSID is joined. + *

+ * @deprecated This method is deprecated from AIDL v3, newer HALs should use + * addGroupWithConfigurationParams. * * @param ssid The SSID of this group. * @param pskPassphrase The passphrase of this group. @@ -903,4 +907,16 @@ interface ISupplicantP2pIface { * |SupplicantStatusCode.FAILURE_IFACE_INVALID| */ void configureExtListenWithParams(in P2pExtListenInfo extListenInfo); + + /** + * Set up a P2P group owner or join a group as a group client + * with the specified configuration. + * + * @param groupConfigurationParams Parameters associated with this add group operation. + * @throws ServiceSpecificException with one of the following values: + * |SupplicantStatusCode.FAILURE_UNKNOWN|, + * |SupplicantStatusCode.FAILURE_IFACE_INVALID| + */ + void addGroupWithConfigurationParams( + in P2pAddGroupConfigurationParams groupConfigurationParams); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/KeyMgmtMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/KeyMgmtMask.aidl index f0c3345b93..8758645f1a 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/KeyMgmtMask.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/KeyMgmtMask.aidl @@ -71,4 +71,8 @@ enum KeyMgmtMask { * FILS shared key authentication with sha-384 */ FILS_SHA384 = 1 << 19, + /** + * Pre-Association Security Negotiation (PASN) Key management + */ + PASN = 1 << 25, } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl new file mode 100644 index 0000000000..1374f41ba6 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pAddGroupConfigurationParams.aidl @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 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.supplicant.KeyMgmtMask; + +/** + * Request parameters used for |ISupplicantP2pIface.addGroupWithConfigurationParams| + */ +@VintfStability +parcelable P2pAddGroupConfigurationParams { + /** The SSID of the group. */ + byte[] ssid; + + /** The passphrase used to secure the group. */ + String passphrase; + + /** Whether this group is persisted. Only applied on the group owner side */ + boolean isPersistent; + + /** + * The required frequency or band of the group. + * Only applied on the group owner side. + * The following values are supported: + * 0: automatic channel selection, + * 2: for 2.4GHz channels + * 5: for 5GHz channels + * 6: for 6GHz channels + * specific frequency in MHz, i.e., 2412, 5500, etc. + * If an invalid band or unsupported frequency are specified, + * |ISupplicantP2pIface.addGroupWithConfigurationParams| fails + */ + int frequencyMHzOrBand; + + /** + * The MAC Address of the P2P interface of the Peer GO device. + * This field is valid only for the group client side. + * If the MAC is "00:00:00:00:00:00", the device must try to find a peer GO device + * whose network name matches the specified SSID. + */ + byte[6] goInterfaceAddress; + + /* + * True if join a group as a group client; false to create a group as a group owner + */ + boolean joinExistingGroup; + + /** + * The authentication Key management mask for the connection. Combination of |KeyMgmtMask| + * values. The supported authentication key management types are WPA_PSK, SAE and PASN. + * + */ + int keyMgmtMask; +}