Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ee7743d authored by Jong Wook Kim's avatar Jong Wook Kim Committed by xshu
Browse files

Add Wifi HAL to get factory MAC address

Add getFactoryMacAddress method to retrieve the factory MAC of Sta
interface.

Bug: 111634904
Test: Manual Verification
Test: run vts with command "mma -j64 && adb sync data && adb shell data/nativetest64/VtsHalWifiV1_3TargetTest/VtsHalWifiV1_3TargetTest"
Change-Id: I82b47366d3576201ef54a4e89a3f864c31fff42c
parent 039bbfee
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.wifi@1.3;

import @1.0::WifiStatus;
import @1.0::MacAddress;
import @1.2::IWifiStaIface;

/**
@@ -41,4 +42,15 @@ interface IWifiStaIface extends @1.2::IWifiStaIface {
     * @return stats Instance of |LinkLayerStats|.
     */
    getLinkLayerStats_1_3() generates (WifiStatus status, StaLinkLayerStats stats);

    /**
     * Gets the factory MAC address of the Sta Interface
     * @return status WifiStatus of the operation
     *         Possible status codes:
     *         |WifiStatusCode.SUCCESS|,
     *         |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
     *         |WifiStatusCode.ERROR_UNKNOWN|
     * @return mac Factory MAC address of the Sta Interface
     */
     getFactoryMacAddress() generates (WifiStatus status, MacAddress mac);
};
+14 −0
Original line number Diff line number Diff line
@@ -255,6 +255,13 @@ Return<void> WifiStaIface::setMacAddress(const hidl_array<uint8_t, 6>& mac,
                           mac);
}

Return<void> WifiStaIface::getFactoryMacAddress(
    getFactoryMacAddress_cb hidl_status_cb) {
    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
                           &WifiStaIface::getFactoryMacAddressInternal,
                           hidl_status_cb);
}

std::pair<WifiStatus, std::string> WifiStaIface::getNameInternal() {
    return {createWifiStatus(WifiStatusCode::SUCCESS), ifname_};
}
@@ -633,6 +640,13 @@ WifiStatus WifiStaIface::setMacAddressInternal(
    return createWifiStatus(WifiStatusCode::SUCCESS);
}

std::pair<WifiStatus, std::array<uint8_t, 6>>
WifiStaIface::getFactoryMacAddressInternal() {
    std::array<uint8_t, 6> mac =
        iface_tool_.GetFactoryMacAddress(ifname_.c_str());
    return {createWifiStatus(WifiStatusCode::SUCCESS), mac};
}

}  // namespace implementation
}  // namespace V1_3
}  // namespace wifi
+4 −0
Original line number Diff line number Diff line
@@ -109,6 +109,8 @@ class WifiStaIface : public V1_3::IWifiStaIface {
        getDebugRxPacketFates_cb hidl_status_cb) override;
    Return<void> setMacAddress(const hidl_array<uint8_t, 6>& mac,
                               setMacAddress_cb hidl_status_cb) override;
    Return<void> getFactoryMacAddress(
        getFactoryMacAddress_cb hidl_status_cb) override;

   private:
    // Corresponding worker functions for the HIDL methods.
@@ -155,6 +157,8 @@ class WifiStaIface : public V1_3::IWifiStaIface {
    std::pair<WifiStatus, std::vector<WifiDebugRxPacketFateReport>>
    getDebugRxPacketFatesInternal();
    WifiStatus setMacAddressInternal(const std::array<uint8_t, 6>& mac);
    std::pair<WifiStatus, std::array<uint8_t, 6>>
    getFactoryMacAddressInternal();

    std::string ifname_;
    std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ cc_test {
    srcs: [
        "VtsHalWifiV1_3TargetTest.cpp",
        "wifi_chip_hidl_test.cpp",
        "wifi_sta_iface_hidl_test.cpp",
    ],
    static_libs: [
        "VtsHalWifiV1_0TargetTestUtil",
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@

#include "wifi_hidl_test_utils.h"

using ::android::hardware::wifi::V1_3::IWifi;

// Test environment for Wifi HIDL HAL.
class WifiHidlEnvironment_1_3 : public WifiHidlEnvironment {
   public:
Loading