From fff05cd6e18aae74ade346bcbfc4fc2fb0e6ed78 Mon Sep 17 00:00:00 2001 From: Sunil Ravi Date: Mon, 22 Aug 2022 18:29:21 +0000 Subject: [PATCH] wifi: Add the connected frequency in the state change event Currently framework gets the connected AP frequency information by checking the scan cache & through signal poll command. But these mechanisms doesn't work if framework scan cache is not updated with the connected AP information (For example in case of roaming and force connection without scan). To fix this modified supplicant state change interface and included the frequency of the connected channel in the state change event. Bug: 240299862 Test: atest vts Test: Manual - Tested STA - AP connection and verfied the data from debug logs. Change-Id: I936bd3256420de38cdfee740e43972bc262ec4b8 --- .../ISupplicantStaIfaceCallback.aidl | 5 +- .../supplicant/SupplicantStateChangeData.aidl | 44 +++++++++++++ .../ISupplicantStaIfaceCallback.aidl | 35 +++------- .../supplicant/SupplicantStateChangeData.aidl | 65 +++++++++++++++++++ .../supplicant_sta_iface_aidl_test.cpp | 8 +-- 5 files changed, 126 insertions(+), 31 deletions(-) create mode 100644 wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl create mode 100644 wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 0a2d428ae4..b54f04d2df 100644 --- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -60,17 +60,20 @@ interface ISupplicantStaIfaceCallback { oneway void onNetworkNotFound(in byte[] ssid); oneway void onNetworkRemoved(in int id); oneway void onPmkCacheAdded(in long expirationTimeInSec, in byte[] serializedEntry); + /** + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call onSupplicantStateChanged() + */ oneway void onStateChanged(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent); oneway void onWpsEventFail(in byte[] bssid, in android.hardware.wifi.supplicant.WpsConfigError configError, in android.hardware.wifi.supplicant.WpsErrorIndication errorInd); oneway void onWpsEventPbcOverlap(); oneway void onWpsEventSuccess(); oneway void onQosPolicyReset(); oneway void onQosPolicyRequest(in int qosPolicyRequestId, in android.hardware.wifi.supplicant.QosPolicyData[] qosPolicyData); - oneway void onStateChangedWithAkm(in android.hardware.wifi.supplicant.StaIfaceCallbackState newState, in byte[] bssid, in int id, in byte[] ssid, in boolean filsHlpSent, in android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask); oneway void onMloLinksInfoChanged(in android.hardware.wifi.supplicant.ISupplicantStaIfaceCallback.MloLinkInfoChangeReason reason); oneway void onDppConfigReceived(in android.hardware.wifi.supplicant.DppConfigurationData configData); oneway void onDppConnectionStatusResultSent(in android.hardware.wifi.supplicant.DppStatusErrorCode code); oneway void onBssFrequencyChanged(in int frequencyMhz); + oneway void onSupplicantStateChanged(in android.hardware.wifi.supplicant.SupplicantStateChangeData stateChangeData); @Backing(type="int") @VintfStability enum MloLinkInfoChangeReason { TID_TO_LINK_MAP = 0, diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl new file mode 100644 index 0000000000..e6bb859bc7 --- /dev/null +++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2022 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 SupplicantStateChangeData { + android.hardware.wifi.supplicant.StaIfaceCallbackState newState; + int id; + byte[] ssid; + byte[] bssid; + android.hardware.wifi.supplicant.KeyMgmtMask keyMgmtMask; + int frequencyMhz; + boolean filsHlpSent; +} diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl index 7d46649033..5001800e11 100644 --- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantStaIfaceCallback.aidl @@ -29,11 +29,11 @@ import android.hardware.wifi.supplicant.DppFailureCode; import android.hardware.wifi.supplicant.DppProgressCode; import android.hardware.wifi.supplicant.DppStatusErrorCode; import android.hardware.wifi.supplicant.Hs20AnqpData; -import android.hardware.wifi.supplicant.KeyMgmtMask; import android.hardware.wifi.supplicant.OsuMethod; import android.hardware.wifi.supplicant.QosPolicyData; import android.hardware.wifi.supplicant.StaIfaceCallbackState; import android.hardware.wifi.supplicant.StaIfaceReasonCode; +import android.hardware.wifi.supplicant.SupplicantStateChangeData; import android.hardware.wifi.supplicant.WpsConfigError; import android.hardware.wifi.supplicant.WpsErrorIndication; @@ -259,7 +259,8 @@ oneway interface ISupplicantStaIfaceCallback { * |ssid|, |bssid| parameters must indicate the parameters of the network/AP * which caused this state transition. *

- * This callback is deprecated from AIDL v2, newer HAL should call onStateChangedWithAkm(). + * @deprecated This callback is deprecated from AIDL v2, newer HAL should call + * onSupplicantStateChanged() * * @param newState New State of the interface. This must be one of the |State| * values above. @@ -312,29 +313,6 @@ oneway interface ISupplicantStaIfaceCallback { */ void onQosPolicyRequest(in int qosPolicyRequestId, in QosPolicyData[] qosPolicyData); - /** - * Used to indicate a state change event on this particular iface. If this - * event is triggered by a particular network, the |id|, - * |ssid|, |bssid| parameters must indicate the parameters of the network/AP - * which caused this state transition. - * - * @param newState New State of the interface. This must be one of the - * |StaIfaceCallbackState| values above. - * @param bssid BSSID of the corresponding AP which caused this state - * change event. This must be zero'ed if this event is not - * specific to a particular network. - * @param id ID of the corresponding network which caused this - * state change event. This must be invalid (-1) if this - * event is not specific to a particular network. - * @param ssid SSID of the corresponding network which caused this state - * change event. This must be empty if this event is not specific - * to a particular network. - * @param filsHlpSent Whether FILS HLP IEs were included in this association. - * @param keyMgmtMask current used key mgmt mask. - */ - void onStateChangedWithAkm(in StaIfaceCallbackState newState, in byte[] bssid, in int id, - in byte[] ssid, in boolean filsHlpSent, in KeyMgmtMask keyMgmtMask); - /** * Reason codes to be used with the callback |ISupplicantStaIfaceCallback.onMloLinksInfoChanged| */ @@ -393,4 +371,11 @@ oneway interface ISupplicantStaIfaceCallback { * @param frequencyMhz New operating frequency in MHz. */ void onBssFrequencyChanged(in int frequencyMhz); + + /** + * Used to indicate a state change event on this particular iface. + * + * @param stateChangeData Supplicant state change related information. + */ + void onSupplicantStateChanged(in SupplicantStateChangeData stateChangeData); } diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl new file mode 100644 index 0000000000..8fa5dc77a1 --- /dev/null +++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/SupplicantStateChangeData.aidl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2022 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; +import android.hardware.wifi.supplicant.StaIfaceCallbackState; + +/** + * Supplicant state change related information. + */ +@VintfStability +parcelable SupplicantStateChangeData { + /** + * New State of the interface. This must be one of the + * |StaIfaceCallbackState| values. + */ + StaIfaceCallbackState newState; + /** + * ID of the corresponding network which caused this + * state change event. This must be invalid (-1) if this + * event is not specific to a particular network. + */ + int id; + /** + * SSID of the corresponding network which caused this state + * change event. This must be empty if this event is not specific + * to a particular network. + */ + byte[] ssid; + /** + * BSSID of the corresponding AP which caused this state + * change event. This must be zero'ed if this event is not + * specific to a particular network. + */ + byte[/* 6 */] bssid; + + /** + * Currently used key mgmt mask. + */ + KeyMgmtMask keyMgmtMask; + /* + * Frequency of the connected channel in MHz. This must be zero if this + * event is not specific to a particular network. + */ + int frequencyMhz; + /* + * Flag to indicate that FILS HLP IEs were included in this association. + * This flag is valid only for WPA_COMPLETED state change. + */ + boolean filsHlpSent; +} diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp index e957834eab..d5366180ce 100644 --- a/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp +++ b/wifi/supplicant/aidl/vts/functional/supplicant_sta_iface_aidl_test.cpp @@ -206,11 +206,9 @@ class SupplicantStaIfaceCallback : public BnSupplicantStaIfaceCallback { QosPolicyData /* qosPolicyData */>&) override { return ndk::ScopedAStatus::ok(); } - ::ndk::ScopedAStatus onStateChangedWithAkm( - ::aidl::android::hardware::wifi::supplicant::StaIfaceCallbackState /* newState */, - const std::vector& /* bssid */, int32_t /* id */, - const std::vector& /* ssid */, bool /* filsHlpSent */, - ::aidl::android::hardware::wifi::supplicant::KeyMgmtMask /* keyMgmtMask*/) override { + ::ndk::ScopedAStatus onSupplicantStateChanged( + const ::aidl::android::hardware::wifi::supplicant:: + SupplicantStateChangeData& /* stateChangeData */) override { return ndk::ScopedAStatus::ok(); } ::ndk::ScopedAStatus onMloLinksInfoChanged(