Merge "Cast hidl_pointer<T> to void*."
diff --git a/radio/1.0/IRadio.hal b/radio/1.0/IRadio.hal
index d2ffa82..f29b916 100644
--- a/radio/1.0/IRadio.hal
+++ b/radio/1.0/IRadio.hal
@@ -1556,4 +1556,12 @@
* Response callback is IRadioCallback.getAllowedCarriersResponse()
*/
oneway getAllowedCarriers(int32_t serial);
+
+ /*
+ * When response type received from a radio indication or radio response is
+ * RadioIndicationType:UNSOLICITED_ACK_EXP or RadioResponseType:SOLICITED_ACK_EXP respectively,
+ * acknowledge the receipt of those messages by sending reseponeAcknowledgement().
+ *
+ */
+ oneway responseAcknowledgement();
};
\ No newline at end of file
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index fd2cb9c..3475c46 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -33,7 +33,8 @@
using hidl_return_util::validateAndCall;
Wifi::Wifi()
- : legacy_hal_(new WifiLegacyHal()), run_state_(RunState::STOPPED) {}
+ : legacy_hal_(new legacy_hal::WifiLegacyHal()),
+ run_state_(RunState::STOPPED) {}
bool Wifi::isValid() {
// This object is always valid.
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index c682116..7872303 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -64,7 +64,7 @@
// Instance is created in this root level |IWifi| HIDL interface object
// and shared with all the child HIDL interface objects.
- std::shared_ptr<WifiLegacyHal> legacy_hal_;
+ std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
RunState run_state_;
std::vector<sp<IWifiEventCallback>> event_callbacks_;
sp<WifiChip> chip_;
diff --git a/wifi/1.0/default/wifi_ap_iface.cpp b/wifi/1.0/default/wifi_ap_iface.cpp
index 8c38946..b8b7a3a 100644
--- a/wifi/1.0/default/wifi_ap_iface.cpp
+++ b/wifi/1.0/default/wifi_ap_iface.cpp
@@ -27,8 +27,9 @@
namespace implementation {
using hidl_return_util::validateAndCall;
-WifiApIface::WifiApIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+WifiApIface::WifiApIface(
+ const std::string& ifname,
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiApIface::invalidate() {
diff --git a/wifi/1.0/default/wifi_ap_iface.h b/wifi/1.0/default/wifi_ap_iface.h
index 458bdda..ee5dc56 100644
--- a/wifi/1.0/default/wifi_ap_iface.h
+++ b/wifi/1.0/default/wifi_ap_iface.h
@@ -34,7 +34,7 @@
class WifiApIface : public IWifiApIface {
public:
WifiApIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
@@ -49,7 +49,7 @@
std::pair<WifiStatus, IfaceType> getTypeInternal();
std::string ifname_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
bool is_valid_;
DISALLOW_COPY_AND_ASSIGN(WifiApIface);
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index 2245288..4d1bce5 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -42,7 +42,7 @@
using hidl_return_util::validateAndCall;
WifiChip::WifiChip(ChipId chip_id,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: chip_id_(chip_id), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiChip::invalidate() {
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 0c8adac..c1a7173 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -42,7 +42,8 @@
*/
class WifiChip : public IWifiChip {
public:
- WifiChip(ChipId chip_id, const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ WifiChip(ChipId chip_id,
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// HIDL does not provide a built-in mechanism to let the server invalidate
// a HIDL interface object after creation. If any client process holds onto
// a reference to the object in their context, any method calls on that
@@ -154,7 +155,7 @@
getDebugHostWakeReasonStatsInternal();
ChipId chip_id_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::vector<sp<IWifiChipEventCallback>> event_callbacks_;
sp<WifiApIface> ap_iface_;
sp<WifiNanIface> nan_iface_;
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index cb254c3..28b7f9a 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -16,14 +16,19 @@
#include <array>
-#include "wifi_legacy_hal.h"
-
#include <android-base/logging.h>
#include <cutils/properties.h>
-#include <wifi_system/hal_tool.h>
#include <wifi_system/interface_tool.h>
-namespace {
+#include "wifi_legacy_hal.h"
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+namespace legacy_hal {
+// Constants used in the class.
static constexpr uint32_t kMaxVersionStringLength = 256;
// Legacy HAL functions accept "C" style function pointers, so use global
@@ -52,13 +57,8 @@
on_firmware_memory_dump_internal_callback(buffer, buffer_size);
}
}
-}
+// End of the free-standing "C" style callbacks.
-namespace android {
-namespace hardware {
-namespace wifi {
-namespace V1_0 {
-namespace implementation {
WifiLegacyHal::WifiLegacyHal()
: global_handle_(nullptr),
wlan_interface_handle_(nullptr),
@@ -69,9 +69,11 @@
CHECK(!global_handle_ && !wlan_interface_handle_ &&
!awaiting_event_loop_termination_);
- android::wifi_system::HalTool hal_tool;
android::wifi_system::InterfaceTool if_tool;
- if (!hal_tool.InitFunctionTable(&global_func_table_)) {
+ // TODO: Add back the HAL Tool if we need to. All we need from the HAL tool
+ // for now is this function call which we can directly call.
+ wifi_error status = init_wifi_vendor_hal_func_table(&global_func_table_);
+ if (status != WIFI_SUCCESS) {
LOG(ERROR) << "Failed to initialize legacy hal function table";
return WIFI_ERROR_UNKNOWN;
}
@@ -81,7 +83,7 @@
}
LOG(INFO) << "Starting legacy HAL";
- wifi_error status = global_func_table_.wifi_initialize(&global_handle_);
+ status = global_func_table_.wifi_initialize(&global_handle_);
if (status != WIFI_SUCCESS || !global_handle_) {
LOG(ERROR) << "Failed to retrieve global handle";
return status;
@@ -141,7 +143,7 @@
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_driver_version(
wlan_interface_handle_, buffer.data(), buffer.size());
- return std::make_pair(status, buffer.data());
+ return {status, buffer.data()};
}
std::pair<wifi_error, std::string> WifiLegacyHal::getFirmwareVersion() {
@@ -149,7 +151,7 @@
buffer.fill(0);
wifi_error status = global_func_table_.wifi_get_firmware_version(
wlan_interface_handle_, buffer.data(), buffer.size());
- return std::make_pair(status, buffer.data());
+ return {status, buffer.data()};
}
std::pair<wifi_error, std::vector<uint8_t>>
@@ -164,7 +166,7 @@
wifi_error status = global_func_table_.wifi_get_driver_memory_dump(
wlan_interface_handle_, {onDriverMemoryDump});
on_driver_memory_dump_internal_callback = nullptr;
- return std::make_pair(status, std::move(driver_dump));
+ return {status, std::move(driver_dump)};
}
std::pair<wifi_error, std::vector<uint8_t>>
@@ -179,7 +181,29 @@
wifi_error status = global_func_table_.wifi_get_firmware_memory_dump(
wlan_interface_handle_, {onFirmwareMemoryDump});
on_firmware_memory_dump_internal_callback = nullptr;
- return std::make_pair(status, std::move(firmware_dump));
+ return {status, std::move(firmware_dump)};
+}
+
+std::pair<wifi_error, uint32_t> WifiLegacyHal::getSupportedFeatureSet() {
+ feature_set set;
+ static_assert(sizeof(set) == sizeof(uint32_t),
+ "Some features can not be represented in output");
+ wifi_error status = global_func_table_.wifi_get_supported_feature_set(
+ wlan_interface_handle_, &set);
+ return {status, static_cast<uint32_t>(set)};
+}
+
+std::pair<wifi_error, PacketFilterCapabilities>
+WifiLegacyHal::getPacketFilterCapabilities() {
+ PacketFilterCapabilities caps;
+ wifi_error status = global_func_table_.wifi_get_packet_filter_capabilities(
+ wlan_interface_handle_, &caps.version, &caps.max_len);
+ return {status, caps};
+}
+
+wifi_error WifiLegacyHal::setPacketFilter(const std::vector<uint8_t>& program) {
+ return global_func_table_.wifi_set_packet_filter(
+ wlan_interface_handle_, program.data(), program.size());
}
wifi_error WifiLegacyHal::retrieveWlanInterfaceHandle() {
@@ -228,6 +252,8 @@
on_driver_memory_dump_internal_callback = nullptr;
on_firmware_memory_dump_internal_callback = nullptr;
}
+
+} // namespace legacy_hal
} // namespace implementation
} // namespace V1_0
} // namespace wifi
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index d817184..8bd146a 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -21,13 +21,23 @@
#include <thread>
#include <vector>
-#include <hardware_legacy/wifi_hal.h>
-
namespace android {
namespace hardware {
namespace wifi {
namespace V1_0 {
namespace implementation {
+// This is in a separate namespace to prevent typename conflicts between
+// the legacy HAL types and the HIDL interface types.
+namespace legacy_hal {
+// Wrap all the types defined inside the legacy HAL header files inside this
+// namespace.
+#include <hardware_legacy/wifi_hal.h>
+
+// APF capabilities supported by the iface.
+struct PacketFilterCapabilities {
+ uint32_t version;
+ uint32_t max_len;
+};
/**
* Class that encapsulates all legacy HAL interactions.
@@ -51,6 +61,10 @@
std::pair<wifi_error, std::string> getFirmwareVersion();
std::pair<wifi_error, std::vector<uint8_t>> requestDriverMemoryDump();
std::pair<wifi_error, std::vector<uint8_t>> requestFirmwareMemoryDump();
+ std::pair<wifi_error, uint32_t> getSupportedFeatureSet();
+ // APF functions.
+ std::pair<wifi_error, PacketFilterCapabilities> getPacketFilterCapabilities();
+ wifi_error setPacketFilter(const std::vector<uint8_t>& program);
private:
// Retrieve the interface handle to be used for the "wlan" interface.
@@ -71,6 +85,7 @@
bool awaiting_event_loop_termination_;
};
+} // namespace legacy_hal
} // namespace implementation
} // namespace V1_0
} // namespace wifi
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
index a2190a8..48e75a5 100644
--- a/wifi/1.0/default/wifi_nan_iface.cpp
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -27,8 +27,9 @@
namespace implementation {
using hidl_return_util::validateAndCall;
-WifiNanIface::WifiNanIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+WifiNanIface::WifiNanIface(
+ const std::string& ifname,
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiNanIface::invalidate() {
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
index f3c0640..4f89b31 100644
--- a/wifi/1.0/default/wifi_nan_iface.h
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -35,7 +35,7 @@
class WifiNanIface : public IWifiNanIface {
public:
WifiNanIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
@@ -135,7 +135,7 @@
WifiStatus dataEndInternal(uint32_t cmd_id, const NanDataPathEndRequest& msg);
std::string ifname_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::vector<sp<IWifiNanIfaceEventCallback>> event_callbacks_;
bool is_valid_;
diff --git a/wifi/1.0/default/wifi_p2p_iface.cpp b/wifi/1.0/default/wifi_p2p_iface.cpp
index 65258ba..0d055f1 100644
--- a/wifi/1.0/default/wifi_p2p_iface.cpp
+++ b/wifi/1.0/default/wifi_p2p_iface.cpp
@@ -27,8 +27,9 @@
namespace implementation {
using hidl_return_util::validateAndCall;
-WifiP2pIface::WifiP2pIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+WifiP2pIface::WifiP2pIface(
+ const std::string& ifname,
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiP2pIface::invalidate() {
diff --git a/wifi/1.0/default/wifi_p2p_iface.h b/wifi/1.0/default/wifi_p2p_iface.h
index d4656e1..d2982db 100644
--- a/wifi/1.0/default/wifi_p2p_iface.h
+++ b/wifi/1.0/default/wifi_p2p_iface.h
@@ -34,7 +34,7 @@
class WifiP2pIface : public IWifiP2pIface {
public:
WifiP2pIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
@@ -49,7 +49,7 @@
std::pair<WifiStatus, IfaceType> getTypeInternal();
std::string ifname_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
bool is_valid_;
DISALLOW_COPY_AND_ASSIGN(WifiP2pIface);
diff --git a/wifi/1.0/default/wifi_rtt_controller.cpp b/wifi/1.0/default/wifi_rtt_controller.cpp
index dbe836b..6ac0629 100644
--- a/wifi/1.0/default/wifi_rtt_controller.cpp
+++ b/wifi/1.0/default/wifi_rtt_controller.cpp
@@ -29,7 +29,7 @@
WifiRttController::WifiRttController(
const sp<IWifiIface>& bound_iface,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: bound_iface_(bound_iface), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiRttController::invalidate() {
diff --git a/wifi/1.0/default/wifi_rtt_controller.h b/wifi/1.0/default/wifi_rtt_controller.h
index 5ebd4bc..3dd5340 100644
--- a/wifi/1.0/default/wifi_rtt_controller.h
+++ b/wifi/1.0/default/wifi_rtt_controller.h
@@ -36,7 +36,7 @@
class WifiRttController : public IWifiRttController {
public:
WifiRttController(const sp<IWifiIface>& bound_iface,
- const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
@@ -103,7 +103,7 @@
WifiStatus disableResponderInternal(uint32_t cmd_id);
sp<IWifiIface> bound_iface_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::vector<sp<IWifiRttControllerEventCallback>> event_callbacks_;
bool is_valid_;
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 1f220f3..6365032 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -27,8 +27,9 @@
namespace implementation {
using hidl_return_util::validateAndCall;
-WifiStaIface::WifiStaIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal)
+WifiStaIface::WifiStaIface(
+ const std::string& ifname,
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal)
: ifname_(ifname), legacy_hal_(legacy_hal), is_valid_(true) {}
void WifiStaIface::invalidate() {
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
index a13feeb..09a883c 100644
--- a/wifi/1.0/default/wifi_sta_iface.h
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -35,7 +35,7 @@
class WifiStaIface : public IWifiStaIface {
public:
WifiStaIface(const std::string& ifname,
- const std::weak_ptr<WifiLegacyHal> legacy_hal);
+ const std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal);
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
@@ -107,7 +107,7 @@
getDebugRxPacketFatesInternal();
std::string ifname_;
- std::weak_ptr<WifiLegacyHal> legacy_hal_;
+ std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::vector<sp<IWifiStaIfaceEventCallback>> event_callbacks_;
bool is_valid_;