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

Commit 83db1935 authored by Roshan Pius's avatar Roshan Pius Committed by Android (Google) Code Review
Browse files

Merge changes Ie9984ec7,I054d5249,I0bb8154f

* changes:
  wifi(implementation): Generate randomized mac address
  wifi(implementation): Set randomized MAC address for AP
  wifi(implementation): Move set/getMacaddress to a util class
parents 0d7a65f7 c4446793
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -33,6 +33,9 @@ endif
ifdef WIFI_HIDL_FEATURE_DISABLE_AP
LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP
endif
ifdef WIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION
LOCAL_CPPFLAGS += -DWIFI_HIDL_FEATURE_DISABLE_AP_MAC_RANDOMIZATION
endif
# Allow implicit fallthroughs in wifi_legacy_hal.cpp until they are fixed.
LOCAL_CFLAGS += -Wno-error=implicit-fallthrough
LOCAL_SRC_FILES := \
@@ -43,6 +46,7 @@ LOCAL_SRC_FILES := \
    wifi_ap_iface.cpp \
    wifi_chip.cpp \
    wifi_feature_flags.cpp \
    wifi_iface_util.cpp \
    wifi_legacy_hal.cpp \
    wifi_legacy_hal_stubs.cpp \
    wifi_mode_controller.cpp \
@@ -139,10 +143,13 @@ LOCAL_SRC_FILES := \
    tests/hidl_struct_util_unit_tests.cpp \
    tests/main.cpp \
    tests/mock_wifi_feature_flags.cpp \
    tests/mock_wifi_iface_util.cpp \
    tests/mock_wifi_legacy_hal.cpp \
    tests/mock_wifi_mode_controller.cpp \
    tests/ringbuffer_unit_tests.cpp \
    tests/wifi_chip_unit_tests.cpp
    tests/wifi_ap_iface_unit_tests.cpp \
    tests/wifi_chip_unit_tests.cpp \
    tests/wifi_iface_util_unit_tests.cpp
LOCAL_STATIC_LIBRARIES := \
    libgmock \
    libgtest \
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ using android::hardware::joinRpcThreadpool;
using android::hardware::LazyServiceRegistrar;
using android::hardware::wifi::V1_3::implementation::feature_flags::
    WifiFeatureFlags;
using android::hardware::wifi::V1_3::implementation::iface_util::WifiIfaceUtil;
using android::hardware::wifi::V1_3::implementation::legacy_hal::WifiLegacyHal;
using android::hardware::wifi::V1_3::implementation::mode_controller::
    WifiModeController;
@@ -52,6 +53,7 @@ int main(int /*argc*/, char** argv) {
        new android::hardware::wifi::V1_3::implementation::Wifi(
            std::make_shared<WifiLegacyHal>(),
            std::make_shared<WifiModeController>(),
            std::make_shared<WifiIfaceUtil>(),
            std::make_shared<WifiFeatureFlags>());
    if (kLazyService) {
        LazyServiceRegistrar registrar;
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ class MockWifiFeatureFlags : public WifiFeatureFlags {
    MockWifiFeatureFlags();

    MOCK_METHOD0(getChipModes, std::vector<V1_0::IWifiChip::ChipMode>());
    MOCK_METHOD0(isApMacRandomizationDisabled, bool());
};

}  // namespace feature_flags
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.
 */

#include <android-base/logging.h>
#include <android-base/macros.h>
#include <gmock/gmock.h>

#undef NAN  // This is weird, NAN is defined in bionic/libc/include/math.h:38
#include "mock_wifi_iface_util.h"

namespace android {
namespace hardware {
namespace wifi {
namespace V1_3 {
namespace implementation {
namespace iface_util {

MockWifiIfaceUtil::MockWifiIfaceUtil() : WifiIfaceUtil() {}
}  // namespace iface_util
}  // namespace implementation
}  // namespace V1_3
}  // namespace wifi
}  // namespace hardware
}  // namespace android
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.
 */

#ifndef MOCK_WIFI_IFACE_UTIL_H_
#define MOCK_WIFI_IFACE_UTIL_H_

#include <gmock/gmock.h>

#include "wifi_iface_util.h"

namespace android {
namespace hardware {
namespace wifi {
namespace V1_3 {
namespace implementation {
namespace iface_util {

class MockWifiIfaceUtil : public WifiIfaceUtil {
   public:
    MockWifiIfaceUtil();
    MOCK_METHOD1(getFactoryMacAddress,
                 std::array<uint8_t, 6>(const std::string&));
    MOCK_METHOD2(setMacAddress,
                 bool(const std::string&, const std::array<uint8_t, 6>&));
    MOCK_METHOD0(getOrCreateRandomMacAddress, std::array<uint8_t, 6>());
};
}  // namespace iface_util
}  // namespace implementation
}  // namespace V1_3
}  // namespace wifi
}  // namespace hardware
}  // namespace android

#endif  // MOCK_WIFI_IFACE_UTIL_H_
Loading