Wifi: MBO-OCE feature support (phase 3)

Added hidl call back function to notify framework about
bss transition request frame handling status.
Also fixed few code style issues by running hidl-gen -Lformat.

Bug: 139474288
Test: Manual
Test: VTS test
Change-Id: I00760f14d81a59e63042b1a5be9f9e3f74ff3a83
diff --git a/wifi/supplicant/1.3/ISupplicantStaIface.hal b/wifi/supplicant/1.3/ISupplicantStaIface.hal
index fa88b91..58ef165 100644
--- a/wifi/supplicant/1.3/ISupplicantStaIface.hal
+++ b/wifi/supplicant/1.3/ISupplicantStaIface.hal
@@ -18,7 +18,7 @@
 
 import @1.0::SupplicantStatus;
 import @1.2::ISupplicantStaIface;
-import @1.3::ISupplicantStaNetwork;
+import ISupplicantStaNetwork;
 import ISupplicantStaIfaceCallback;
 
 /**
diff --git a/wifi/supplicant/1.3/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.3/ISupplicantStaIfaceCallback.hal
index ae7f797..72ba160 100644
--- a/wifi/supplicant/1.3/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.3/ISupplicantStaIfaceCallback.hal
@@ -28,6 +28,121 @@
  */
 interface ISupplicantStaIfaceCallback extends @1.2::ISupplicantStaIfaceCallback {
     /**
+     * IEEE Std 802.11-2016 - Table 9-357.
+     * BTM status code filled in BSS transition management response frame.
+     */
+    enum BssTmStatusCode : uint8_t {
+        ACCEPT = 0,
+        REJECT_UNSPECIFIED = 1,
+        REJECT_INSUFFICIENT_BEACON = 2,
+        REJECT_INSUFFICIENT_CAPABITY = 3,
+        REJECT_BSS_TERMINATION_UNDESIRED = 4,
+        REJECT_BSS_TERMINATION_DELAY_REQUEST = 5,
+        REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
+        REJECT_NO_SUITABLE_CANDIDATES = 7,
+        REJECT_LEAVING_ESS = 8,
+    };
+
+    /**
+     * Bitmask of various information retrieved from BSS transition management request frame.
+     */
+    enum BssTmDataFlagsMask : uint32_t {
+        /**
+         * Preferred candidate list included.
+         */
+        WNM_MODE_PREFERRED_CANDIDATE_LIST_INCLUDED = 1 << 0,
+        /**
+         * Abridged.
+         */
+        WNM_MODE_ABRIDGED = 1 << 1,
+        /**
+         * Disassociation Imminent.
+         */
+        WNM_MODE_DISASSOCIATION_IMMINENT = 1 << 2,
+        /**
+         * BSS termination included.
+         */
+        WNM_MODE_BSS_TERMINATION_INCLUDED = 1 << 3,
+        /**
+         * ESS Disassociation Imminent.
+         */
+        WNM_MODE_ESS_DISASSOCIATION_IMMINENT = 1 << 4,
+        /**
+         * MBO transition reason code included.
+         */
+        MBO_TRANSITION_REASON_CODE_INCLUDED = 1 << 5,
+        /**
+         * MBO retry delay time included.
+         */
+        MBO_ASSOC_RETRY_DELAY_INCLUDED = 1 << 6,
+        /**
+         * MBO cellular data connection preference value included.
+         */
+        MBO_CELLULAR_DATA_CONNECTION_PREFERENCE_INCLUDED = 1 << 7,
+    };
+
+    /**
+     *  MBO spec v1.2, 4.2.6 Table 18: MBO transition reason code attribute
+     *  values.
+     */
+    enum MboTransitionReasonCode : uint8_t {
+        UNSPECIFIED = 0,
+        EXCESSIVE_FRAME_LOSS = 1,
+        EXCESSIVE_TRAFFIC_DELAY = 2,
+        INSUFFICIENT_BANDWIDTH = 3,
+        LOAD_BALANCING = 4,
+        LOW_RSSI = 5,
+        RX_EXCESSIVE_RETRIES = 6,
+        HIGH_INTERFERENCE = 7,
+        GRAY_ZONE = 8,
+        TRANSITION_TO_PREMIUM_AP = 9,
+    };
+
+    /**
+     *  MBO spec v1.2, 4.2.5 Table 16: MBO Cellular Data connection preference
+     *  attribute values. AP use this to indicate STA, its preference for the
+     *  STA to move from BSS to cellular network.
+     */
+    enum MboCellularDataConnectionPrefValue : uint8_t {
+        EXCLUDED = 0,
+        NOT_PREFERRED = 1,
+        /*
+         * 2-254 Reserved.
+         */
+        PREFERRED = 255,
+    };
+
+    /**
+     * Data retrieved from received BSS transition management request frame.
+     */
+    struct BssTmData {
+        /*
+         * Status code filled in BSS transition management response frame
+         */
+        BssTmStatusCode status;
+
+        /*
+         * Bitmask of BssTmDataFlagsMask
+         */
+        bitfield<BssTmDataFlagsMask> flags;
+
+        /*
+         * Duration for which STA shouldn't try to re-associate.
+         */
+        uint32_t assocRetryDelayMs;
+
+        /*
+         * Reason for BSS transition request.
+         */
+        MboTransitionReasonCode mboTransitionReason;
+
+        /*
+         * Cellular Data Connection preference value.
+         */
+        MboCellularDataConnectionPrefValue mboCellPreference;
+    };
+
+    /**
      * Indicates PMK cache added event.
      *
      * @param expirationTimeInSec expiration time in seconds
@@ -61,5 +176,13 @@
      *     Operating Class.
      */
     oneway onDppFailure_1_3(DppFailureCode code, string ssid, string channelList,
-        vec<uint16_t>bandList);
+        vec<uint16_t> bandList);
+
+    /**
+     * Indicates BTM request frame handling status.
+     *
+     * @param BssTmData Data retrieved from received BSS transition management
+     * request frame.
+     */
+    oneway onBssTmHandlingDone(BssTmData tmData);
 };
diff --git a/wifi/supplicant/1.3/ISupplicantStaNetwork.hal b/wifi/supplicant/1.3/ISupplicantStaNetwork.hal
index 1bcf7bc..c18bffc 100644
--- a/wifi/supplicant/1.3/ISupplicantStaNetwork.hal
+++ b/wifi/supplicant/1.3/ISupplicantStaNetwork.hal
@@ -25,29 +25,44 @@
  * configuration it controls.
  */
 interface ISupplicantStaNetwork extends @1.2::ISupplicantStaNetwork {
-    /** Possble mask of values for Proto param. */
+    /**
+     * Possble mask of values for Proto param.
+     */
     enum ProtoMask : @1.0::ISupplicantStaNetwork.ProtoMask {
         WAPI = 1 << 2,
     };
 
-    /** Possble mask of values for KeyMgmt param. */
+    /**
+     * Possble mask of values for KeyMgmt param.
+     */
     enum KeyMgmtMask : @1.2::ISupplicantStaNetwork.KeyMgmtMask {
-        /* WAPI Psk */
+        /*
+         * WAPI Psk
+         */
         WAPI_PSK = 1 << 12,
-
-        /** WAPI Cert */
+        /**
+         * WAPI Cert
+         */
         WAPI_CERT = 1 << 13,
     };
 
-    /** Possble mask of values for PairwiseCipher param. */
+    /**
+     * Possble mask of values for PairwiseCipher param.
+     */
     enum PairwiseCipherMask : @1.2::ISupplicantStaNetwork.PairwiseCipherMask {
-        /** SMS4 Pairwise Cipher */
+        /**
+         * SMS4 Pairwise Cipher
+         */
         SMS4 = 1 << 7,
     };
 
-    /** Possble mask of values for GroupCipher param. */
+    /**
+     * Possble mask of values for GroupCipher param.
+     */
     enum GroupCipherMask : @1.2::ISupplicantStaNetwork.GroupCipherMask {
-        /** SMS4 Group Cipher */
+        /**
+         * SMS4 Group Cipher
+         */
         SMS4 = 1 << 7,
     };
 
@@ -99,8 +114,7 @@
      *         |SupplicantStatusCode.FAILURE_UNKNOWN|
      * @return keyMgmtMask Combination of |KeyMgmtMask| values.
      */
-    getKeyMgmt_1_3()
-        generates (SupplicantStatus status, bitfield<KeyMgmtMask> keyMgmtMask);
+    getKeyMgmt_1_3() generates (SupplicantStatus status, bitfield<KeyMgmtMask> keyMgmtMask);
 
     /**
      * Set proto mask for the network.
@@ -154,8 +168,7 @@
      * @return pairwiseCipherMask Combination of |PairwiseCipherMask| values.
      */
     getPairwiseCipher_1_3()
-        generates (SupplicantStatus status,
-            bitfield<PairwiseCipherMask> pairwiseCipherMask);
+        generates (SupplicantStatus status, bitfield<PairwiseCipherMask> pairwiseCipherMask);
 
     /**
      * Set pairwise cipher mask for the network.
@@ -183,8 +196,7 @@
      * @return groupCipherMask Combination of |GroupCipherMask| values.
      */
     getGroupCipher_1_3()
-        generates (SupplicantStatus status,
-            bitfield<GroupCipherMask> groupCipherMask);
+        generates (SupplicantStatus status, bitfield<GroupCipherMask> groupCipherMask);
 
     /**
      * Set WAPI certificate suite for this network.
diff --git a/wifi/supplicant/1.3/types.hal b/wifi/supplicant/1.3/types.hal
index 2e50279..05f4760 100644
--- a/wifi/supplicant/1.3/types.hal
+++ b/wifi/supplicant/1.3/types.hal
@@ -15,6 +15,7 @@
  */
 
 package android.hardware.wifi.supplicant@1.3;
+
 import @1.2::DppProgressCode;
 import @1.2::DppFailureCode;
 
@@ -87,7 +88,10 @@
  * DppSuccessCode: Success codes for DPP (Easy Connect) Configurator
  */
 enum DppSuccessCode : uint32_t {
-    CONFIGURATION_SENT, /* Replaces @1.2::onDppSuccessConfigSent() */
+    /*
+     * Replaces @1.2::onDppSuccessConfigSent()
+     */
+    CONFIGURATION_SENT,
     CONFIGURATION_APPLIED,
 };
 
diff --git a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
index 2b08e48..8c9f9cd 100644
--- a/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
+++ b/wifi/supplicant/1.3/vts/functional/supplicant_sta_iface_hidl_test.cpp
@@ -62,6 +62,9 @@
     int64_t pmkCacheExpirationTimeInSec;
     std::vector<uint8_t> serializedPmkCacheEntry;
 
+    // Data retrieved from BSS transition management frame.
+    ISupplicantStaIfaceCallback::BssTmData tmData;
+
     enum DppCallbackType {
         ANY_CALLBACK = -2,
         INVALID = -1,
@@ -229,6 +232,10 @@
         const hidl_vec<uint8_t>& /* serializedEntry */) override {
         return Void();
     }
+    Return<void> onBssTmHandlingDone(
+        const ISupplicantStaIfaceCallback::BssTmData& /* data */) override {
+        return Void();
+    }
 };
 
 class IfacePmkCacheCallback : public IfaceCallback {
@@ -279,6 +286,20 @@
    public:
     IfaceDppCallback(SupplicantStaIfaceHidlTest& parent) : parent_(parent){};
 };
+
+class IfaceBssTmHandlingDoneCallback : public IfaceCallback {
+    SupplicantStaIfaceHidlTest& parent_;
+    Return<void> onBssTmHandlingDone(
+        const ISupplicantStaIfaceCallback::BssTmData& data) override {
+        parent_.tmData = data;
+        return Void();
+    }
+
+   public:
+    IfaceBssTmHandlingDoneCallback(SupplicantStaIfaceHidlTest& parent)
+        : parent_(parent) {}
+};
+
 /*
  * RegisterCallback_1_3
  */