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/current.txt b/current.txt
index ecfe7bd..f026d7d 100644
--- a/current.txt
+++ b/current.txt
@@ -653,10 +653,10 @@
 36b3acf78ac4ecf8156be8741c1d8332cdce7a1ebf4dfa1562952f14a94e6c87 android.hardware.wifi.hostapd@1.2::IHostapd
 2defa258951e25a132aaeb36e3febe6f41bf9c6dbb1b1ebdf0b41708ab4e107e android.hardware.wifi.hostapd@1.2::types
 a64467bae843569f0d465c5be7f0c7a5b987985b55a3ef4794dd5afc68538650 android.hardware.wifi.supplicant@1.3::ISupplicant
-213457930af81ff3ea344fbc9d4a0d0a2bb70527f96b7b6a32ee3b5e4c17057e android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
-c1b8cfff5a86a7edef800a65b7c8fa025f4546cb95710d48e27bac50a8d16619 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
-a6163000e2804472924733bcf8b4269db776460cc4df64f9c4dc8350d7aeafc5 android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
-16e3e23eea763fbff39230ef069823643c5760b738b3661dbbdaf460c5b9ba13 android.hardware.wifi.supplicant@1.3::types
+c72cb37b3f66ef65aeb5c6438a3fbe17bbe847fdf62d1a76eafd7f3a8a526105 android.hardware.wifi.supplicant@1.3::ISupplicantStaIface
+342a8e12db4dca643f2755eb4167e8f103d96502053a25a1f51f42107a4530f1 android.hardware.wifi.supplicant@1.3::ISupplicantStaIfaceCallback
+5477f8bafb29548875622fa83f1c0a29cee641acee613315eb747731001f4aff android.hardware.wifi.supplicant@1.3::ISupplicantStaNetwork
+91015479f5a0fba9872e98d3cca4680995de64f42ae71461b4b7e5acc5a196ab android.hardware.wifi.supplicant@1.3::types
 7a4ba60b5ddedf497e5d2bdff7d72b7d4a811969000e28677dd9e2389e683b34 android.hardware.radio@1.5::types
 afa2d6cf4c0ba4b8482d5bcc097594ad5bc49be0bf3003034f75955cdaf66045 android.hardware.radio@1.5::IRadio
 3afac66f21a33bc9c4b80481c7d5540038348651d9a7d8af64ea13610af138da android.hardware.radio@1.5::IRadioIndication
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
  */