From ee3daf9ab68231cc4eb71eba8fec9d2f28c7ecef Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 20 Jun 2017 11:36:29 -0700 Subject: [PATCH 1/2] wifi(interface): Create 1.1 interface package Extend the wifi HAL to add a new method in IWifiChip. This new method is used for setting the TX power limit for meeting SAR requirements. Bug: 62437848 Test: ./hardware/interfaces/update-makefiles.sh Test: mmm -j32 hardware/interfaces/wifi/1.1 Change-Id: I8320a64812339f15cd88636505de0dfda18f0ebf --- wifi/1.1/Android.bp | 68 ++++++++++++++++++++++++ wifi/1.1/Android.mk | 116 +++++++++++++++++++++++++++++++++++++++++ wifi/1.1/IWifi.hal | 28 ++++++++++ wifi/1.1/IWifiChip.hal | 67 ++++++++++++++++++++++++ wifi/Android.bp | 1 + 5 files changed, 280 insertions(+) create mode 100644 wifi/1.1/Android.bp create mode 100644 wifi/1.1/Android.mk create mode 100644 wifi/1.1/IWifi.hal create mode 100644 wifi/1.1/IWifiChip.hal diff --git a/wifi/1.1/Android.bp b/wifi/1.1/Android.bp new file mode 100644 index 0000000000..f991fa5465 --- /dev/null +++ b/wifi/1.1/Android.bp @@ -0,0 +1,68 @@ +// This file is autogenerated by hidl-gen. Do not edit manually. + +filegroup { + name: "android.hardware.wifi@1.1_hal", + srcs: [ + "IWifi.hal", + "IWifiChip.hal", + ], +} + +genrule { + name: "android.hardware.wifi@1.1_genc++", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++-sources -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.1", + srcs: [ + ":android.hardware.wifi@1.1_hal", + ], + out: [ + "android/hardware/wifi/1.1/WifiAll.cpp", + "android/hardware/wifi/1.1/WifiChipAll.cpp", + ], +} + +genrule { + name: "android.hardware.wifi@1.1_genc++_headers", + tools: ["hidl-gen"], + cmd: "$(location hidl-gen) -o $(genDir) -Lc++-headers -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi@1.1", + srcs: [ + ":android.hardware.wifi@1.1_hal", + ], + out: [ + "android/hardware/wifi/1.1/IWifi.h", + "android/hardware/wifi/1.1/IHwWifi.h", + "android/hardware/wifi/1.1/BnHwWifi.h", + "android/hardware/wifi/1.1/BpHwWifi.h", + "android/hardware/wifi/1.1/BsWifi.h", + "android/hardware/wifi/1.1/IWifiChip.h", + "android/hardware/wifi/1.1/IHwWifiChip.h", + "android/hardware/wifi/1.1/BnHwWifiChip.h", + "android/hardware/wifi/1.1/BpHwWifiChip.h", + "android/hardware/wifi/1.1/BsWifiChip.h", + ], +} + +cc_library_shared { + name: "android.hardware.wifi@1.1", + defaults: ["hidl-module-defaults"], + generated_sources: ["android.hardware.wifi@1.1_genc++"], + generated_headers: ["android.hardware.wifi@1.1_genc++_headers"], + export_generated_headers: ["android.hardware.wifi@1.1_genc++_headers"], + vendor_available: true, + shared_libs: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "liblog", + "libutils", + "libcutils", + "android.hardware.wifi@1.0", + ], + export_shared_lib_headers: [ + "libhidlbase", + "libhidltransport", + "libhwbinder", + "libutils", + "android.hardware.wifi@1.0", + ], +} diff --git a/wifi/1.1/Android.mk b/wifi/1.1/Android.mk new file mode 100644 index 0000000000..fbc79ca159 --- /dev/null +++ b/wifi/1.1/Android.mk @@ -0,0 +1,116 @@ +# This file is autogenerated by hidl-gen. Do not edit manually. + +LOCAL_PATH := $(call my-dir) + +################################################################################ + +include $(CLEAR_VARS) +LOCAL_MODULE := android.hardware.wifi-V1.1-java +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +intermediates := $(call local-generated-sources-dir, COMMON) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +LOCAL_JAVA_LIBRARIES := \ + android.hardware.wifi-V1.0-java \ + android.hidl.base-V1.0-java \ + + +# +# Build IWifi.hal +# +GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifi.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi@1.1::IWifi + +$(GEN): $(LOCAL_PATH)/IWifi.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiChip.hal +# +GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifiChip.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi@1.1::IWifiChip + +$(GEN): $(LOCAL_PATH)/IWifiChip.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_JAVA_LIBRARY) + + +################################################################################ + +include $(CLEAR_VARS) +LOCAL_MODULE := android.hardware.wifi-V1.1-java-static +LOCAL_MODULE_CLASS := JAVA_LIBRARIES + +intermediates := $(call local-generated-sources-dir, COMMON) + +HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX) + +LOCAL_STATIC_JAVA_LIBRARIES := \ + android.hardware.wifi-V1.0-java-static \ + android.hidl.base-V1.0-java-static \ + + +# +# Build IWifi.hal +# +GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifi.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifi.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi@1.1::IWifi + +$(GEN): $(LOCAL_PATH)/IWifi.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) + +# +# Build IWifiChip.hal +# +GEN := $(intermediates)/android/hardware/wifi/V1_1/IWifiChip.java +$(GEN): $(HIDL) +$(GEN): PRIVATE_HIDL := $(HIDL) +$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IWifiChip.hal +$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates) +$(GEN): PRIVATE_CUSTOM_TOOL = \ + $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \ + -Ljava \ + -randroid.hardware:hardware/interfaces \ + -randroid.hidl:system/libhidl/transport \ + android.hardware.wifi@1.1::IWifiChip + +$(GEN): $(LOCAL_PATH)/IWifiChip.hal + $(transform-generated-source) +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_STATIC_JAVA_LIBRARY) + + + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/wifi/1.1/IWifi.hal b/wifi/1.1/IWifi.hal new file mode 100644 index 0000000000..bd48f57931 --- /dev/null +++ b/wifi/1.1/IWifi.hal @@ -0,0 +1,28 @@ +/* + * Copyright 2016 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@1.1; + +import @1.0::IWifi; + +/** + * This is the root of the HAL module and is the interface returned when + * loading an implementation of the Wi-Fi HAL. There must be at most one + * module loaded in the system. + * IWifi.getChip() may return either a @1.0::IWifiChip or @1.1::IWifiChip. + */ +interface IWifi extends @1.0::IWifi { +}; diff --git a/wifi/1.1/IWifiChip.hal b/wifi/1.1/IWifiChip.hal new file mode 100644 index 0000000000..7275412802 --- /dev/null +++ b/wifi/1.1/IWifiChip.hal @@ -0,0 +1,67 @@ +/* + * Copyright 2016 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@1.1; + +import @1.0::IWifiChip; +import @1.0::WifiStatus; + +/** + * Interface that represents a chip that must be configured as a single unit. + * The HAL/driver/firmware will be responsible for determining which phy is used + * to perform operations like NAN, RTT, etc. + */ +interface IWifiChip extends @1.0::IWifiChip { + /** + * Capabilities exposed by this chip. + */ + enum ChipCapabilityMask : @1.0::IWifiChip.ChipCapabilityMask { + /** + * Set/Reset Tx Power limits. + */ + SET_TX_POWER_LIMIT = 1 << 8 + }; + + /** + * API to set TX power limit. + * This is used for meeting SAR requirements while making VOIP calls for + * example. + * + * @param powerInDbm Power level in dBm. + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.NOT_AVAILABLE|, + * |WifiStatusCode.UNKNOWN| + */ + setTxPowerLimit(int32_t powerInDbm) generates (WifiStatus status); + + /** + * API to reset TX power limit. + * This is used to set the power back to default values. + * + * @return status WifiStatus of the operation. + * Possible status codes: + * |WifiStatusCode.SUCCESS|, + * |WifiStatusCode.ERROR_WIFI_CHIP_INVALID|, + * |WifiStatusCode.ERROR_NOT_SUPPORTED|, + * |WifiStatusCode.NOT_AVAILABLE|, + * |WifiStatusCode.UNKNOWN| + */ + resetTxPowerLimit() generates (WifiStatus status); +}; diff --git a/wifi/Android.bp b/wifi/Android.bp index 523014f2c4..230e720f0c 100644 --- a/wifi/Android.bp +++ b/wifi/Android.bp @@ -2,6 +2,7 @@ subdirs = [ "1.0", "1.0/vts/functional", + "1.1", "offload/1.0", "offload/1.0/vts/functional", "supplicant/1.0", From dbd83ef5855a40840278fa865d23b31cc911cd2e Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 20 Jun 2017 12:05:40 -0700 Subject: [PATCH 2/2] wifi(implementation): Create 1.1 interface package 1. Move the implementation in 1.0/default to 1.1/default. 2. Move all of the implementation to android::hardware::V1_1::implementation namespace. 3. All of the header files include the android::hardware::V1_0 namespace so that it can access the types from 1.0 package. ("using namespace" is against Google style guide though :(). The other option to prefix each 1.0 type with the namespace name. For example: V1_0::WifiStatus. 4. Added the implementation of the new 1.1 method IWifiChip.setTxPowerLimit(). 4. The executable name and the .rc still has 1.0 name in it to avoid changing all the device.mk files. TODO: Hookup to the new legacy HAL API. Bug: 62437848 Test: mmm -j128 hardware/interfaces/wifi/1.1/default/ Test: Device boots up and able to connect to wifi networks. Test: New VTS tests passes Change-Id: Ib36282939e70b064f246041a03d8870f5cb6410e --- wifi/1.0/vts/functional/Android.bp | 4 +- wifi/{1.0 => 1.1}/default/Android.mk | 1 + wifi/{1.0 => 1.1}/default/THREADING.README | 0 .../android.hardware.wifi@1.0-service.rc | 0 .../{1.0 => 1.1}/default/hidl_callback_util.h | 4 +- wifi/{1.0 => 1.1}/default/hidl_return_util.h | 5 +- .../{1.0 => 1.1}/default/hidl_struct_util.cpp | 4 +- wifi/{1.0 => 1.1}/default/hidl_struct_util.h | 5 +- wifi/{1.0 => 1.1}/default/hidl_sync_util.cpp | 4 +- wifi/{1.0 => 1.1}/default/hidl_sync_util.h | 4 +- wifi/{1.0 => 1.1}/default/service.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi.h | 9 +- wifi/{1.0 => 1.1}/default/wifi_ap_iface.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_ap_iface.h | 7 +- wifi/{1.0 => 1.1}/default/wifi_chip.cpp | 33 ++++++- wifi/{1.0 => 1.1}/default/wifi_chip.h | 14 ++- .../{1.0 => 1.1}/default/wifi_feature_flags.h | 4 +- wifi/{1.0 => 1.1}/default/wifi_legacy_hal.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_legacy_hal.h | 4 +- .../default/wifi_legacy_hal_stubs.cpp | 4 +- .../default/wifi_legacy_hal_stubs.h | 4 +- .../default/wifi_mode_controller.cpp | 4 +- .../default/wifi_mode_controller.h | 6 +- wifi/{1.0 => 1.1}/default/wifi_nan_iface.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_nan_iface.h | 7 +- wifi/{1.0 => 1.1}/default/wifi_p2p_iface.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_p2p_iface.h | 7 +- .../default/wifi_rtt_controller.cpp | 4 +- .../default/wifi_rtt_controller.h | 6 +- wifi/{1.0 => 1.1}/default/wifi_sta_iface.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_sta_iface.h | 7 +- .../{1.0 => 1.1}/default/wifi_status_util.cpp | 4 +- wifi/{1.0 => 1.1}/default/wifi_status_util.h | 5 +- wifi/1.1/vts/functional/Android.bp | 39 ++++++++ .../functional/VtsHalWifiV1_1TargetTest.cpp | 29 ++++++ .../vts/functional/wifi_chip_hidl_test.cpp | 94 +++++++++++++++++++ wifi/Android.bp | 1 + 38 files changed, 281 insertions(+), 70 deletions(-) rename wifi/{1.0 => 1.1}/default/Android.mk (97%) rename wifi/{1.0 => 1.1}/default/THREADING.README (100%) rename wifi/{1.0 => 1.1}/default/android.hardware.wifi@1.0-service.rc (100%) rename wifi/{1.0 => 1.1}/default/hidl_callback_util.h (98%) rename wifi/{1.0 => 1.1}/default/hidl_return_util.h (97%) rename wifi/{1.0 => 1.1}/default/hidl_struct_util.cpp (99%) rename wifi/{1.0 => 1.1}/default/hidl_struct_util.h (98%) rename wifi/{1.0 => 1.1}/default/hidl_sync_util.cpp (96%) rename wifi/{1.0 => 1.1}/default/hidl_sync_util.h (96%) rename wifi/{1.0 => 1.1}/default/service.cpp (91%) rename wifi/{1.0 => 1.1}/default/wifi.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi.h (94%) rename wifi/{1.0 => 1.1}/default/wifi_ap_iface.cpp (98%) rename wifi/{1.0 => 1.1}/default/wifi_ap_iface.h (94%) rename wifi/{1.0 => 1.1}/default/wifi_chip.cpp (96%) rename wifi/{1.0 => 1.1}/default/wifi_chip.h (95%) rename wifi/{1.0 => 1.1}/default/wifi_feature_flags.h (96%) rename wifi/{1.0 => 1.1}/default/wifi_legacy_hal.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi_legacy_hal.h (99%) rename wifi/{1.0 => 1.1}/default/wifi_legacy_hal_stubs.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi_legacy_hal_stubs.h (96%) rename wifi/{1.0 => 1.1}/default/wifi_mode_controller.cpp (98%) rename wifi/{1.0 => 1.1}/default/wifi_mode_controller.h (95%) rename wifi/{1.0 => 1.1}/default/wifi_nan_iface.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi_nan_iface.h (97%) rename wifi/{1.0 => 1.1}/default/wifi_p2p_iface.cpp (98%) rename wifi/{1.0 => 1.1}/default/wifi_p2p_iface.h (92%) rename wifi/{1.0 => 1.1}/default/wifi_rtt_controller.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi_rtt_controller.h (97%) rename wifi/{1.0 => 1.1}/default/wifi_sta_iface.cpp (99%) rename wifi/{1.0 => 1.1}/default/wifi_sta_iface.h (98%) rename wifi/{1.0 => 1.1}/default/wifi_status_util.cpp (98%) rename wifi/{1.0 => 1.1}/default/wifi_status_util.h (94%) create mode 100644 wifi/1.1/vts/functional/Android.bp create mode 100644 wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp create mode 100644 wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp index b454a06d81..2d6679f779 100644 --- a/wifi/1.0/vts/functional/Android.bp +++ b/wifi/1.0/vts/functional/Android.bp @@ -17,10 +17,12 @@ cc_library_static { name: "VtsHalWifiV1_0TargetTestUtil", srcs: [ - "wifi_hidl_call_util_selftest.cpp", "wifi_hidl_test.cpp", "wifi_hidl_test_utils.cpp"], + export_include_dirs: [ + "." + ], shared_libs: [ "libbase", "liblog", diff --git a/wifi/1.0/default/Android.mk b/wifi/1.1/default/Android.mk similarity index 97% rename from wifi/1.0/default/Android.mk rename to wifi/1.1/default/Android.mk index fe33e08672..5758422303 100644 --- a/wifi/1.0/default/Android.mk +++ b/wifi/1.1/default/Android.mk @@ -38,6 +38,7 @@ LOCAL_SRC_FILES := \ wifi_status_util.cpp LOCAL_SHARED_LIBRARIES := \ android.hardware.wifi@1.0 \ + android.hardware.wifi@1.1 \ libbase \ libcutils \ libhidlbase \ diff --git a/wifi/1.0/default/THREADING.README b/wifi/1.1/default/THREADING.README similarity index 100% rename from wifi/1.0/default/THREADING.README rename to wifi/1.1/default/THREADING.README diff --git a/wifi/1.0/default/android.hardware.wifi@1.0-service.rc b/wifi/1.1/default/android.hardware.wifi@1.0-service.rc similarity index 100% rename from wifi/1.0/default/android.hardware.wifi@1.0-service.rc rename to wifi/1.1/default/android.hardware.wifi@1.0-service.rc diff --git a/wifi/1.0/default/hidl_callback_util.h b/wifi/1.1/default/hidl_callback_util.h similarity index 98% rename from wifi/1.0/default/hidl_callback_util.h rename to wifi/1.1/default/hidl_callback_util.h index b7100c8ac2..fb13622253 100644 --- a/wifi/1.0/default/hidl_callback_util.h +++ b/wifi/1.1/default/hidl_callback_util.h @@ -51,7 +51,7 @@ class HidlDeathHandler : public android::hardware::hidl_death_recipient { namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_callback_util { template @@ -114,7 +114,7 @@ class HidlCallbackHandler { } // namespace hidl_callback_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/hidl_return_util.h b/wifi/1.1/default/hidl_return_util.h similarity index 97% rename from wifi/1.0/default/hidl_return_util.h rename to wifi/1.1/default/hidl_return_util.h index 3f6364be3f..2f95c23d7e 100644 --- a/wifi/1.0/default/hidl_return_util.h +++ b/wifi/1.1/default/hidl_return_util.h @@ -23,9 +23,10 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_return_util { +using namespace android::hardware::wifi::V1_0; /** * These utility functions are used to invoke a method on the provided @@ -106,7 +107,7 @@ Return validateAndCall( } // namespace hidl_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.1/default/hidl_struct_util.cpp similarity index 99% rename from wifi/1.0/default/hidl_struct_util.cpp rename to wifi/1.1/default/hidl_struct_util.cpp index fa0279beac..e40a7d8fd3 100644 --- a/wifi/1.0/default/hidl_struct_util.cpp +++ b/wifi/1.1/default/hidl_struct_util.cpp @@ -22,7 +22,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_struct_util { @@ -2177,7 +2177,7 @@ bool convertLegacyVectorOfRttResultToHidl( } } // namespace hidl_struct_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/hidl_struct_util.h b/wifi/1.1/default/hidl_struct_util.h similarity index 98% rename from wifi/1.0/default/hidl_struct_util.h rename to wifi/1.1/default/hidl_struct_util.h index c04d92fbd6..a04f6363df 100644 --- a/wifi/1.0/default/hidl_struct_util.h +++ b/wifi/1.1/default/hidl_struct_util.h @@ -32,9 +32,10 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_struct_util { +using namespace android::hardware::wifi::V1_0; // Chip conversion methods. bool convertLegacyFeaturesToHidlChipCapabilities( @@ -161,7 +162,7 @@ bool convertLegacyVectorOfRttResultToHidl( std::vector* hidl_results); } // namespace hidl_struct_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/hidl_sync_util.cpp b/wifi/1.1/default/hidl_sync_util.cpp similarity index 96% rename from wifi/1.0/default/hidl_sync_util.cpp rename to wifi/1.1/default/hidl_sync_util.cpp index 7d47f2f7bd..ba18e344aa 100644 --- a/wifi/1.0/default/hidl_sync_util.cpp +++ b/wifi/1.1/default/hidl_sync_util.cpp @@ -23,7 +23,7 @@ std::recursive_mutex g_mutex; namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_sync_util { @@ -33,7 +33,7 @@ std::unique_lock acquireGlobalLock() { } // namespace hidl_sync_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/hidl_sync_util.h b/wifi/1.1/default/hidl_sync_util.h similarity index 96% rename from wifi/1.0/default/hidl_sync_util.h rename to wifi/1.1/default/hidl_sync_util.h index 6631e55bca..0e882df50b 100644 --- a/wifi/1.0/default/hidl_sync_util.h +++ b/wifi/1.1/default/hidl_sync_util.h @@ -24,13 +24,13 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace hidl_sync_util { std::unique_lock acquireGlobalLock(); } // namespace hidl_sync_util } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/service.cpp b/wifi/1.1/default/service.cpp similarity index 91% rename from wifi/1.0/default/service.cpp rename to wifi/1.1/default/service.cpp index 059304e335..b3fcd50e55 100644 --- a/wifi/1.0/default/service.cpp +++ b/wifi/1.1/default/service.cpp @@ -32,8 +32,8 @@ int main(int /*argc*/, char** argv) { configureRpcThreadpool(1, true /* callerWillJoin */); // Setup hwbinder service - android::sp service = - new android::hardware::wifi::V1_0::implementation::Wifi(); + android::sp service = + new android::hardware::wifi::V1_1::implementation::Wifi(); CHECK_EQ(service->registerAsService(), android::NO_ERROR) << "Failed to register wifi HAL"; diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.1/default/wifi.cpp similarity index 99% rename from wifi/1.0/default/wifi.cpp rename to wifi/1.1/default/wifi.cpp index b48844ef2a..4ed1f555e2 100644 --- a/wifi/1.0/default/wifi.cpp +++ b/wifi/1.1/default/wifi.cpp @@ -28,7 +28,7 @@ static constexpr android::hardware::wifi::V1_0::ChipId kChipId = 0; namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -195,7 +195,7 @@ WifiStatus Wifi::stopLegacyHalAndDeinitializeModeController() { return createWifiStatus(WifiStatusCode::SUCCESS); } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi.h b/wifi/1.1/default/wifi.h similarity index 94% rename from wifi/1.0/default/wifi.h rename to wifi/1.1/default/wifi.h index c6fa84cb37..1ade2d8b9b 100644 --- a/wifi/1.0/default/wifi.h +++ b/wifi/1.1/default/wifi.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include "hidl_callback_util.h" @@ -31,13 +31,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * Root HIDL interface object used to control the Wifi HAL. */ -class Wifi : public IWifi { +class Wifi : public V1_1::IWifi { public: Wifi(); @@ -79,7 +80,7 @@ class Wifi : public IWifi { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.1/default/wifi_ap_iface.cpp similarity index 98% rename from wifi/1.0/default/wifi_ap_iface.cpp rename to wifi/1.1/default/wifi_ap_iface.cpp index e2beec2c62..150a6cc06f 100644 --- a/wifi/1.0/default/wifi_ap_iface.cpp +++ b/wifi/1.1/default/wifi_ap_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -100,7 +100,7 @@ WifiApIface::getValidFrequenciesForBandInternal(WifiBand band) { return {createWifiStatusFromLegacyError(legacy_status), valid_frequencies}; } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.1/default/wifi_ap_iface.h similarity index 94% rename from wifi/1.0/default/wifi_ap_iface.h rename to wifi/1.1/default/wifi_ap_iface.h index efc168a08a..608fe6b5ac 100644 --- a/wifi/1.0/default/wifi_ap_iface.h +++ b/wifi/1.1/default/wifi_ap_iface.h @@ -25,13 +25,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a AP Iface instance. */ -class WifiApIface : public IWifiApIface { +class WifiApIface : public V1_0::IWifiApIface { public: WifiApIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -63,7 +64,7 @@ class WifiApIface : public IWifiApIface { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.1/default/wifi_chip.cpp similarity index 96% rename from wifi/1.0/default/wifi_chip.cpp rename to wifi/1.1/default/wifi_chip.cpp index 770c83f181..87985c067a 100644 --- a/wifi/1.0/default/wifi_chip.cpp +++ b/wifi/1.1/default/wifi_chip.cpp @@ -46,7 +46,7 @@ void invalidateAndClear(sp& iface) { namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -343,6 +343,23 @@ Return WifiChip::enableDebugErrorAlerts( enable); } +Return WifiChip::setTxPowerLimit( + int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) { + return validateAndCall(this, + WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::setTxPowerLimitInternal, + hidl_status_cb, + powerInDbm); +} + +Return WifiChip::resetTxPowerLimit( + resetTxPowerLimit_cb hidl_status_cb) { + return validateAndCall(this, + WifiStatusCode::ERROR_WIFI_CHIP_INVALID, + &WifiChip::resetTxPowerLimitInternal, + hidl_status_cb); +} + void WifiChip::invalidateAndRemoveAllIfaces() { invalidateAndClear(ap_iface_); invalidateAndClear(nan_iface_); @@ -801,6 +818,18 @@ WifiStatus WifiChip::enableDebugErrorAlertsInternal(bool enable) { return createWifiStatusFromLegacyError(legacy_status); } +WifiStatus WifiChip::setTxPowerLimitInternal(int32_t /* powerInDbm */) { + // TODO(b/62437848): Implement this method once we are ready with the + // header changes in legacy HAL. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + +WifiStatus WifiChip::resetTxPowerLimitInternal() { + // TODO(b/62437848): Implement this method once we are ready with the + // header changes in legacy HAL. + return createWifiStatus(WifiStatusCode::ERROR_NOT_SUPPORTED); +} + WifiStatus WifiChip::handleChipConfiguration(ChipModeId mode_id) { // If the chip is already configured in a different mode, stop // the legacy HAL and then start it after firmware mode change. @@ -869,7 +898,7 @@ WifiStatus WifiChip::registerDebugRingBufferCallback() { } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.1/default/wifi_chip.h similarity index 95% rename from wifi/1.0/default/wifi_chip.h rename to wifi/1.1/default/wifi_chip.h index 406938c361..b7dde50131 100644 --- a/wifi/1.0/default/wifi_chip.h +++ b/wifi/1.1/default/wifi_chip.h @@ -20,7 +20,7 @@ #include #include -#include +#include #include "hidl_callback_util.h" #include "wifi_ap_iface.h" @@ -34,15 +34,16 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a Wifi HAL chip instance. * Since there is only a single chip instance used today, there is no * identifying handle information stored here. */ -class WifiChip : public IWifiChip { +class WifiChip : public V1_1::IWifiChip { public: WifiChip( ChipId chip_id, @@ -125,6 +126,9 @@ class WifiChip : public IWifiChip { getDebugHostWakeReasonStats_cb hidl_status_cb) override; Return enableDebugErrorAlerts( bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override; + Return setTxPowerLimit( + int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override; + Return resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override; private: void invalidateAndRemoveAllIfaces(); @@ -176,6 +180,8 @@ class WifiChip : public IWifiChip { std::pair getDebugHostWakeReasonStatsInternal(); WifiStatus enableDebugErrorAlertsInternal(bool enable); + WifiStatus setTxPowerLimitInternal(int32_t powerInDbm); + WifiStatus resetTxPowerLimitInternal(); WifiStatus handleChipConfiguration(ChipModeId mode_id); WifiStatus registerDebugRingBufferCallback(); @@ -201,7 +207,7 @@ class WifiChip : public IWifiChip { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_feature_flags.h b/wifi/1.1/default/wifi_feature_flags.h similarity index 96% rename from wifi/1.0/default/wifi_feature_flags.h rename to wifi/1.1/default/wifi_feature_flags.h index 3502fbdeb2..5939ffbefb 100644 --- a/wifi/1.0/default/wifi_feature_flags.h +++ b/wifi/1.1/default/wifi_feature_flags.h @@ -20,7 +20,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { class WifiFeatureFlags { @@ -33,7 +33,7 @@ class WifiFeatureFlags { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.1/default/wifi_legacy_hal.cpp similarity index 99% rename from wifi/1.0/default/wifi_legacy_hal.cpp rename to wifi/1.1/default/wifi_legacy_hal.cpp index 3f2610456c..c1e1cd3a4c 100644 --- a/wifi/1.0/default/wifi_legacy_hal.cpp +++ b/wifi/1.1/default/wifi_legacy_hal.cpp @@ -47,7 +47,7 @@ std::vector makeCharVec(const std::string& str) { namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace legacy_hal { // Legacy HAL functions accept "C" style function pointers, so use global @@ -1316,7 +1316,7 @@ void WifiLegacyHal::invalidate() { } // namespace legacy_hal } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.1/default/wifi_legacy_hal.h similarity index 99% rename from wifi/1.0/default/wifi_legacy_hal.h rename to wifi/1.1/default/wifi_legacy_hal.h index 962d15314a..fef7999c0b 100644 --- a/wifi/1.0/default/wifi_legacy_hal.h +++ b/wifi/1.1/default/wifi_legacy_hal.h @@ -26,7 +26,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { // This is in a separate namespace to prevent typename conflicts between // the legacy HAL types and the HIDL interface types. @@ -298,7 +298,7 @@ class WifiLegacyHal { } // namespace legacy_hal } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_legacy_hal_stubs.cpp b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp similarity index 99% rename from wifi/1.0/default/wifi_legacy_hal_stubs.cpp rename to wifi/1.1/default/wifi_legacy_hal_stubs.cpp index 2973430dbd..a5a5d48595 100644 --- a/wifi/1.0/default/wifi_legacy_hal_stubs.cpp +++ b/wifi/1.1/default/wifi_legacy_hal_stubs.cpp @@ -20,7 +20,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace legacy_hal { template @@ -136,7 +136,7 @@ bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn) { } } // namespace legacy_hal } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_legacy_hal_stubs.h b/wifi/1.1/default/wifi_legacy_hal_stubs.h similarity index 96% rename from wifi/1.0/default/wifi_legacy_hal_stubs.h rename to wifi/1.1/default/wifi_legacy_hal_stubs.h index 1cb5f9d521..bfc4c9b864 100644 --- a/wifi/1.0/default/wifi_legacy_hal_stubs.h +++ b/wifi/1.1/default/wifi_legacy_hal_stubs.h @@ -20,7 +20,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace legacy_hal { #include @@ -28,7 +28,7 @@ namespace legacy_hal { bool initHalFuncTableWithStubs(wifi_hal_fn* hal_fn); } // namespace legacy_hal } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_mode_controller.cpp b/wifi/1.1/default/wifi_mode_controller.cpp similarity index 98% rename from wifi/1.0/default/wifi_mode_controller.cpp rename to wifi/1.1/default/wifi_mode_controller.cpp index 7e82d4caf9..b8a44c2531 100644 --- a/wifi/1.0/default/wifi_mode_controller.cpp +++ b/wifi/1.1/default/wifi_mode_controller.cpp @@ -48,7 +48,7 @@ int convertIfaceTypeToFirmwareMode(IfaceType type) { namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace mode_controller { @@ -80,7 +80,7 @@ bool WifiModeController::deinitialize() { } } // namespace mode_controller } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_mode_controller.h b/wifi/1.1/default/wifi_mode_controller.h similarity index 95% rename from wifi/1.0/default/wifi_mode_controller.h rename to wifi/1.1/default/wifi_mode_controller.h index a4147a905d..69845095bc 100644 --- a/wifi/1.0/default/wifi_mode_controller.h +++ b/wifi/1.1/default/wifi_mode_controller.h @@ -24,9 +24,11 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { namespace mode_controller { +using namespace android::hardware::wifi::V1_0; + /** * Class that encapsulates all firmware mode configuration. * This class will perform the necessary firmware reloads to put the chip in the @@ -51,7 +53,7 @@ class WifiModeController { } // namespace mode_controller } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.1/default/wifi_nan_iface.cpp similarity index 99% rename from wifi/1.0/default/wifi_nan_iface.cpp rename to wifi/1.1/default/wifi_nan_iface.cpp index ee324ced15..a111d0610a 100644 --- a/wifi/1.0/default/wifi_nan_iface.cpp +++ b/wifi/1.1/default/wifi_nan_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -763,7 +763,7 @@ WifiStatus WifiNanIface::terminateDataPathRequestInternal( } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.1/default/wifi_nan_iface.h similarity index 97% rename from wifi/1.0/default/wifi_nan_iface.h rename to wifi/1.1/default/wifi_nan_iface.h index e1edd29243..260d8ab4ef 100644 --- a/wifi/1.0/default/wifi_nan_iface.h +++ b/wifi/1.1/default/wifi_nan_iface.h @@ -27,13 +27,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a NAN Iface instance. */ -class WifiNanIface : public IWifiNanIface { +class WifiNanIface : public V1_0::IWifiNanIface { public: WifiNanIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -132,7 +133,7 @@ class WifiNanIface : public IWifiNanIface { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.1/default/wifi_p2p_iface.cpp similarity index 98% rename from wifi/1.0/default/wifi_p2p_iface.cpp rename to wifi/1.1/default/wifi_p2p_iface.cpp index 0d055f1319..78e08db970 100644 --- a/wifi/1.0/default/wifi_p2p_iface.cpp +++ b/wifi/1.1/default/wifi_p2p_iface.cpp @@ -23,7 +23,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -64,7 +64,7 @@ std::pair WifiP2pIface::getTypeInternal() { } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.1/default/wifi_p2p_iface.h similarity index 92% rename from wifi/1.0/default/wifi_p2p_iface.h rename to wifi/1.1/default/wifi_p2p_iface.h index d2982db8c5..f563a3d314 100644 --- a/wifi/1.0/default/wifi_p2p_iface.h +++ b/wifi/1.1/default/wifi_p2p_iface.h @@ -25,13 +25,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a P2P Iface instance. */ -class WifiP2pIface : public IWifiP2pIface { +class WifiP2pIface : public V1_0::IWifiP2pIface { public: WifiP2pIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -56,7 +57,7 @@ class WifiP2pIface : public IWifiP2pIface { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.1/default/wifi_rtt_controller.cpp similarity index 99% rename from wifi/1.0/default/wifi_rtt_controller.cpp rename to wifi/1.1/default/wifi_rtt_controller.cpp index f18feaea3e..9ef702da14 100644 --- a/wifi/1.0/default/wifi_rtt_controller.cpp +++ b/wifi/1.1/default/wifi_rtt_controller.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -291,7 +291,7 @@ WifiStatus WifiRttController::disableResponderInternal(uint32_t cmd_id) { return createWifiStatusFromLegacyError(legacy_status); } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.1/default/wifi_rtt_controller.h similarity index 97% rename from wifi/1.0/default/wifi_rtt_controller.h rename to wifi/1.1/default/wifi_rtt_controller.h index 7c0abcaf87..543788574a 100644 --- a/wifi/1.0/default/wifi_rtt_controller.h +++ b/wifi/1.1/default/wifi_rtt_controller.h @@ -27,13 +27,13 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { /** * HIDL interface object used to control all RTT operations. */ -class WifiRttController : public IWifiRttController { +class WifiRttController : public V1_0::IWifiRttController { public: WifiRttController(const sp& bound_iface, const std::weak_ptr legacy_hal); @@ -97,7 +97,7 @@ class WifiRttController : public IWifiRttController { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.1/default/wifi_sta_iface.cpp similarity index 99% rename from wifi/1.0/default/wifi_sta_iface.cpp rename to wifi/1.1/default/wifi_sta_iface.cpp index 3c5204808c..28f3f02a2a 100644 --- a/wifi/1.0/default/wifi_sta_iface.cpp +++ b/wifi/1.1/default/wifi_sta_iface.cpp @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { using hidl_return_util::validateAndCall; @@ -623,7 +623,7 @@ WifiStaIface::getDebugRxPacketFatesInternal() { } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.1/default/wifi_sta_iface.h similarity index 98% rename from wifi/1.0/default/wifi_sta_iface.h rename to wifi/1.1/default/wifi_sta_iface.h index 08faa2f1bb..587a5de7ba 100644 --- a/wifi/1.0/default/wifi_sta_iface.h +++ b/wifi/1.1/default/wifi_sta_iface.h @@ -27,13 +27,14 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; /** * HIDL interface object used to control a STA Iface instance. */ -class WifiStaIface : public IWifiStaIface { +class WifiStaIface : public V1_0::IWifiStaIface { public: WifiStaIface(const std::string& ifname, const std::weak_ptr legacy_hal); @@ -159,7 +160,7 @@ class WifiStaIface : public IWifiStaIface { }; } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_status_util.cpp b/wifi/1.1/default/wifi_status_util.cpp similarity index 98% rename from wifi/1.0/default/wifi_status_util.cpp rename to wifi/1.1/default/wifi_status_util.cpp index c2d0758cbb..3a85e09989 100644 --- a/wifi/1.0/default/wifi_status_util.cpp +++ b/wifi/1.1/default/wifi_status_util.cpp @@ -19,7 +19,7 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { std::string legacyErrorToString(legacy_hal::wifi_error error) { @@ -100,7 +100,7 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error) { } } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.0/default/wifi_status_util.h b/wifi/1.1/default/wifi_status_util.h similarity index 94% rename from wifi/1.0/default/wifi_status_util.h rename to wifi/1.1/default/wifi_status_util.h index 7f557e0127..cc93d66ca0 100644 --- a/wifi/1.0/default/wifi_status_util.h +++ b/wifi/1.1/default/wifi_status_util.h @@ -24,8 +24,9 @@ namespace android { namespace hardware { namespace wifi { -namespace V1_0 { +namespace V1_1 { namespace implementation { +using namespace android::hardware::wifi::V1_0; std::string legacyErrorToString(legacy_hal::wifi_error error); WifiStatus createWifiStatus(WifiStatusCode code, @@ -36,7 +37,7 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error, WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error); } // namespace implementation -} // namespace V1_0 +} // namespace V1_1 } // namespace wifi } // namespace hardware } // namespace android diff --git a/wifi/1.1/vts/functional/Android.bp b/wifi/1.1/vts/functional/Android.bp new file mode 100644 index 0000000000..6b0baf7851 --- /dev/null +++ b/wifi/1.1/vts/functional/Android.bp @@ -0,0 +1,39 @@ +// +// Copyright (C) 2016 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. +// + +cc_test { + name: "VtsHalWifiV1_1TargetTest", + defaults: ["hidl_defaults"], + srcs: [ + "VtsHalWifiV1_1TargetTest.cpp", + "wifi_chip_hidl_test.cpp"], + shared_libs: [ + "libbase", + "liblog", + "libcutils", + "libhidlbase", + "libhidltransport", + "libnativehelper", + "libutils", + "android.hardware.wifi@1.0", + "android.hardware.wifi@1.1", + ], + static_libs: ["VtsHalWifiV1_0TargetTestUtil", "VtsHalHidlTargetTestBase"], + cflags: [ + "-O0", + "-g", + ], +} diff --git a/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp new file mode 100644 index 0000000000..160fcd2346 --- /dev/null +++ b/wifi/1.1/vts/functional/VtsHalWifiV1_1TargetTest.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2016 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 + +#include + +#include "wifi_hidl_test_utils.h" + +int main(int argc, char** argv) { + ::testing::AddGlobalTestEnvironment(new WifiHidlEnvironment); + ::testing::InitGoogleTest(&argc, argv); + int status = RUN_ALL_TESTS(); + LOG(INFO) << "Test result = " << status; + return status; +} diff --git a/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp new file mode 100644 index 0000000000..839b6c4346 --- /dev/null +++ b/wifi/1.1/vts/functional/wifi_chip_hidl_test.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2016 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 + +#include +#include + +#include + +#include "wifi_hidl_call_util.h" +#include "wifi_hidl_test_utils.h" + +using ::android::sp; +using ::android::hardware::hidl_string; +using ::android::hardware::hidl_vec; +using ::android::hardware::wifi::V1_0::IfaceType; +using ::android::hardware::wifi::V1_0::ChipId; +using ::android::hardware::wifi::V1_0::ChipModeId; +using ::android::hardware::wifi::V1_0::WifiStatus; +using ::android::hardware::wifi::V1_0::WifiStatusCode; +using ::android::hardware::wifi::V1_1::IWifi; +using ::android::hardware::wifi::V1_1::IWifiChip; +using ::android::hardware::wifi::V1_0::IWifiStaIface; + +namespace { +constexpr int32_t kFakePowerInDbm = -56; +}; //namespace + +/** + * Fixture to use for all Wifi chip HIDL interface tests. + */ +class WifiChipHidlTest : public ::testing::VtsHalHidlTargetTestBase { + public: + virtual void SetUp() override { + wifi_chip_ = IWifiChip::castFrom(getWifiChip()); + ASSERT_NE(nullptr, wifi_chip_.get()); + } + + virtual void TearDown() override { stopWifi(); } + + protected: + uint32_t configureChipForStaIfaceAndGetCapabilities() { + ChipModeId mode_id; + EXPECT_TRUE(configureChipToSupportIfaceType( + wifi_chip_, IfaceType::STA, &mode_id)); + const auto& status_and_caps = HIDL_INVOKE(wifi_chip_, getCapabilities); + EXPECT_EQ(WifiStatusCode::SUCCESS, status_and_caps.first.code); + return status_and_caps.second; + } + + sp wifi_chip_; +}; + +/* + * SetTxPowerLimit + */ +TEST_F(WifiChipHidlTest, SetTxPowerLimit) { + uint32_t caps = configureChipForStaIfaceAndGetCapabilities(); + const auto& status = + HIDL_INVOKE(wifi_chip_, setTxPowerLimit, kFakePowerInDbm); + if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) { + EXPECT_EQ(WifiStatusCode::SUCCESS, status.code); + } else { + EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status.code); + } +} + +/* + * SetTxPowerLimit + */ +TEST_F(WifiChipHidlTest, ResetTxPowerLimit) { + uint32_t caps = configureChipForStaIfaceAndGetCapabilities(); + const auto& status = + HIDL_INVOKE(wifi_chip_, resetTxPowerLimit); + if (caps & IWifiChip::ChipCapabilityMask::SET_TX_POWER_LIMIT) { + EXPECT_EQ(WifiStatusCode::SUCCESS, status.code); + } else { + EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, status.code); + } +} diff --git a/wifi/Android.bp b/wifi/Android.bp index 230e720f0c..b4ab98ffef 100644 --- a/wifi/Android.bp +++ b/wifi/Android.bp @@ -3,6 +3,7 @@ subdirs = [ "1.0", "1.0/vts/functional", "1.1", + "1.1/vts/functional", "offload/1.0", "offload/1.0/vts/functional", "supplicant/1.0",