Merge "Implement ProgramSelector at HIDL layer."
diff --git a/bluetooth/1.0/default/bluetooth_address.cc b/bluetooth/1.0/default/bluetooth_address.cc
index 656d78d..65dc6a6 100644
--- a/bluetooth/1.0/default/bluetooth_address.cc
+++ b/bluetooth/1.0/default/bluetooth_address.cc
@@ -16,8 +16,8 @@
#include "bluetooth_address.h"
-#include <android-base/logging.h>
#include <cutils/properties.h>
+#include <errno.h>
#include <fcntl.h>
#include <utils/Log.h>
@@ -54,19 +54,25 @@
addr_fd = open(property, O_RDONLY);
if (addr_fd != -1) {
- int bytes_read = read(addr_fd, property, kStringLength);
- CHECK(bytes_read == kStringLength);
+ char address[kStringLength + 1] = {0};
+ int bytes_read = read(addr_fd, address, kStringLength);
+ if (bytes_read == -1) {
+ ALOGE("%s: Error reading address from %s: %s", __func__, property,
+ strerror(errno));
+ }
close(addr_fd);
// Null terminate the string.
- property[kStringLength] = '\0';
+ address[kStringLength] = '\0';
// If the address is not all zeros, then use it.
const uint8_t zero_bdaddr[kBytes] = {0, 0, 0, 0, 0, 0};
- if ((string_to_bytes(property, local_addr)) &&
+ if ((string_to_bytes(address, local_addr)) &&
(memcmp(local_addr, zero_bdaddr, kBytes) != 0)) {
valid_bda = true;
- ALOGD("%s: Got Factory BDA %s", __func__, property);
+ ALOGD("%s: Got Factory BDA %s", __func__, address);
+ } else {
+ ALOGE("%s: Got Invalid BDA '%s' from %s", __func__, address, property);
}
}
}
diff --git a/bluetooth/1.0/default/h4_protocol.cc b/bluetooth/1.0/default/h4_protocol.cc
index 8f24b5e..2008b00 100644
--- a/bluetooth/1.0/default/h4_protocol.cc
+++ b/bluetooth/1.0/default/h4_protocol.cc
@@ -17,9 +17,11 @@
#include "h4_protocol.h"
#define LOG_TAG "android.hardware.bluetooth-hci-h4"
-#include <android-base/logging.h>
-#include <assert.h>
+
+#include <errno.h>
#include <fcntl.h>
+#include <log/log.h>
+#include <sys/uio.h>
namespace android {
namespace hardware {
@@ -27,11 +29,20 @@
namespace hci {
size_t H4Protocol::Send(uint8_t type, const uint8_t* data, size_t length) {
- int rv = WriteSafely(uart_fd_, &type, sizeof(type));
- if (rv == sizeof(type)) {
- rv = WriteSafely(uart_fd_, data, length);
+ struct iovec iov[] = {{&type, sizeof(type)},
+ {const_cast<uint8_t*>(data), length}};
+ ssize_t ret = 0;
+ do {
+ ret = TEMP_FAILURE_RETRY(writev(uart_fd_, iov, sizeof(iov) / sizeof(iov[0])));
+ } while (-1 == ret && EAGAIN == errno);
+
+ if (ret == -1) {
+ ALOGE("%s error writing to UART (%s)", __func__, strerror(errno));
+ } else if (ret < static_cast<ssize_t>(length + 1)) {
+ ALOGE("%s: %d / %d bytes written - something went wrong...", __func__,
+ static_cast<int>(ret), static_cast<int>(length + 1));
}
- return rv;
+ return ret;
}
void H4Protocol::OnPacketReady() {
@@ -45,10 +56,9 @@
case HCI_PACKET_TYPE_SCO_DATA:
sco_cb_(hci_packetizer_.GetPacket());
break;
- default: {
- bool bad_packet_type = true;
- CHECK(!bad_packet_type);
- }
+ default:
+ LOG_ALWAYS_FATAL("%s: Unimplemented packet type %d", __func__,
+ static_cast<int>(hci_packet_type_));
}
// Get ready for the next type byte.
hci_packet_type_ = HCI_PACKET_TYPE_UNKNOWN;
@@ -57,8 +67,19 @@
void H4Protocol::OnDataReady(int fd) {
if (hci_packet_type_ == HCI_PACKET_TYPE_UNKNOWN) {
uint8_t buffer[1] = {0};
- size_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, 1));
- CHECK(bytes_read == 1);
+ ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, 1));
+ if (bytes_read != 1) {
+ if (bytes_read == 0) {
+ LOG_ALWAYS_FATAL("%s: Unexpected EOF reading the packet type!",
+ __func__);
+ } else if (bytes_read < 0) {
+ LOG_ALWAYS_FATAL("%s: Read packet type error: %s", __func__,
+ strerror(errno));
+ } else {
+ LOG_ALWAYS_FATAL("%s: More bytes read than expected (%u)!", __func__,
+ static_cast<unsigned int>(bytes_read));
+ }
+ }
hci_packet_type_ = static_cast<HciPacketType>(buffer[0]);
} else {
hci_packetizer_.OnDataReady(fd, hci_packet_type_);
diff --git a/bluetooth/1.0/default/hci_packetizer.cc b/bluetooth/1.0/default/hci_packetizer.cc
index 9549858..2da1254 100644
--- a/bluetooth/1.0/default/hci_packetizer.cc
+++ b/bluetooth/1.0/default/hci_packetizer.cc
@@ -17,11 +17,11 @@
#include "hci_packetizer.h"
#define LOG_TAG "android.hardware.bluetooth.hci_packetizer"
-#include <android-base/logging.h>
-#include <utils/Log.h>
#include <dlfcn.h>
+#include <errno.h>
#include <fcntl.h>
+#include <utils/Log.h>
namespace {
@@ -45,15 +45,22 @@
namespace bluetooth {
namespace hci {
-const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const { return packet_; }
+const hidl_vec<uint8_t>& HciPacketizer::GetPacket() const {
+ return packet_;
+}
void HciPacketizer::OnDataReady(int fd, HciPacketType packet_type) {
switch (state_) {
case HCI_PREAMBLE: {
- size_t bytes_read = TEMP_FAILURE_RETRY(
+ ssize_t bytes_read = TEMP_FAILURE_RETRY(
read(fd, preamble_ + bytes_read_,
preamble_size_for_type[packet_type] - bytes_read_));
- CHECK(bytes_read > 0);
+ if (bytes_read <= 0) {
+ LOG_ALWAYS_FATAL_IF((bytes_read == 0),
+ "%s: Unexpected EOF reading the header!", __func__);
+ LOG_ALWAYS_FATAL("%s: Read header error: %s", __func__,
+ strerror(errno));
+ }
bytes_read_ += bytes_read;
if (bytes_read_ == preamble_size_for_type[packet_type]) {
size_t packet_length =
@@ -68,11 +75,17 @@
}
case HCI_PAYLOAD: {
- size_t bytes_read = TEMP_FAILURE_RETRY(read(
+ ssize_t bytes_read = TEMP_FAILURE_RETRY(read(
fd,
packet_.data() + preamble_size_for_type[packet_type] + bytes_read_,
bytes_remaining_));
- CHECK(bytes_read > 0);
+ if (bytes_read <= 0) {
+ LOG_ALWAYS_FATAL_IF((bytes_read == 0),
+ "%s: Unexpected EOF reading the payload!",
+ __func__);
+ LOG_ALWAYS_FATAL("%s: Read payload error: %s", __func__,
+ strerror(errno));
+ }
bytes_remaining_ -= bytes_read;
bytes_read_ += bytes_read;
if (bytes_remaining_ == 0) {
diff --git a/bluetooth/1.0/default/mct_protocol.cc b/bluetooth/1.0/default/mct_protocol.cc
index 813cebd..2a59187 100644
--- a/bluetooth/1.0/default/mct_protocol.cc
+++ b/bluetooth/1.0/default/mct_protocol.cc
@@ -19,7 +19,6 @@
#include <assert.h>
#define LOG_TAG "android.hardware.bluetooth-hci-mct"
-#include <android-base/logging.h>
#include <utils/Log.h>
#include <fcntl.h>
@@ -45,7 +44,7 @@
return WriteSafely(uart_fds_[CH_CMD], data, length);
if (type == HCI_PACKET_TYPE_ACL_DATA)
return WriteSafely(uart_fds_[CH_ACL_OUT], data, length);
- CHECK(type == HCI_PACKET_TYPE_COMMAND || type == HCI_PACKET_TYPE_ACL_DATA);
+ LOG_ALWAYS_FATAL("%s: Unimplemented packet type = %d", __func__, type);
return 0;
}
diff --git a/bluetooth/1.0/default/test/bluetooth_address_test.cc b/bluetooth/1.0/default/test/bluetooth_address_test.cc
index adcd9c1..e60729e 100644
--- a/bluetooth/1.0/default/test/bluetooth_address_test.cc
+++ b/bluetooth/1.0/default/test/bluetooth_address_test.cc
@@ -15,6 +15,7 @@
//
#include <cutils/properties.h>
+#include <errno.h>
#include <fcntl.h>
#include <gtest/gtest.h>
diff --git a/bluetooth/1.0/default/vendor_interface.cc b/bluetooth/1.0/default/vendor_interface.cc
index a291e14..ffc283e 100644
--- a/bluetooth/1.0/default/vendor_interface.cc
+++ b/bluetooth/1.0/default/vendor_interface.cc
@@ -17,7 +17,6 @@
#include "vendor_interface.h"
#define LOG_TAG "android.hardware.bluetooth@1.0-impl"
-#include <android-base/logging.h>
#include <cutils/properties.h>
#include <utils/Log.h>
@@ -163,14 +162,16 @@
InitializeCompleteCallback initialize_complete_cb,
PacketReadCallback event_cb, PacketReadCallback acl_cb,
PacketReadCallback sco_cb) {
- CHECK(!g_vendor_interface);
+ LOG_ALWAYS_FATAL_IF(g_vendor_interface, "%s: No previous Shutdown()?",
+ __func__);
g_vendor_interface = new VendorInterface();
return g_vendor_interface->Open(initialize_complete_cb, event_cb, acl_cb,
sco_cb);
}
void VendorInterface::Shutdown() {
- CHECK(g_vendor_interface);
+ LOG_ALWAYS_FATAL_IF(!g_vendor_interface, "%s: No Vendor interface!",
+ __func__);
g_vendor_interface->Close();
delete g_vendor_interface;
g_vendor_interface = nullptr;
@@ -204,7 +205,9 @@
// Get the local BD address
uint8_t local_bda[BluetoothAddress::kBytes];
- CHECK(BluetoothAddress::get_local_address(local_bda));
+ if (!BluetoothAddress::get_local_address(local_bda)) {
+ LOG_ALWAYS_FATAL("%s: No Bluetooth Address!", __func__);
+ }
int status = lib_interface_->init(&lib_callbacks, (unsigned char*)local_bda);
if (status) {
ALOGE("%s unable to initialize vendor library: %d", __func__, status);
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index d2e6553..cd2be44 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -28,7 +28,10 @@
"libutils",
"android.hardware.bluetooth@1.0",
],
- static_libs: ["VtsHalHidlTargetTestBase"],
+ static_libs: [
+ "VtsHalHidlTargetTestBase",
+ "libbluetooth-types",
+ ],
cflags: [
"-O0",
"-g",
diff --git a/configstore/1.1/vts/functional/Android.bp b/configstore/1.1/vts/functional/Android.bp
new file mode 100644
index 0000000..5cfa483
--- /dev/null
+++ b/configstore/1.1/vts/functional/Android.bp
@@ -0,0 +1,34 @@
+//
+// Copyright (C) 2017 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: "VtsHalConfigstoreV1_1TargetTest",
+ defaults: ["hidl_defaults"],
+ srcs: ["VtsHalConfigstoreV1_1TargetTest.cpp"],
+ shared_libs: [
+ "libbase",
+ "libhidlbase",
+ "liblog",
+ "libutils",
+ "android.hardware.configstore@1.1",
+ ],
+ static_libs: ["VtsHalHidlTargetTestBase"],
+ cflags: [
+ "-O0",
+ "-g",
+ ]
+}
+
diff --git a/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp b/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp
new file mode 100644
index 0000000..bd3da4c
--- /dev/null
+++ b/configstore/1.1/vts/functional/VtsHalConfigstoreV1_1TargetTest.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#define LOG_TAG "ConfigstoreHidlHalTest"
+
+#include <VtsHalHidlTargetTestBase.h>
+#include <android-base/logging.h>
+#include <android/hardware/configstore/1.0/types.h>
+#include <android/hardware/configstore/1.1/ISurfaceFlingerConfigs.h>
+#include <unistd.h>
+
+using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs;
+using ::android::sp;
+
+#define ASSERT_OK(ret) ASSERT_TRUE(ret.isOk())
+#define EXPECT_OK(ret) EXPECT_TRUE(ret.isOk())
+
+class ConfigstoreHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+ public:
+ sp<ISurfaceFlingerConfigs> sfConfigs;
+
+ virtual void SetUp() override {
+ sfConfigs = ::testing::VtsHalHidlTargetTestBase::getService<ISurfaceFlingerConfigs>();
+ ASSERT_NE(sfConfigs, nullptr);
+ }
+
+ virtual void TearDown() override {}
+};
+
+/**
+ * Placeholder testcase.
+ */
+TEST_F(ConfigstoreHidlTest, Test) {
+ ASSERT_TRUE(true);
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
+}
diff --git a/configstore/Android.bp b/configstore/Android.bp
index 21dc2b4..4a783c3 100644
--- a/configstore/Android.bp
+++ b/configstore/Android.bp
@@ -3,5 +3,6 @@
"1.0",
"1.0/vts/functional",
"1.1",
+ "1.1/vts/functional",
"utils",
]
diff --git a/current.txt b/current.txt
index 1904db8..a5b5930 100644
--- a/current.txt
+++ b/current.txt
@@ -219,3 +219,5 @@
bb7c96762d0aa3ddb874c8815bacdd3cbc8fb87ea2f82b928bc29e24a3593055 android.hardware.wifi.offload@1.0::IOffload
c3354ab0d381a236c12dc486ad4b6bec28c979d26748b4661f12ede36f392808 android.hardware.wifi.offload@1.0::IOffloadCallback
b18caefefcc765092412285d776234fcf213b73bdf07ae1b67a5f71b2d2464e3 android.hardware.wifi.offload@1.0::types
+c26473e2e4a00af43e28a0ddf9002e5062a7d0940429e5efb6e5513a8abcb75c android.hardware.wifi@1.1::IWifi
+48adfb7259e3816a82a4c394ffaf56fb14628a542295b7a51f1311392d3f8769 android.hardware.wifi@1.1::IWifiChip
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index 4842946..3006508 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -543,7 +543,7 @@
};
const Vec3NormChecker SensorsHidlTest::sAccelNormChecker(
- Vec3NormChecker::byNominal(GRAVITY_EARTH, 0.5f/*m/s^2*/));
+ Vec3NormChecker::byNominal(GRAVITY_EARTH, 1.0f/*m/s^2*/));
const Vec3NormChecker SensorsHidlTest::sGyroNormChecker(
Vec3NormChecker::byNominal(0.f, 0.1f/*rad/s*/));
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index b454a06..2d6679f 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.1/Android.bp b/wifi/1.1/Android.bp
new file mode 100644
index 0000000..f991fa5
--- /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 0000000..fbc79ca
--- /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 0000000..bd48f57
--- /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 0000000..7275412
--- /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/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 fe33e08..5758422 100644
--- a/wifi/1.0/default/Android.mk
+++ b/wifi/1.1/default/Android.mk
@@ -38,6 +38,7 @@
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 b7100c8..fb13622 100644
--- a/wifi/1.0/default/hidl_callback_util.h
+++ b/wifi/1.1/default/hidl_callback_util.h
@@ -51,7 +51,7 @@
namespace android {
namespace hardware {
namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
namespace hidl_callback_util {
template <typename CallbackType>
@@ -114,7 +114,7 @@
} // 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 3f6364b..2f95c23 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 @@
} // 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 fa0279b..e40a7d8 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 @@
}
} // 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 c04d92f..a04f636 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 @@
std::vector<RttResult>* 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 7d47f2f..ba18e34 100644
--- a/wifi/1.0/default/hidl_sync_util.cpp
+++ b/wifi/1.1/default/hidl_sync_util.cpp
@@ -23,7 +23,7 @@
namespace android {
namespace hardware {
namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
namespace hidl_sync_util {
@@ -33,7 +33,7 @@
} // 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 6631e55..0e882df 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<std::recursive_mutex> 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 059304e..b3fcd50 100644
--- a/wifi/1.0/default/service.cpp
+++ b/wifi/1.1/default/service.cpp
@@ -32,8 +32,8 @@
configureRpcThreadpool(1, true /* callerWillJoin */);
// Setup hwbinder service
- android::sp<android::hardware::wifi::V1_0::IWifi> service =
- new android::hardware::wifi::V1_0::implementation::Wifi();
+ android::sp<android::hardware::wifi::V1_1::IWifi> 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 b48844e..4ed1f55 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.1/default/wifi.cpp
@@ -28,7 +28,7 @@
namespace android {
namespace hardware {
namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using hidl_return_util::validateAndCall;
@@ -195,7 +195,7 @@
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 93%
rename from wifi/1.0/default/wifi.h
rename to wifi/1.1/default/wifi.h
index c6fa84c..1ade2d8 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.1/default/wifi.h
@@ -20,7 +20,7 @@
#include <functional>
#include <android-base/macros.h>
-#include <android/hardware/wifi/1.0/IWifi.h>
+#include <android/hardware/wifi/1.1/IWifi.h>
#include <utils/Looper.h>
#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 @@
};
} // 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 e2beec2..150a6cc 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 @@
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 efc168a..608fe6b 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::WifiLegacyHal> legacy_hal);
@@ -63,7 +64,7 @@
};
} // 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 770c83f..87985c0 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.1/default/wifi_chip.cpp
@@ -46,7 +46,7 @@
namespace android {
namespace hardware {
namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
using hidl_return_util::validateAndCall;
@@ -343,6 +343,23 @@
enable);
}
+Return<void> 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<void> 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 @@
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 @@
}
} // 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 406938c..b7dde50 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.1/default/wifi_chip.h
@@ -20,7 +20,7 @@
#include <map>
#include <android-base/macros.h>
-#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
#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 @@
getDebugHostWakeReasonStats_cb hidl_status_cb) override;
Return<void> enableDebugErrorAlerts(
bool enable, enableDebugErrorAlerts_cb hidl_status_cb) override;
+ Return<void> setTxPowerLimit(
+ int32_t powerInDbm, setTxPowerLimit_cb hidl_status_cb) override;
+ Return<void> resetTxPowerLimit(resetTxPowerLimit_cb hidl_status_cb) override;
private:
void invalidateAndRemoveAllIfaces();
@@ -176,6 +180,8 @@
std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
getDebugHostWakeReasonStatsInternal();
WifiStatus enableDebugErrorAlertsInternal(bool enable);
+ WifiStatus setTxPowerLimitInternal(int32_t powerInDbm);
+ WifiStatus resetTxPowerLimitInternal();
WifiStatus handleChipConfiguration(ChipModeId mode_id);
WifiStatus registerDebugRingBufferCallback();
@@ -201,7 +207,7 @@
};
} // 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 3502fbd..5939ffb 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 @@
};
} // 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 98%
rename from wifi/1.0/default/wifi_legacy_hal.cpp
rename to wifi/1.1/default/wifi_legacy_hal.cpp
index b6a7550..c1e1cd3 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.1/default/wifi_legacy_hal.cpp
@@ -47,7 +47,7 @@
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
@@ -1197,11 +1197,19 @@
id, wlan_interface_handle_, &msg_internal);
}
+typedef struct {
+ u8 num_ndp_instances;
+ NanDataPathId ndp_instance_id;
+} NanDataPathEndSingleNdpIdRequest;
+
wifi_error WifiLegacyHal::nanDataEnd(transaction_id id,
- const NanDataPathEndRequest& msg) {
- NanDataPathEndRequest msg_internal(msg);
- return global_func_table_.wifi_nan_data_end(
- id, wlan_interface_handle_, &msg_internal);
+ uint32_t ndpInstanceId) {
+ NanDataPathEndSingleNdpIdRequest msg;
+ msg.num_ndp_instances = 1;
+ msg.ndp_instance_id = ndpInstanceId;
+ wifi_error status = global_func_table_.wifi_nan_data_end(
+ id, wlan_interface_handle_, (NanDataPathEndRequest*)&msg);
+ return status;
}
wifi_error WifiLegacyHal::setCountryCode(std::array<int8_t, 2> code) {
@@ -1308,7 +1316,7 @@
} // 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 98%
rename from wifi/1.0/default/wifi_legacy_hal.h
rename to wifi/1.1/default/wifi_legacy_hal.h
index 1656f68..fef7999 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.
@@ -268,7 +268,7 @@
const NanDataPathInitiatorRequest& msg);
wifi_error nanDataIndicationResponse(
transaction_id id, const NanDataPathIndicationResponse& msg);
- wifi_error nanDataEnd(transaction_id id, const NanDataPathEndRequest& msg);
+ wifi_error nanDataEnd(transaction_id id, uint32_t ndpInstanceId);
// AP functions.
wifi_error setCountryCode(std::array<int8_t, 2> code);
@@ -298,7 +298,7 @@
} // 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 2973430..a5a5d48 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 <typename>
@@ -136,7 +136,7 @@
}
} // 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 1cb5f9d..bfc4c9b 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 <hardware_legacy/wifi_hal.h>
@@ -28,7 +28,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_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 7e82d4c..b8a44c2 100644
--- a/wifi/1.0/default/wifi_mode_controller.cpp
+++ b/wifi/1.1/default/wifi_mode_controller.cpp
@@ -48,7 +48,7 @@
namespace android {
namespace hardware {
namespace wifi {
-namespace V1_0 {
+namespace V1_1 {
namespace implementation {
namespace mode_controller {
@@ -80,7 +80,7 @@
}
} // 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 a4147a9..6984509 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 @@
} // 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 98%
rename from wifi/1.0/default/wifi_nan_iface.cpp
rename to wifi/1.1/default/wifi_nan_iface.cpp
index 88fb5b2..a111d06 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;
@@ -757,19 +757,13 @@
}
WifiStatus WifiNanIface::terminateDataPathRequestInternal(
uint16_t cmd_id, uint32_t ndpInstanceId) {
- legacy_hal::NanDataPathEndRequest* legacy_msg = (legacy_hal::NanDataPathEndRequest*)malloc(
- sizeof(legacy_hal::NanDataPathEndRequest) + sizeof(uint32_t));
- legacy_msg->num_ndp_instances = 1;
- legacy_msg->ndp_instance_id[0] = ndpInstanceId;
-
legacy_hal::wifi_error legacy_status =
- legacy_hal_.lock()->nanDataEnd(cmd_id, *legacy_msg);
- free(legacy_msg);
+ legacy_hal_.lock()->nanDataEnd(cmd_id, ndpInstanceId);
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_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 e1edd29..260d8ab 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::WifiLegacyHal> legacy_hal);
@@ -132,7 +133,7 @@
};
} // 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 97%
rename from wifi/1.0/default/wifi_p2p_iface.cpp
rename to wifi/1.1/default/wifi_p2p_iface.cpp
index 0d055f1..78e08db 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 @@
}
} // 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 d2982db..f563a3d 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::WifiLegacyHal> legacy_hal);
@@ -56,7 +57,7 @@
};
} // 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 f18feae..9ef702d 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 @@
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 7c0abca..5437885 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<IWifiIface>& bound_iface,
const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
@@ -97,7 +97,7 @@
};
} // 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 3c52048..28f3f02 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 @@
}
} // 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 97%
rename from wifi/1.0/default/wifi_sta_iface.h
rename to wifi/1.1/default/wifi_sta_iface.h
index 08faa2f..587a5de 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::WifiLegacyHal> legacy_hal);
@@ -159,7 +160,7 @@
};
} // 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 c2d0758..3a85e09 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 @@
}
} // 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 7f557e0..cc93d66 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);
} // 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 0000000..6b0baf7
--- /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 0000000..160fcd2
--- /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 <android-base/logging.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#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 0000000..839b6c4
--- /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 <android-base/logging.h>
+
+#include <android/hardware/wifi/1.1/IWifi.h>
+#include <android/hardware/wifi/1.1/IWifiChip.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#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<IWifiChip> 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 523014f..b4ab98f 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -2,6 +2,8 @@
subdirs = [
"1.0",
"1.0/vts/functional",
+ "1.1",
+ "1.1/vts/functional",
"offload/1.0",
"offload/1.0/vts/functional",
"supplicant/1.0",