Merge "Make vehicle HAL 2.1 proprietary module"
diff --git a/automotive/Android.bp b/automotive/Android.bp
index 0302cd5..1f39e88 100644
--- a/automotive/Android.bp
+++ b/automotive/Android.bp
@@ -1,6 +1,5 @@
// This is an autogenerated file, do not edit.
subdirs = [
- "vehicle",
"vehicle/2.0",
"vehicle/2.1",
]
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 5e22364..8da0568 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -330,9 +330,12 @@
/*
* Fan speed setting
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
- * @allow_out_of_range_value : OFF
*/
HVAC_FAN_SPEED = (
0x0500
@@ -343,10 +346,13 @@
/*
* Fan direction setting
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
* @data_enum VehicleHvacFanDirection
- * @allow_out_of_range_value : OFF
*/
HVAC_FAN_DIRECTION = (
0x0501
@@ -357,6 +363,10 @@
/*
* HVAC current temperature.
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -369,9 +379,12 @@
/*
* HVAC, target temperature set.
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
- * @allow_out_of_range_value : MIN / MAX / OFF
*/
HVAC_TEMPERATURE_SET = (
0x0503
@@ -382,6 +395,10 @@
/*
* On/off defrost
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -394,6 +411,10 @@
/*
* On/off AC
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
* @config_flags Supported zones
@@ -407,6 +428,10 @@
/*
* On/off max AC
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -419,6 +444,10 @@
/*
* On/off max defrost
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -431,6 +460,10 @@
/*
* On/off re-circulation
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -443,6 +476,10 @@
/*
* On/off dual. This must be defined per each row.
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -455,6 +492,10 @@
/*
* On/off automatic mode
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -475,6 +516,10 @@
* min/max range defines the allowable range and number of steps in each
* direction.
*
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
* @change_mode VehiclePropertyChangeMode:ON_CHANGE
* @access VehiclePropertyAccess:READ_WRITE
*/
@@ -490,8 +535,12 @@
* Increase values denote higher heating levels for side mirrors.
* 0 indicates heating is turned off.
*
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
- * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
*/
HVAC_SIDE_MIRROR_HEAT = (
0x050C
@@ -507,8 +556,12 @@
* Negative value indicates cooling.
* 0 indicates temperature control is off.
*
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
- * @access VEHICLE_PROP_ACCESS_READ_WRITE
+ * IVehicle#set may return StatusCode::NOT_AVAILABLE and IVehicle#get is not
+ * guaranteed to work if HVAC unit is off. See HVAC_POWER_ON property for
+ * details.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ_WRITE
*/
HVAC_STEERING_WHEEL_TEMP = (
0x050D
@@ -523,8 +576,11 @@
* different unit from VehicleUnit enum.
* This parameter affects all HVAC temperatures in the system.
*
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
- * @access VEHICLE_PROP_ACCESS_READ
+ * IVehicle#get is not guaranteed to work if HVAC unit is off. See
+ * HVAC_POWER_ON property for details.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
*/
HVAC_TEMPERATURE_UNITS = (
0x050E
@@ -535,9 +591,11 @@
/**
* Actual fan speed
*
- * @change_mode VEHICLE_PROP_CHANGE_MODE_ON_CHANGE
- * @access VEHICLE_PROP_ACCESS_READ
- * @allow_out_of_range_value : OFF
+ * IVehicle#get is not guaranteed to work if HVAC unit is off. See
+ * HVAC_POWER_ON property for details.
+ *
+ * @change_mode VehiclePropertyChangeMode:ON_CHANGE
+ * @access VehiclePropertyAccess:READ
*/
HVAC_ACTUAL_FAN_SPEED_RPM = (
0x050F
@@ -555,9 +613,8 @@
*
* 0x12 = (1 << 1) | (1 << 4)
*
- * @change_mode VEHICLE_PROP_CHANGE_MODE_STATIC
- * @access VEHICLE_PROP_ACCESS_READ
- * @allow_out_of_range_value : OFF
+ * @change_mode VehiclePropertyChangeMode:STATIC
+ * @access VehiclePropertyAccess:READ
*/
HVAC_FAN_DIRECTION_AVAILABLE = (
0x0511
diff --git a/automotive/vehicle/2.1/Android.bp b/automotive/vehicle/2.1/Android.bp
index 12bb4ed..dcf395c 100644
--- a/automotive/vehicle/2.1/Android.bp
+++ b/automotive/vehicle/2.1/Android.bp
@@ -13,8 +13,7 @@
tools: ["hidl-gen"],
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.automotive.vehicle@2.1",
srcs: [
- "types.hal",
- "IVehicle.hal",
+ ":android.hardware.automotive.vehicle@2.1_hal",
],
out: [
"android/hardware/automotive/vehicle/2.1/types.cpp",
@@ -27,8 +26,7 @@
tools: ["hidl-gen"],
cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.automotive.vehicle@2.1",
srcs: [
- "types.hal",
- "IVehicle.hal",
+ ":android.hardware.automotive.vehicle@2.1_hal",
],
out: [
"android/hardware/automotive/vehicle/2.1/types.h",
diff --git a/automotive/vehicle/2.1/Android.mk b/automotive/vehicle/2.1/Android.mk
index f618268..2a8d1dd 100644
--- a/automotive/vehicle/2.1/Android.mk
+++ b/automotive/vehicle/2.1/Android.mk
@@ -8,7 +8,7 @@
LOCAL_MODULE := android.hardware.automotive.vehicle@2.1-java
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-intermediates := $(local-generated-sources-dir)
+intermediates := $(call local-generated-sources-dir, COMMON)
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
@@ -63,7 +63,7 @@
LOCAL_MODULE := android.hardware.automotive.vehicle@2.1-java-static
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-intermediates := $(local-generated-sources-dir)
+intermediates := $(call local-generated-sources-dir, COMMON)
HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
diff --git a/automotive/vehicle/Android.bp b/automotive/vehicle/Android.bp
deleted file mode 100644
index c12cd4f..0000000
--- a/automotive/vehicle/Android.bp
+++ /dev/null
@@ -1,4 +0,0 @@
-// This is an autogenerated file, do not edit.
-subdirs = [
- "2.0",
-]
diff --git a/bluetooth/1.0/vts/functional/Android.bp b/bluetooth/1.0/vts/functional/Android.bp
index 086ac99..2012c20 100644
--- a/bluetooth/1.0/vts/functional/Android.bp
+++ b/bluetooth/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
//
cc_test {
- name: "bluetooth_hidl_hal_test",
+ name: "VtsHalBluetoothV1_0TargetTest",
gtest: true,
- srcs: ["bluetooth_hidl_hal_test.cpp"],
+ srcs: ["VtsHalBluetoothV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
"liblog",
diff --git a/bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
similarity index 100%
rename from bluetooth/1.0/vts/functional/bluetooth_hidl_hal_test.cpp
rename to bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
diff --git a/broadcastradio/1.0/default/Tuner.cpp b/broadcastradio/1.0/default/Tuner.cpp
index b564d5a..ff643b8 100644
--- a/broadcastradio/1.0/default/Tuner.cpp
+++ b/broadcastradio/1.0/default/Tuner.cpp
@@ -22,7 +22,7 @@
#include "BroadcastRadio.h"
#include "Tuner.h"
#include "Utils.h"
-#include <system/radio_metadata.h>
+#include <system/RadioMetadataWrapper.h>
namespace android {
namespace hardware {
@@ -167,6 +167,7 @@
Return<void> Tuner::getProgramInformation(getProgramInformation_cb _hidl_cb) {
int rc;
radio_program_info_t halInfo;
+ RadioMetadataWrapper metadataWrapper(&halInfo.metadata);
ProgramInfo info;
ALOGV("%s", __FUNCTION__);
@@ -175,12 +176,10 @@
goto exit;
}
- radio_metadata_allocate(&halInfo.metadata, 0, 0);
rc = mHalTuner->get_program_information(mHalTuner, &halInfo);
if (rc == 0) {
Utils::convertProgramInfoFromHal(&info, &halInfo);
}
- radio_metadata_deallocate(halInfo.metadata);
exit:
_hidl_cb(Utils::convertHalResult(rc), info);
diff --git a/drm/1.0/ICryptoPlugin.hal b/drm/1.0/ICryptoPlugin.hal
index d66151e..ca8fa50 100644
--- a/drm/1.0/ICryptoPlugin.hal
+++ b/drm/1.0/ICryptoPlugin.hal
@@ -62,8 +62,16 @@
* After the shared buffer base is established, the decrypt() method
* receives SharedBuffer instances which specify the buffer address range
* for decrypt source and destination addresses.
+ *
+ * There can be multiple shared buffers per crypto plugin. The buffers
+ * are distinguished by the bufferId.
+ *
+ * @param base the base IMemory of the memory buffer identified by
+ * bufferId
+ * @param bufferId identifies the specific shared buffer for which
+ * the base is being set.
*/
- setSharedBufferBase(memory base);
+ setSharedBufferBase(memory base, uint32_t bufferId);
/**
* Decrypt an array of subsamples from the source memory buffer to the
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index fb61ede..4a4171b 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -49,8 +49,9 @@
return toStatus(mLegacyPlugin->setMediaDrmSession(toVector(sessionId)));
}
- Return<void> CryptoPlugin::setSharedBufferBase(const hidl_memory& base) {
- mSharedBufferBase = mapMemory(base);
+ Return<void> CryptoPlugin::setSharedBufferBase(const hidl_memory& base,
+ uint32_t bufferId) {
+ mSharedBufferMap[bufferId] = mapMemory(base);
return Void();
}
@@ -62,11 +63,19 @@
const DestinationBuffer& destination,
decrypt_cb _hidl_cb) {
- if (mSharedBufferBase == NULL) {
- _hidl_cb(Status::BAD_VALUE, 0, "decrypt buffer base not set");
+ if (mSharedBufferMap.find(source.bufferId) == mSharedBufferMap.end()) {
+ _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "source decrypt buffer base not set");
return Void();
}
+ if (destination.type == BufferType::SHARED_MEMORY) {
+ const SharedBuffer& dest = destination.nonsecureMemory;
+ if (mSharedBufferMap.find(dest.bufferId) == mSharedBufferMap.end()) {
+ _hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "destination decrypt buffer base not set");
+ return Void();
+ }
+ }
+
android::CryptoPlugin::Mode legacyMode;
switch(mode) {
case Mode::UNENCRYPTED:
@@ -97,20 +106,22 @@
}
AString detailMessage;
+ sp<IMemory> sourceBase = mSharedBufferMap[source.bufferId];
- if (source.offset + offset + source.size > mSharedBufferBase->getSize()) {
+ if (source.offset + offset + source.size > sourceBase->getSize()) {
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
return Void();
}
uint8_t *base = static_cast<uint8_t *>
- (static_cast<void *>(mSharedBufferBase->getPointer()));
+ (static_cast<void *>(sourceBase->getPointer()));
void *srcPtr = static_cast<void *>(base + source.offset + offset);
void *destPtr = NULL;
if (destination.type == BufferType::SHARED_MEMORY) {
const SharedBuffer& destBuffer = destination.nonsecureMemory;
- if (destBuffer.offset + destBuffer.size > mSharedBufferBase->getSize()) {
+ sp<IMemory> destBase = mSharedBufferMap[destBuffer.bufferId];
+ if (destBuffer.offset + destBuffer.size > destBase->getSize()) {
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, 0, "invalid buffer size");
return Void();
}
diff --git a/drm/1.0/default/CryptoPlugin.h b/drm/1.0/default/CryptoPlugin.h
index f805f09..11cc2aa 100644
--- a/drm/1.0/default/CryptoPlugin.h
+++ b/drm/1.0/default/CryptoPlugin.h
@@ -57,8 +57,8 @@
Return<Status> setMediaDrmSession(const hidl_vec<uint8_t>& sessionId)
override;
- Return<void> setSharedBufferBase(const ::android::hardware::hidl_memory& base)
- override;
+ Return<void> setSharedBufferBase(const ::android::hardware::hidl_memory& base,
+ uint32_t bufferId) override;
Return<void> decrypt(bool secure, const hidl_array<uint8_t, 16>& keyId,
const hidl_array<uint8_t, 16>& iv, Mode mode, const Pattern& pattern,
@@ -68,7 +68,7 @@
private:
android::CryptoPlugin *mLegacyPlugin;
- sp<IMemory> mSharedBufferBase;
+ std::map<uint32_t, sp<IMemory> > mSharedBufferMap;
CryptoPlugin() = delete;
CryptoPlugin(const CryptoPlugin &) = delete;
diff --git a/drm/1.0/types.hal b/drm/1.0/types.hal
index 33bbf9a..5273044 100644
--- a/drm/1.0/types.hal
+++ b/drm/1.0/types.hal
@@ -293,12 +293,18 @@
};
/**
- * A SharedBuffer describes a decrypt buffer which is defined by an offset and
- * a size. The offset is relative to the shared memory base which is established
- * using setSharedMemoryBase().
+ * SharedBuffer describes a decrypt buffer which is defined by a bufferId, an
+ * offset and a size. The offset is relative to the shared memory base for the
+ * memory region identified by bufferId, which is established by
+ * setSharedMemoryBase().
*/
struct SharedBuffer {
/**
+ * The unique buffer identifier
+ */
+ uint32_t bufferId;
+
+ /**
* The offset from the shared memory base
*/
uint64_t offset;
diff --git a/evs/1.0/default/EvsCamera.cpp b/evs/1.0/default/EvsCamera.cpp
index a539b23..df7e844 100644
--- a/evs/1.0/default/EvsCamera.cpp
+++ b/evs/1.0/default/EvsCamera.cpp
@@ -69,7 +69,8 @@
mHeight = (mDescription.defaultVerResolution) ? mDescription.defaultVerResolution : 480;
mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
- mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE;
+ mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
+ GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
}
@@ -440,7 +441,7 @@
}
-void EvsCamera::fillTestFrame(BufferDesc buff) {
+void EvsCamera::fillTestFrame(const BufferDesc& buff) {
// Lock our output buffer for writing
uint32_t *pixels = nullptr;
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
@@ -474,7 +475,8 @@
pixels[col] = expectedPixel;
}
// Point to the next row
- pixels = pixels + (buff.stride / sizeof(*pixels));
+ // NOTE: stride retrieved from gralloc is in units of pixels
+ pixels = pixels + buff.stride;
}
// Release our output buffer
diff --git a/evs/1.0/default/EvsCamera.h b/evs/1.0/default/EvsCamera.h
index 8d644a0..02a677c 100644
--- a/evs/1.0/default/EvsCamera.h
+++ b/evs/1.0/default/EvsCamera.h
@@ -58,7 +58,7 @@
unsigned decreaseAvailableFrames_Locked(unsigned numToRemove);
void generateFrames();
- void fillTestFrame(BufferDesc buff);
+ void fillTestFrame(const BufferDesc& buff);
CameraDesc mDescription = {}; // The properties of this camera
diff --git a/evs/1.0/default/EvsDisplay.cpp b/evs/1.0/default/EvsDisplay.cpp
index 7208395..bbfff35 100644
--- a/evs/1.0/default/EvsDisplay.cpp
+++ b/evs/1.0/default/EvsDisplay.cpp
@@ -169,7 +169,7 @@
mBuffer.memHandle = handle;
mFrameBusy = false;
ALOGD("Allocated new buffer %p with stride %u",
- mBuffer.memHandle.getNativeHandle(), mStride);
+ mBuffer.memHandle.getNativeHandle(), mBuffer.stride);
}
// Do we have a frame available?
@@ -263,7 +263,8 @@
continue;
}
// Walk across this row (we'll step rows below)
- if (pixels[col] != expectedPixel) {
+ uint32_t receivedPixel = pixels[col];
+ if (receivedPixel != expectedPixel) {
ALOGE("Pixel check mismatch in frame buffer");
frameLooksGood = false;
break;
@@ -274,8 +275,8 @@
break;
}
- // Point to the next row
- pixels = pixels + (mStride / sizeof(*pixels));
+ // Point to the next row (NOTE: gralloc reports stride in units of pixels)
+ pixels = pixels + mBuffer.stride;
}
// Ensure we don't see the same buffer twice without it being rewritten
diff --git a/evs/1.0/default/EvsDisplay.h b/evs/1.0/default/EvsDisplay.h
index 6e0111e..f4d7ee9 100644
--- a/evs/1.0/default/EvsDisplay.h
+++ b/evs/1.0/default/EvsDisplay.h
@@ -42,7 +42,6 @@
private:
DisplayDesc mInfo = {};
BufferDesc mBuffer = {}; // A graphics buffer into which we'll store images
- uint32_t mStride = 0; // Bytes per line in the buffer
bool mFrameBusy = false; // A flag telling us our buffer is in use
DisplayState mRequestedState = DisplayState::NOT_VISIBLE;
diff --git a/gnss/1.0/default/AGnss.cpp b/gnss/1.0/default/AGnss.cpp
index 52fdc26..29c6ddd 100644
--- a/gnss/1.0/default/AGnss.cpp
+++ b/gnss/1.0/default/AGnss.cpp
@@ -41,6 +41,7 @@
AGnss::~AGnss() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
void AGnss::statusCb(AGpsStatus* status) {
@@ -78,7 +79,10 @@
/*
* Callback to client with agnssStatusIpV4Cb.
*/
- sAGnssCbIface->agnssStatusIpV4Cb(aGnssStatusIpV4);
+ auto ret = sAGnssCbIface->agnssStatusIpV4Cb(aGnssStatusIpV4);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
break;
}
case AF_INET6:
@@ -96,7 +100,10 @@
&(status->addr));
memcpy(&(aGnssStatusIpV6.ipV6Addr[0]), in6->sin6_addr.s6_addr,
aGnssStatusIpV6.ipV6Addr.size());
- sAGnssCbIface->agnssStatusIpV6Cb(aGnssStatusIpV6);
+ auto ret = sAGnssCbIface->agnssStatusIpV6Cb(aGnssStatusIpV6);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
break;
}
default:
@@ -117,7 +124,10 @@
/*
* Callback to client with agnssStatusIpV4Cb.
*/
- sAGnssCbIface->agnssStatusIpV4Cb(aGnssStatusIpV4);
+ auto ret = sAGnssCbIface->agnssStatusIpV4Cb(aGnssStatusIpV4);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
} else {
ALOGE("%s: Invalid size for AGPS Status", __func__);
}
diff --git a/gnss/1.0/default/AGnssRil.cpp b/gnss/1.0/default/AGnssRil.cpp
index 480571d..1458327 100644
--- a/gnss/1.0/default/AGnssRil.cpp
+++ b/gnss/1.0/default/AGnssRil.cpp
@@ -42,6 +42,7 @@
AGnssRil::~AGnssRil() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
void AGnssRil::requestSetId(uint32_t flags) {
@@ -50,7 +51,10 @@
return;
}
- sAGnssRilCbIface->requestSetIdCb(flags);
+ auto ret = sAGnssRilCbIface->requestSetIdCb(flags);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void AGnssRil::requestRefLoc(uint32_t /*flags*/) {
@@ -59,7 +63,10 @@
return;
}
- sAGnssRilCbIface->requestRefLocCb();
+ auto ret = sAGnssRilCbIface->requestRefLocCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
pthread_t AGnssRil::createThreadCb(const char* name, void (*start)(void*), void* arg) {
diff --git a/gnss/1.0/default/Android.mk b/gnss/1.0/default/Android.mk
index 73889b5..b4ef9a8 100644
--- a/gnss/1.0/default/Android.mk
+++ b/gnss/1.0/default/Android.mk
@@ -28,6 +28,8 @@
android.hardware.gnss@1.0 \
libhardware
+LOCAL_CFLAGS += -Werror
+
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
diff --git a/gnss/1.0/default/Gnss.cpp b/gnss/1.0/default/Gnss.cpp
index a2a99a0..10024fb 100644
--- a/gnss/1.0/default/Gnss.cpp
+++ b/gnss/1.0/default/Gnss.cpp
@@ -60,6 +60,7 @@
}
Gnss::~Gnss() {
+ sInterfaceExists = false;
sThreadFuncArgsList.clear();
}
@@ -75,7 +76,10 @@
}
android::hardware::gnss::V1_0::GnssLocation gnssLocation = convertToGnssLocation(location);
- sGnssCbIface->gnssLocationCb(gnssLocation);
+ auto ret = sGnssCbIface->gnssLocationCb(gnssLocation);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void Gnss::statusCb(GpsStatus* gnssStatus) {
@@ -92,7 +96,10 @@
IGnssCallback::GnssStatusValue status =
static_cast<IGnssCallback::GnssStatusValue>(gnssStatus->status);
- sGnssCbIface->gnssStatusCb(status);
+ auto ret = sGnssCbIface->gnssStatusCb(status);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void Gnss::gnssSvStatusCb(GnssSvStatus* status) {
@@ -131,7 +138,10 @@
svStatus.gnssSvList[i] = gnssSvInfo;
}
- sGnssCbIface->gnssSvStatusCb(svStatus);
+ auto ret = sGnssCbIface->gnssSvStatusCb(svStatus);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
/*
@@ -231,7 +241,10 @@
}
}
- sGnssCbIface->gnssSvStatusCb(svStatus);
+ auto ret = sGnssCbIface->gnssSvStatusCb(svStatus);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void Gnss::nmeaCb(GpsUtcTime timestamp, const char* nmea, int length) {
@@ -242,7 +255,10 @@
android::hardware::hidl_string nmeaString;
nmeaString.setToExternal(nmea, length);
- sGnssCbIface->gnssNmeaCb(timestamp, nmeaString);
+ auto ret = sGnssCbIface->gnssNmeaCb(timestamp, nmeaString);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void Gnss::setCapabilitiesCb(uint32_t capabilities) {
@@ -251,7 +267,10 @@
return;
}
- sGnssCbIface->gnssSetCapabilitesCb(capabilities);
+ auto ret = sGnssCbIface->gnssSetCapabilitesCb(capabilities);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void Gnss::acquireWakelockCb() {
@@ -298,7 +317,10 @@
ALOGI("%s: GNSS HAL Wakelock acquired due to gps: %d, fused: %d", __func__,
sWakelockHeldGnss, sWakelockHeldFused);
sWakelockHeld = true;
- sGnssCbIface->gnssAcquireWakelockCb();
+ auto ret = sGnssCbIface->gnssAcquireWakelockCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
} else {
if (sWakelockHeld) {
@@ -309,7 +331,10 @@
ALOGW("%s: GNSS HAL Wakelock released, duplicate request", __func__);
}
sWakelockHeld = false;
- sGnssCbIface->gnssReleaseWakelockCb();
+ auto ret = sGnssCbIface->gnssReleaseWakelockCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
}
@@ -319,7 +344,10 @@
return;
}
- sGnssCbIface->gnssRequestTimeCb();
+ auto ret = sGnssCbIface->gnssRequestTimeCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
pthread_t Gnss::createThreadCb(const char* name, void (*start)(void*), void* arg) {
@@ -341,7 +369,10 @@
.yearOfHw = info->year_of_hw
};
- sGnssCbIface->gnssSetSystemInfoCb(gnssInfo);
+ auto ret = sGnssCbIface->gnssSetSystemInfoCb(gnssInfo);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
@@ -434,7 +465,10 @@
Return<sp<IAGnssRil>> Gnss::getExtensionAGnssRil() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssRil == nullptr) {
const AGpsRilInterface* agpsRilIface = static_cast<const AGpsRilInterface*>(
mGnssIface->get_extension(AGPS_RIL_INTERFACE));
if (agpsRilIface == nullptr) {
@@ -449,7 +483,10 @@
Return<sp<IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssConfig == nullptr) {
const GnssConfigurationInterface* gnssConfigIface =
static_cast<const GnssConfigurationInterface*>(
mGnssIface->get_extension(GNSS_CONFIGURATION_INTERFACE));
@@ -462,10 +499,14 @@
}
return mGnssConfig;
}
+
Return<sp<IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssGeofencingIface == nullptr) {
const GpsGeofencingInterface* gpsGeofencingIface =
static_cast<const GpsGeofencingInterface*>(
mGnssIface->get_extension(GPS_GEOFENCING_INTERFACE));
@@ -483,7 +524,10 @@
Return<sp<IAGnss>> Gnss::getExtensionAGnss() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mAGnssIface == nullptr) {
const AGpsInterface* agpsIface = static_cast<const AGpsInterface*>(
mGnssIface->get_extension(AGPS_INTERFACE));
if (agpsIface == nullptr) {
@@ -498,7 +542,10 @@
Return<sp<IGnssNi>> Gnss::getExtensionGnssNi() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssNi == nullptr) {
const GpsNiInterface* gpsNiIface = static_cast<const GpsNiInterface*>(
mGnssIface->get_extension(GPS_NI_INTERFACE));
if (gpsNiIface == nullptr) {
@@ -513,7 +560,10 @@
Return<sp<IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssMeasurement == nullptr) {
const GpsMeasurementInterface* gpsMeasurementIface =
static_cast<const GpsMeasurementInterface*>(
mGnssIface->get_extension(GPS_MEASUREMENT_INTERFACE));
@@ -530,7 +580,10 @@
Return<sp<IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssNavigationMessage == nullptr) {
const GpsNavigationMessageInterface* gpsNavigationMessageIface =
static_cast<const GpsNavigationMessageInterface*>(
mGnssIface->get_extension(GPS_NAVIGATION_MESSAGE_INTERFACE));
@@ -549,7 +602,10 @@
Return<sp<IGnssXtra>> Gnss::getExtensionXtra() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssXtraIface == nullptr) {
const GpsXtraInterface* gpsXtraIface = static_cast<const GpsXtraInterface*>(
mGnssIface->get_extension(GPS_XTRA_INTERFACE));
@@ -566,7 +622,10 @@
Return<sp<IGnssDebug>> Gnss::getExtensionGnssDebug() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssDebug == nullptr) {
const GpsDebugInterface* gpsDebugIface = static_cast<const GpsDebugInterface*>(
mGnssIface->get_extension(GPS_DEBUG_INTERFACE));
@@ -583,7 +642,10 @@
Return<sp<IGnssBatching>> Gnss::getExtensionGnssBatching() {
if (mGnssIface == nullptr) {
ALOGE("%s: Gnss interface is unavailable", __func__);
- } else {
+ return nullptr;
+ }
+
+ if (mGnssBatching == nullptr) {
hw_module_t* module;
const FlpLocationInterface* flpLocationIface = nullptr;
int err = hw_get_module(FUSED_LOCATION_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
diff --git a/gnss/1.0/default/GnssBatching.cpp b/gnss/1.0/default/GnssBatching.cpp
index 95c5e60..02b38cb 100644
--- a/gnss/1.0/default/GnssBatching.cpp
+++ b/gnss/1.0/default/GnssBatching.cpp
@@ -103,7 +103,10 @@
gnssLocations.push_back(convertToGnssLocation(locations[iLocation]));
}
- sGnssBatchingCbIface->gnssLocationBatchCb(gnssLocations);
+ auto ret = sGnssBatchingCbIface->gnssLocationBatchCb(gnssLocations);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssBatching::acquireWakelockCb() {
@@ -115,7 +118,7 @@
}
// this can just return success, because threads are now set up on demand in the jni layer
-int32_t GnssBatching::setThreadEventCb(ThreadEvent event) {
+int32_t GnssBatching::setThreadEventCb(ThreadEvent /*event*/) {
return FLP_RESULT_SUCCESS;
}
diff --git a/gnss/1.0/default/GnssGeofencing.cpp b/gnss/1.0/default/GnssGeofencing.cpp
index f42de42..54c4aaa 100644
--- a/gnss/1.0/default/GnssGeofencing.cpp
+++ b/gnss/1.0/default/GnssGeofencing.cpp
@@ -48,6 +48,7 @@
GnssGeofencing::~GnssGeofencing() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
void GnssGeofencing::gnssGfTransitionCb(int32_t geofenceId,
GpsLocation* location,
@@ -64,11 +65,14 @@
}
GnssLocation gnssLocation = convertToGnssLocation(location);
- mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
+ auto ret = mGnssGeofencingCbIface->gnssGeofenceTransitionCb(
geofenceId,
gnssLocation,
static_cast<IGnssGeofenceCallback::GeofenceTransition>(transition),
timestamp);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssGeofencing::gnssGfStatusCb(int32_t status, GpsLocation* location) {
@@ -85,8 +89,11 @@
gnssLocation = {};
}
- mGnssGeofencingCbIface->gnssGeofenceStatusCb(
+ auto ret = mGnssGeofencingCbIface->gnssGeofenceStatusCb(
static_cast<IGnssGeofenceCallback::GeofenceAvailability>(status), gnssLocation);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssGeofencing::gnssGfAddCb(int32_t geofenceId, int32_t status) {
@@ -95,8 +102,11 @@
return;
}
- mGnssGeofencingCbIface->gnssGeofenceAddCb(
+ auto ret = mGnssGeofencingCbIface->gnssGeofenceAddCb(
geofenceId, static_cast<IGnssGeofenceCallback::GeofenceStatus>(status));
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssGeofencing::gnssGfRemoveCb(int32_t geofenceId, int32_t status) {
@@ -105,8 +115,11 @@
return;
}
- mGnssGeofencingCbIface->gnssGeofenceRemoveCb(
- geofenceId, static_cast<IGnssGeofenceCallback::GeofenceStatus>(status));
+ auto ret = mGnssGeofencingCbIface->gnssGeofenceRemoveCb(
+ geofenceId, static_cast<IGnssGeofenceCallback::GeofenceStatus>(status));
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssGeofencing::gnssGfPauseCb(int32_t geofenceId, int32_t status) {
@@ -115,8 +128,11 @@
return;
}
- mGnssGeofencingCbIface->gnssGeofencePauseCb(
+ auto ret = mGnssGeofencingCbIface->gnssGeofencePauseCb(
geofenceId, static_cast<IGnssGeofenceCallback::GeofenceStatus>(status));
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void GnssGeofencing::gnssGfResumeCb(int32_t geofenceId, int32_t status) {
@@ -125,8 +141,11 @@
return;
}
- mGnssGeofencingCbIface->gnssGeofenceResumeCb(
+ auto ret = mGnssGeofencingCbIface->gnssGeofenceResumeCb(
geofenceId, static_cast<IGnssGeofenceCallback::GeofenceStatus>(status));
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
pthread_t GnssGeofencing::createThreadCb(const char* name, void (*start)(void*), void* arg) {
diff --git a/gnss/1.0/default/GnssMeasurement.cpp b/gnss/1.0/default/GnssMeasurement.cpp
index 67f6d8d..6c9b838 100644
--- a/gnss/1.0/default/GnssMeasurement.cpp
+++ b/gnss/1.0/default/GnssMeasurement.cpp
@@ -96,7 +96,10 @@
.hwClockDiscontinuityCount = clockVal.hw_clock_discontinuity_count
};
- sGnssMeasureCbIface->GnssMeasurementCb(gnssData);
+ auto ret = sGnssMeasureCbIface->GnssMeasurementCb(gnssData);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
/*
@@ -223,7 +226,10 @@
gnssData.clock.driftUncertaintyNsps = clockVal.drift_uncertainty_nsps;
gnssData.clock.gnssClockFlags = clockVal.flags;
- sGnssMeasureCbIface->GnssMeasurementCb(gnssData);
+ auto ret = sGnssMeasureCbIface->GnssMeasurementCb(gnssData);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
// Methods from ::android::hardware::gnss::V1_0::IGnssMeasurement follow.
diff --git a/gnss/1.0/default/GnssNavigationMessage.cpp b/gnss/1.0/default/GnssNavigationMessage.cpp
index c98abf6..6f509d0 100644
--- a/gnss/1.0/default/GnssNavigationMessage.cpp
+++ b/gnss/1.0/default/GnssNavigationMessage.cpp
@@ -59,7 +59,10 @@
navigationMsg.submessageId = message->submessage_id;
navigationMsg.data.setToExternal(message->data, message->data_length);
- sGnssNavigationMsgCbIface->gnssNavigationMessageCb(navigationMsg);
+ auto ret = sGnssNavigationMsgCbIface->gnssNavigationMessageCb(navigationMsg);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
// Methods from ::android::hardware::gnss::V1_0::IGnssNavigationMessage follow.
diff --git a/gnss/1.0/default/GnssNi.cpp b/gnss/1.0/default/GnssNi.cpp
index ec57e8c..d17891d 100644
--- a/gnss/1.0/default/GnssNi.cpp
+++ b/gnss/1.0/default/GnssNi.cpp
@@ -41,6 +41,7 @@
GnssNi::~GnssNi() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
pthread_t GnssNi::createThreadCb(const char* name, void (*start)(void*), void* arg) {
@@ -73,7 +74,10 @@
static_cast<IGnssNiCallback::GnssNiEncodingType>(notification->text_encoding)
};
- sGnssNiCbIface->niNotifyCb(notificationGnss);
+ auto ret = sGnssNiCbIface->niNotifyCb(notificationGnss);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
// Methods from ::android::hardware::gnss::V1_0::IGnssNi follow.
diff --git a/gnss/1.0/default/GnssXtra.cpp b/gnss/1.0/default/GnssXtra.cpp
index 065bb33..d124ce1 100644
--- a/gnss/1.0/default/GnssXtra.cpp
+++ b/gnss/1.0/default/GnssXtra.cpp
@@ -35,6 +35,7 @@
GnssXtra::~GnssXtra() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
pthread_t GnssXtra::createThreadCb(const char* name, void (*start)(void*), void* arg) {
@@ -53,7 +54,10 @@
return;
}
- sGnssXtraCbIface->downloadRequestCb();
+ auto ret = sGnssXtraCbIface->downloadRequestCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
// Methods from ::android::hardware::gnss::V1_0::IGnssXtra follow.
diff --git a/graphics/composer/2.1/default/ComposerClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
index 7a2cb25..72ba8f8 100644
--- a/graphics/composer/2.1/default/ComposerClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -230,6 +230,8 @@
ComposerClient::~ComposerClient()
{
+ ALOGD("client destroyed");
+
mHal.enableCallback(false);
mHal.removeClient();
@@ -275,17 +277,23 @@
}
}
- mCallback->onHotplug(display, connected);
+ auto ret = mCallback->onHotplug(display, connected);
+ ALOGE_IF(!ret.isOk(), "failed to send onHotplug: %s",
+ ret.description().c_str());
}
void ComposerClient::onRefresh(Display display)
{
- mCallback->onRefresh(display);
+ auto ret = mCallback->onRefresh(display);
+ ALOGE_IF(!ret.isOk(), "failed to send onRefresh: %s",
+ ret.description().c_str());
}
void ComposerClient::onVsync(Display display, int64_t timestamp)
{
- mCallback->onVsync(display, timestamp);
+ auto ret = mCallback->onVsync(display, timestamp);
+ ALOGE_IF(!ret.isOk(), "failed to send onVsync: %s",
+ ret.description().c_str());
}
Return<void> ComposerClient::registerCallback(
diff --git a/ir/1.0/vts/functional/Android.bp b/ir/1.0/vts/functional/Android.bp
index 1acd2a0..5689474 100644
--- a/ir/1.0/vts/functional/Android.bp
+++ b/ir/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
//
cc_test {
- name: "ir_hidl_hal_test",
+ name: "VtsHalIrV1_0TargetTest",
gtest: true,
- srcs: ["ir_hidl_hal_test.cpp"],
+ srcs: ["VtsHalIrV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
"liblog",
diff --git a/ir/1.0/vts/functional/ir_hidl_hal_test.cpp b/ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
similarity index 100%
rename from ir/1.0/vts/functional/ir_hidl_hal_test.cpp
rename to ir/1.0/vts/functional/VtsHalIrV1_0TargetTest.cpp
diff --git a/nfc/1.0/vts/functional/Android.bp b/nfc/1.0/vts/functional/Android.bp
index 0f9eb3d..080887f 100644
--- a/nfc/1.0/vts/functional/Android.bp
+++ b/nfc/1.0/vts/functional/Android.bp
@@ -15,9 +15,9 @@
//
cc_test {
- name: "nfc_hidl_hal_test",
+ name: "VtsHalNfcV1_0TargetTest",
gtest: true,
- srcs: ["nfc_hidl_hal_test.cpp"],
+ srcs: ["VtsHalNfcV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
"liblog",
diff --git a/nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
similarity index 100%
rename from nfc/1.0/vts/functional/nfc_hidl_hal_test.cpp
rename to nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
diff --git a/radio/1.0/vts/functional/Android.bp b/radio/1.0/vts/functional/Android.bp
index a01e270..6615f03 100644
--- a/radio/1.0/vts/functional/Android.bp
+++ b/radio/1.0/vts/functional/Android.bp
@@ -15,12 +15,12 @@
//
cc_test {
- name: "radio_hidl_hal_test",
+ name: "VtsHalRadioV1_0TargetTest",
gtest: true,
srcs: ["radio_hidl_hal_test.cpp",
"radio_response.cpp",
"radio_hidl_hal_icc.cpp",
- "radio_hidl_hal_main.cpp"],
+ "VtsHalRadioV1_0TargetTest.cpp"],
shared_libs: [
"libbase",
"liblog",
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_main.cpp b/radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
similarity index 100%
rename from radio/1.0/vts/functional/radio_hidl_hal_main.cpp
rename to radio/1.0/vts/functional/VtsHalRadioV1_0TargetTest.cpp
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils.h b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
index f0c4504..23b6ffa 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils.h
@@ -417,6 +417,8 @@
Return<void> setIndicationFilterResponse(const RadioResponseInfo& info);
+ Return<void> setSimCardPowerResponse(const RadioResponseInfo& info);
+
Return<void> acknowledgeRequest(int32_t serial);
};
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index 18a02ed..b2a74f4 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -655,6 +655,11 @@
return Void();
}
+Return<void> RadioResponse::setSimCardPowerResponse(
+ const RadioResponseInfo& info) {
+ return Void();
+}
+
Return<void> RadioResponse::acknowledgeRequest(int32_t serial) {
return Void();
}
diff --git a/renderscript/1.0/default/Context.cpp b/renderscript/1.0/default/Context.cpp
index 5a09cf9..4e0964e 100644
--- a/renderscript/1.0/default/Context.cpp
+++ b/renderscript/1.0/default/Context.cpp
@@ -73,30 +73,30 @@
return rs_to_hidl<Type>(_type);
}
-Return<Allocation> Context::allocationCreateTyped(Type type, AllocationMipmapControl mips, int32_t usage, Ptr ptr) {
+Return<Allocation> Context::allocationCreateTyped(Type type, AllocationMipmapControl amips, int32_t usage, Ptr ptr) {
RsType _type = hidl_to_rs<RsType>(type);
- RsAllocationMipmapControl _mips = static_cast<RsAllocationMipmapControl>(mips);
+ RsAllocationMipmapControl _amips = static_cast<RsAllocationMipmapControl>(amips);
uint32_t _usage = usage;
uintptr_t _ptr = hidl_to_rs<uintptr_t>(ptr);
- RsAllocation _allocation = Device::getHal().AllocationCreateTyped(mContext, _type, _mips, _usage, _ptr);
+ RsAllocation _allocation = Device::getHal().AllocationCreateTyped(mContext, _type, _amips, _usage, _ptr);
return rs_to_hidl<Allocation>(_allocation);
}
-Return<Allocation> Context::allocationCreateFromBitmap(Type type, AllocationMipmapControl mips, const hidl_vec<uint8_t>& bitmap, int32_t usage) {
+Return<Allocation> Context::allocationCreateFromBitmap(Type type, AllocationMipmapControl amips, const hidl_vec<uint8_t>& bitmap, int32_t usage) {
RsType _type = hidl_to_rs<RsType>(type);
- RsAllocationMipmapControl _mips = static_cast<RsAllocationMipmapControl>(mips);
+ RsAllocationMipmapControl _amips = static_cast<RsAllocationMipmapControl>(amips);
const hidl_vec<uint8_t>& _bitmap = bitmap;
uint32_t _usage = usage;
- RsAllocation _allocation = Device::getHal().AllocationCreateFromBitmap(mContext, _type, _mips, _bitmap.data(), _bitmap.size(), _usage);
+ RsAllocation _allocation = Device::getHal().AllocationCreateFromBitmap(mContext, _type, _amips, _bitmap.data(), _bitmap.size(), _usage);
return rs_to_hidl<Allocation>(_allocation);
}
-Return<Allocation> Context::allocationCubeCreateFromBitmap(Type type, AllocationMipmapControl mips, const hidl_vec<uint8_t>& bitmap, int32_t usage) {
+Return<Allocation> Context::allocationCubeCreateFromBitmap(Type type, AllocationMipmapControl amips, const hidl_vec<uint8_t>& bitmap, int32_t usage) {
RsType _type = hidl_to_rs<RsType>(type);
- RsAllocationMipmapControl _mips = static_cast<RsAllocationMipmapControl>(mips);
+ RsAllocationMipmapControl _amips = static_cast<RsAllocationMipmapControl>(amips);
const hidl_vec<uint8_t>& _bitmap = bitmap;
uint32_t _usage = usage;
- RsAllocation _allocation = Device::getHal().AllocationCubeCreateFromBitmap(mContext, _type, _mips, _bitmap.data(), _bitmap.size(), _usage);
+ RsAllocation _allocation = Device::getHal().AllocationCubeCreateFromBitmap(mContext, _type, _amips, _bitmap.data(), _bitmap.size(), _usage);
return rs_to_hidl<Allocation>(_allocation);
}
diff --git a/renderscript/1.0/default/Context.h b/renderscript/1.0/default/Context.h
index 38c45c5..d8bfe4f 100644
--- a/renderscript/1.0/default/Context.h
+++ b/renderscript/1.0/default/Context.h
@@ -40,9 +40,9 @@
Return<Allocation> allocationAdapterCreate(Type type, Allocation baseAlloc) override;
Return<void> allocationAdapterOffset(Allocation alloc, const hidl_vec<uint32_t>& offsets) override;
Return<Type> allocationGetType(Allocation allocation) override;
- Return<Allocation> allocationCreateTyped(Type type, AllocationMipmapControl mips, int32_t usage, Ptr ptr) override;
- Return<Allocation> allocationCreateFromBitmap(Type type, AllocationMipmapControl mips, const hidl_vec<uint8_t>& bitmap, int32_t usage) override;
- Return<Allocation> allocationCubeCreateFromBitmap(Type type, AllocationMipmapControl mips, const hidl_vec<uint8_t>& bitmap, int32_t usage) override;
+ Return<Allocation> allocationCreateTyped(Type type, AllocationMipmapControl amips, int32_t usage, Ptr ptr) override;
+ Return<Allocation> allocationCreateFromBitmap(Type type, AllocationMipmapControl amips, const hidl_vec<uint8_t>& bitmap, int32_t usage) override;
+ Return<Allocation> allocationCubeCreateFromBitmap(Type type, AllocationMipmapControl amips, const hidl_vec<uint8_t>& bitmap, int32_t usage) override;
Return<NativeWindow> allocationGetNativeWindow(Allocation allocation) override;
Return<void> allocationSetNativeWindow(Allocation allocation, NativeWindow nativewindow) override;
Return<void> allocationSetupBufferQueue(Allocation alloc, uint32_t numBuffer) override;
diff --git a/usb/1.0/vts/functional/Android.bp b/usb/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..5ce33d0
--- /dev/null
+++ b/usb/1.0/vts/functional/Android.bp
@@ -0,0 +1,37 @@
+//
+// 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: "usb_hidl_hal_test",
+ gtest: true,
+ srcs: ["usb_hidl_hal_test.cpp"],
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "libhwbinder",
+ "libnativehelper",
+ "libutils",
+ "android.hardware.usb@1.0",
+ ],
+ static_libs: ["libgtest"],
+ cflags: [
+ "-O0",
+ "-g",
+ ],
+}
diff --git a/usb/1.0/vts/functional/usb_hidl_hal_test.cpp b/usb/1.0/vts/functional/usb_hidl_hal_test.cpp
new file mode 100644
index 0000000..e02ed5b
--- /dev/null
+++ b/usb/1.0/vts/functional/usb_hidl_hal_test.cpp
@@ -0,0 +1,351 @@
+/*
+ * 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 "usb_hidl_hal_test"
+#include <android-base/logging.h>
+
+#include <android/hardware/usb/1.0/IUsb.h>
+#include <android/hardware/usb/1.0/IUsbCallback.h>
+#include <android/hardware/usb/1.0/types.h>
+
+#include <gtest/gtest.h>
+#include <stdlib.h>
+#include <chrono>
+#include <condition_variable>
+#include <mutex>
+
+#define TIMEOUT_PERIOD 10
+
+using ::android::hardware::usb::V1_0::IUsbCallback;
+using ::android::hardware::usb::V1_0::IUsb;
+using ::android::hardware::usb::V1_0::PortDataRole;
+using ::android::hardware::usb::V1_0::PortMode;
+using ::android::hardware::usb::V1_0::PortPowerRole;
+using ::android::hardware::usb::V1_0::PortRole;
+using ::android::hardware::usb::V1_0::PortRoleType;
+using ::android::hardware::usb::V1_0::PortStatus;
+using ::android::hardware::usb::V1_0::Status;
+using ::android::hidl::base::V1_0::IBase;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+#define USB_SERVICE_NAME "usb_hal"
+
+// The main test class for the USB hidl HAL
+class UsbHidlTest : public ::testing::Test {
+ public:
+ // Callback class for the USB HIDL hal.
+ // Usb Hal will call this object upon role switch or port query.
+ class UsbCallback : public IUsbCallback {
+ UsbHidlTest& parent_;
+ int cookie;
+
+ public:
+ UsbCallback(UsbHidlTest& parent, int cookie)
+ : parent_(parent), cookie(cookie){};
+
+ virtual ~UsbCallback() = default;
+
+ // Callback method for the port status.
+ Return<void> notifyPortStatusChange(
+ const hidl_vec<PortStatus>& currentPortStatus, Status retval) override {
+ if (retval == Status::SUCCESS) {
+ parent_.usb_last_port_status.portName =
+ currentPortStatus[0].portName.c_str();
+ parent_.usb_last_port_status.currentDataRole =
+ currentPortStatus[0].currentDataRole;
+ parent_.usb_last_port_status.currentPowerRole =
+ currentPortStatus[0].currentPowerRole;
+ parent_.usb_last_port_status.currentMode =
+ currentPortStatus[0].currentMode;
+ }
+ parent_.usb_last_cookie = cookie;
+ parent_.notify();
+ return Void();
+ };
+
+ // Callback method for the status of role switch operation.
+ Return<void> notifyRoleSwitchStatus(const hidl_string& /*portName*/,
+ const PortRole& newRole,
+ Status retval) override {
+ parent_.usb_last_status = retval;
+ parent_.usb_last_cookie = cookie;
+ parent_.usb_last_port_role = newRole;
+ parent_.usb_role_switch_done = true;
+ parent_.notify();
+ return Void();
+ };
+ };
+
+ virtual void SetUp() override {
+ ALOGI("Setup");
+ usb = IUsb::getService(USB_SERVICE_NAME);
+ ASSERT_NE(usb, nullptr);
+
+ usb_cb_2 = new UsbCallback(*this, 2);
+ ASSERT_NE(usb_cb_2, nullptr);
+ Return<void> ret = usb->setCallback(usb_cb_2);
+ ASSERT_TRUE(ret.isOk());
+ }
+
+ virtual void TearDown() override { ALOGI("Teardown"); }
+
+ // Used as a mechanism to inform the test about data/event callback.
+ inline void notify() {
+ std::unique_lock<std::mutex> lock(usb_mtx);
+ usb_count++;
+ usb_cv.notify_one();
+ }
+
+ // Test code calls this function to wait for data/event callback.
+ inline std::cv_status wait() {
+ std::unique_lock<std::mutex> lock(usb_mtx);
+
+ std::cv_status status = std::cv_status::no_timeout;
+ auto now = std::chrono::system_clock::now();
+ while (usb_count == 0) {
+ status =
+ usb_cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ if (status == std::cv_status::timeout) {
+ ALOGI("timeout");
+ return status;
+ }
+ }
+ usb_count--;
+ return status;
+ }
+
+ // USB hidl hal Proxy
+ sp<IUsb> usb;
+
+ // Callback objects for usb hidl
+ // Methods of these objects are called to notify port status updates.
+ sp<IUsbCallback> usb_cb_1, usb_cb_2;
+
+ // The last conveyed status of the USB ports.
+ // Stores information of currentt_data_role, power_role for all the USB ports
+ PortStatus usb_last_port_status;
+
+ // Status of the last role switch operation.
+ Status usb_last_status;
+
+ // Port role information of the last role switch operation.
+ PortRole usb_last_port_role;
+
+ // Flag to indicate the invocation of role switch callback.
+ bool usb_role_switch_done;
+
+ // Identifier for the usb callback object.
+ // Stores the cookie of the last invoked usb callback object.
+ int usb_last_cookie;
+
+ // synchronization primitives to coordinate between main test thread
+ // and the callback thread.
+ std::mutex usb_mtx;
+ std::condition_variable usb_cv;
+ int usb_count;
+};
+
+/*
+ * Test to see if setCallback succeeds.
+ * Callback oject is created and registered.
+ * Check to see if the hidl transaction succeeded.
+ */
+TEST_F(UsbHidlTest, setCallback) {
+ usb_cb_1 = new UsbCallback(*this, 1);
+ ASSERT_NE(usb_cb_1, nullptr);
+ Return<void> ret = usb->setCallback(usb_cb_1);
+ ASSERT_TRUE(ret.isOk());
+}
+
+/*
+ * Check to see if querying type-c
+ * port status succeeds.
+ */
+TEST_F(UsbHidlTest, queryPortStatus) {
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(2, usb_last_cookie);
+ ALOGI("rightafter: %s", usb_last_port_status.portName.c_str());
+}
+
+/*
+ * Trying to switch a non-existent port should fail.
+ * This test case tried to switch the port with empty
+ * name which is expected to fail.
+ */
+TEST_F(UsbHidlTest, switchEmptyPort) {
+ struct PortRole role;
+ role.type = PortRoleType::DATA_ROLE;
+
+ Return<void> ret = usb->switchRole("", role);
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(Status::ERROR, usb_last_status);
+ EXPECT_EQ(2, usb_last_cookie);
+}
+
+/*
+ * Test switching the mode of usb port.
+ * Test case queries the usb ports present in device.
+ * If there is atleast one usb port, a mode switch
+ * to DFP is attempted for the port.
+ * The callback parametes are checked to see if the mode
+ * switch was successfull. Upon success, Status::SUCCESS
+ * is expected to be returned.
+ */
+TEST_F(UsbHidlTest, switchModetoDFP) {
+ struct PortRole role;
+ role.type = PortRoleType::MODE;
+ role.role = static_cast<uint32_t>(PortMode::DFP);
+
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(2, usb_last_cookie);
+
+ if (!usb_last_port_status.portName.empty()) {
+ hidl_string portBeingSwitched = usb_last_port_status.portName;
+ ALOGI("mode portname:%s", portBeingSwitched.c_str());
+ usb_role_switch_done = false;
+ Return<void> ret = usb->switchRole(portBeingSwitched.c_str(), role);
+ ASSERT_TRUE(ret.isOk());
+
+ std::cv_status waitStatus = wait();
+ while (waitStatus == std::cv_status::no_timeout &&
+ usb_role_switch_done == false)
+ waitStatus = wait();
+
+ EXPECT_EQ(std::cv_status::no_timeout, waitStatus);
+ EXPECT_EQ(2, usb_last_cookie);
+
+ EXPECT_EQ(static_cast<uint32_t>(PortRoleType::MODE),
+ static_cast<uint32_t>(usb_last_port_role.type));
+ if (usb_last_status == Status::SUCCESS) {
+ EXPECT_EQ(static_cast<uint32_t>(PortMode::DFP),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ } else {
+ EXPECT_NE(static_cast<uint32_t>(PortMode::UFP),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ }
+ }
+}
+
+/*
+ * Test switching the power role of usb port.
+ * Test case queries the usb ports present in device.
+ * If there is atleast one usb port, a power role switch
+ * to SOURCE is attempted for the port.
+ * The callback parametes are checked to see if the power role
+ * switch was successfull. Upon success, Status::SUCCESS
+ * is expected to be returned.
+ */
+
+TEST_F(UsbHidlTest, switchPowerRole) {
+ struct PortRole role;
+ role.type = PortRoleType::POWER_ROLE;
+ role.role = static_cast<uint32_t>(PortPowerRole::SOURCE);
+
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(2, usb_last_cookie);
+
+ if (!usb_last_port_status.portName.empty()) {
+ hidl_string portBeingSwitched = usb_last_port_status.portName;
+ ALOGI("switchPower role portname:%s", portBeingSwitched.c_str());
+ usb_role_switch_done = false;
+ Return<void> ret = usb->switchRole(portBeingSwitched.c_str(), role);
+ ASSERT_TRUE(ret.isOk());
+
+ std::cv_status waitStatus = wait();
+ while (waitStatus == std::cv_status::no_timeout &&
+ usb_role_switch_done == false)
+ waitStatus = wait();
+
+ EXPECT_EQ(std::cv_status::no_timeout, waitStatus);
+ EXPECT_EQ(2, usb_last_cookie);
+
+ EXPECT_EQ(static_cast<uint32_t>(PortRoleType::POWER_ROLE),
+ static_cast<uint32_t>(usb_last_port_role.type));
+ if (usb_last_status == Status::SUCCESS) {
+ EXPECT_EQ(static_cast<uint32_t>(PortPowerRole::SOURCE),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ } else {
+ EXPECT_NE(static_cast<uint32_t>(PortPowerRole::SINK),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ }
+ }
+}
+
+/*
+ * Test switching the data role of usb port.
+ * Test case queries the usb ports present in device.
+ * If there is atleast one usb port, a power role switch
+ * to HOST is attempted for the port.
+ * The callback parametes are checked to see if the power role
+ * switch was successfull. Upon success, Status::SUCCESS
+ * is expected to be returned.
+ */
+TEST_F(UsbHidlTest, switchDataRole) {
+ struct PortRole role;
+ role.type = PortRoleType::DATA_ROLE;
+ role.role = static_cast<uint32_t>(PortDataRole::HOST);
+
+ Return<void> ret = usb->queryPortStatus();
+ ASSERT_TRUE(ret.isOk());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(2, usb_last_cookie);
+
+ if (!usb_last_port_status.portName.empty()) {
+ hidl_string portBeingSwitched = usb_last_port_status.portName;
+ ALOGI("portname:%s", portBeingSwitched.c_str());
+ usb_role_switch_done = false;
+ Return<void> ret = usb->switchRole(portBeingSwitched.c_str(), role);
+ ASSERT_TRUE(ret.isOk());
+
+ std::cv_status waitStatus = wait();
+ while (waitStatus == std::cv_status::no_timeout &&
+ usb_role_switch_done == false)
+ waitStatus = wait();
+
+ EXPECT_EQ(std::cv_status::no_timeout, waitStatus);
+ EXPECT_EQ(2, usb_last_cookie);
+
+ EXPECT_EQ(static_cast<uint32_t>(PortRoleType::DATA_ROLE),
+ static_cast<uint32_t>(usb_last_port_role.type));
+ if (usb_last_status == Status::SUCCESS) {
+ EXPECT_EQ(static_cast<uint32_t>(PortDataRole::HOST),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ } else {
+ EXPECT_NE(static_cast<uint32_t>(PortDataRole::DEVICE),
+ static_cast<uint32_t>(usb_last_port_role.role));
+ }
+ }
+}
+
+int main(int argc, char** argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ ALOGI("Test result = %d", status);
+ return status;
+}
diff --git a/usb/Android.bp b/usb/Android.bp
index bbb3e4b..33f70eb 100644
--- a/usb/Android.bp
+++ b/usb/Android.bp
@@ -1,4 +1,5 @@
// This is an autogenerated file, do not edit.
subdirs = [
"1.0",
+ "1.0/vts/functional",
]
diff --git a/wifi/1.0/IWifiNanIfaceEventCallback.hal b/wifi/1.0/IWifiNanIfaceEventCallback.hal
index 80d67ce..dd956d6 100644
--- a/wifi/1.0/IWifiNanIfaceEventCallback.hal
+++ b/wifi/1.0/IWifiNanIfaceEventCallback.hal
@@ -141,6 +141,7 @@
* |NanStatusType.INTERNAL_FAILURE|
* |NanStatusType.INVALID_SESSION_ID|
* |NanStatusType.INVALID_PEER_ID|
+ * |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
*/
oneway notifyTransmitFollowupResponse(CommandIdShort id, WifiNanStatus status);
@@ -281,8 +282,9 @@
*
* @param cmdId command Id corresponding to the original |transmitFollowupRequest| request.
* @param status WifiNanStatus of the operation. Possible status codes are:
+ * |NanStatusType.SUCCESS|
* |NanStatusType.NO_OTA_ACK|
- * |NanStatusType.FOLLOWUP_TX_QUEUE_FULL|
+ * |NanStatusType.PROTOCOL_FAILURE|
*/
oneway eventTransmitFollowup(CommandIdShort id, WifiNanStatus status);
diff --git a/wifi/1.0/default/hidl_callback_util.h b/wifi/1.0/default/hidl_callback_util.h
new file mode 100644
index 0000000..a1c6819
--- /dev/null
+++ b/wifi/1.0/default/hidl_callback_util.h
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ */
+
+#ifndef HIDL_CALLBACK_UTIL_H_
+#define HIDL_CALLBACK_UTIL_H_
+
+#include <set>
+
+#include <hidl/HidlSupport.h>
+
+namespace {
+// Type of callback invoked by the death handler.
+using on_death_cb_function = std::function<void(uint64_t)>;
+
+// Private class used to keep track of death of individual
+// callbacks stored in HidlCallbackHandler.
+template <typename CallbackType>
+class HidlDeathHandler : public android::hardware::hidl_death_recipient {
+ public:
+ HidlDeathHandler(const on_death_cb_function& user_cb_function)
+ : cb_function_(user_cb_function) {}
+ ~HidlDeathHandler() = default;
+
+ // Death notification for callbacks.
+ void serviceDied(
+ uint64_t cookie,
+ const android::wp<android::hidl::base::V1_0::IBase>& /* who */) override {
+ cb_function_(cookie);
+ }
+
+ private:
+ on_death_cb_function cb_function_;
+
+ DISALLOW_COPY_AND_ASSIGN(HidlDeathHandler);
+};
+} // namespace
+
+namespace android {
+namespace hardware {
+namespace wifi {
+namespace V1_0 {
+namespace implementation {
+namespace hidl_callback_util {
+template <typename CallbackType>
+// Provides a class to manage callbacks for the various HIDL interfaces and
+// handle the death of the process hosting each callback.
+class HidlCallbackHandler {
+ public:
+ HidlCallbackHandler()
+ : death_handler_(new HidlDeathHandler<CallbackType>(
+ std::bind(&HidlCallbackHandler::onObjectDeath,
+ this,
+ std::placeholders::_1))) {}
+ ~HidlCallbackHandler() = default;
+
+ bool addCallback(const sp<CallbackType>& cb) {
+ // TODO(b/33818800): Can't compare proxies yet. So, use the cookie
+ // (callback proxy's raw pointer) to track the death of individual clients.
+ uint64_t cookie = reinterpret_cast<uint64_t>(cb.get());
+ if (cb_set_.find(cb) != cb_set_.end()) {
+ LOG(WARNING) << "Duplicate death notification registration";
+ return true;
+ }
+ if (!cb->linkToDeath(death_handler_, cookie)) {
+ LOG(ERROR) << "Failed to register death notification";
+ return false;
+ }
+ cb_set_.insert(cb);
+ return true;
+ }
+
+ const std::set<android::sp<CallbackType>> getCallbacks() {
+ return cb_set_;
+ }
+
+ // Death notification for callbacks.
+ void onObjectDeath(uint64_t cookie) {
+ CallbackType *cb = reinterpret_cast<CallbackType*>(cookie);
+ const auto& iter = cb_set_.find(cb);
+ if (iter == cb_set_.end()) {
+ LOG(ERROR) << "Unknown callback death notification received";
+ return;
+ }
+ cb_set_.erase(iter);
+ LOG(DEBUG) << "Dead callback removed from list";
+ }
+
+ void invalidate() {
+ for (const sp<CallbackType>& cb : cb_set_) {
+ if (!cb->unlinkToDeath(death_handler_)) {
+ LOG(ERROR) << "Failed to deregister death notification";
+ }
+ }
+ cb_set_.clear();
+ }
+
+ private:
+ std::set<sp<CallbackType>> cb_set_;
+ sp<HidlDeathHandler<CallbackType>> death_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(HidlCallbackHandler);
+};
+
+} // namespace hidl_callback_util
+} // namespace implementation
+} // namespace V1_0
+} // namespace wifi
+} // namespace hardware
+} // namespace android
+#endif // HIDL_CALLBACK_UTIL_H_
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index e57919d..7dbc8eb 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -134,6 +134,7 @@
return false;
}
hidl_status->ringName = reinterpret_cast<const char*>(legacy_status.name);
+ hidl_status->flags = 0;
for (const auto flag : {WIFI_RING_BUFFER_FLAG_HAS_BINARY_ENTRIES,
WIFI_RING_BUFFER_FLAG_HAS_ASCII_ENTRIES}) {
if (flag & legacy_status.flags) {
@@ -457,6 +458,7 @@
if (!hidl_scan_data) {
return false;
}
+ hidl_scan_data->flags = 0;
for (const auto flag : {legacy_hal::WIFI_SCAN_FLAG_INTERRUPTED}) {
if (legacy_cached_scan_result.flags & flag) {
hidl_scan_data->flags |=
@@ -793,9 +795,6 @@
legacy_request->config_disc_mac_addr_randomization = 1;
legacy_request->disc_mac_addr_rand_interval_sec =
hidl_request.configParams.macAddressRandomizationIntervalSec;
- legacy_request->config_responder_auto_response = 1;
- legacy_request->ranging_auto_response_cfg = hidl_request.configParams.acceptRangingRequests ?
- legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
legacy_request->config_2dot4g_rssi_close = 1;
if (hidl_request.configParams.bandSpecificConfig.size() != 2) {
LOG(ERROR) << "convertHidlNanEnableRequestToLegacy: bandSpecificConfig.size() != 2";
@@ -918,7 +917,15 @@
memcpy(legacy_request->service_specific_info,
hidl_request.baseConfigs.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
- // TODO: b/35193423 add support for extended service specific info
+ legacy_request->sdea_service_specific_info_len =
+ hidl_request.baseConfigs.extendedServiceSpecificInfo.size();
+ if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: sdea_service_specific_info_len too large";
+ return false;
+ }
+ memcpy(legacy_request->sdea_service_specific_info,
+ hidl_request.baseConfigs.extendedServiceSpecificInfo.data(),
+ legacy_request->sdea_service_specific_info_len);
legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: rx_match_filter_len too large";
@@ -961,6 +968,9 @@
hidl_request.baseConfigs.configRangingIndications;
legacy_request->ranging_cfg.distance_ingress_cm = hidl_request.baseConfigs.distanceIngressCm;
legacy_request->ranging_cfg.distance_egress_cm = hidl_request.baseConfigs.distanceEgressCm;
+ legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
+ legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
+ legacy_request->range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
legacy_request->publish_type = (legacy_hal::NanPublishType) hidl_request.publishType;
legacy_request->tx_type = (legacy_hal::NanTxType) hidl_request.txType;
@@ -997,7 +1007,16 @@
memcpy(legacy_request->service_specific_info,
hidl_request.baseConfigs.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
- // TODO: b/35193423 add support for extended service specific info
+ legacy_request->sdea_service_specific_info_len =
+ hidl_request.baseConfigs.extendedServiceSpecificInfo.size();
+ if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
+ LOG(ERROR) <<
+ "convertHidlNanSubscribeRequestToLegacy: sdea_service_specific_info_len too large";
+ return false;
+ }
+ memcpy(legacy_request->sdea_service_specific_info,
+ hidl_request.baseConfigs.extendedServiceSpecificInfo.data(),
+ legacy_request->sdea_service_specific_info_len);
legacy_request->rx_match_filter_len = hidl_request.baseConfigs.rxMatchFilter.size();
if (legacy_request->rx_match_filter_len > NAN_MAX_MATCH_FILTER_LEN) {
LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: rx_match_filter_len too large";
@@ -1040,6 +1059,9 @@
hidl_request.baseConfigs.configRangingIndications;
legacy_request->ranging_cfg.distance_ingress_cm = hidl_request.baseConfigs.distanceIngressCm;
legacy_request->ranging_cfg.distance_egress_cm = hidl_request.baseConfigs.distanceEgressCm;
+ legacy_request->ranging_auto_response = hidl_request.baseConfigs.rangingRequired ?
+ legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
+ legacy_request->range_report = legacy_hal::NAN_DISABLE_RANGE_REPORT;
legacy_request->subscribe_type = (legacy_hal::NanSubscribeType) hidl_request.subscribeType;
legacy_request->serviceResponseFilter = (legacy_hal::NanSRFType) hidl_request.srfType;
legacy_request->serviceResponseInclude = hidl_request.srfRespondIfInAddressSet ?
@@ -1078,13 +1100,22 @@
legacy_hal::NAN_TRANSMIT_IN_DW : legacy_hal::NAN_TRANSMIT_IN_FAW;
legacy_request->service_specific_info_len = hidl_request.serviceSpecificInfo.size();
if (legacy_request->service_specific_info_len > NAN_MAX_SERVICE_SPECIFIC_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanTransmitFollowupRequestToLegacy: service_specific_info_len too large";
+ LOG(ERROR) <<
+ "convertHidlNanTransmitFollowupRequestToLegacy: service_specific_info_len too large";
return false;
}
memcpy(legacy_request->service_specific_info,
hidl_request.serviceSpecificInfo.data(),
legacy_request->service_specific_info_len);
- // TODO: b/35193423 add support for extended service specific info
+ legacy_request->sdea_service_specific_info_len = hidl_request.extendedServiceSpecificInfo.size();
+ if (legacy_request->sdea_service_specific_info_len > NAN_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN) {
+ LOG(ERROR) <<
+ "convertHidlNanTransmitFollowupRequestToLegacy: sdea_service_specific_info_len too large";
+ return false;
+ }
+ memcpy(legacy_request->sdea_service_specific_info,
+ hidl_request.extendedServiceSpecificInfo.data(),
+ legacy_request->sdea_service_specific_info_len);
legacy_request->recv_indication_cfg = hidl_request.disableFollowupResultIndication ? 0x1 : 0x0;
return true;
@@ -1121,9 +1152,6 @@
legacy_request->config_disc_mac_addr_randomization = 1;
legacy_request->disc_mac_addr_rand_interval_sec =
hidl_request.macAddressRandomizationIntervalSec;
- legacy_request->config_responder_auto_response = 1;
- legacy_request->ranging_auto_response_cfg = hidl_request.acceptRangingRequests ?
- legacy_hal::NAN_RANGING_AUTO_RESPONSE_ENABLE : legacy_hal::NAN_RANGING_AUTO_RESPONSE_DISABLE;
/* TODO : missing
legacy_request->config_2dot4g_rssi_close = 1;
legacy_request->rssi_close_2dot4g_val =
@@ -1277,14 +1305,13 @@
hidl_response->maxMatchFilterLen = legacy_response.max_match_filter_len;
hidl_response->maxTotalMatchFilterLen = legacy_response.max_total_match_filter_len;
hidl_response->maxServiceSpecificInfoLen = legacy_response.max_service_specific_info_len;
- // TODO: b/35193423 add support for extended service specific info
- hidl_response->maxExtendedServiceSpecificInfoLen = 0;
+ hidl_response->maxExtendedServiceSpecificInfoLen =
+ legacy_response.max_sdea_service_specific_info_len;
hidl_response->maxNdiInterfaces = legacy_response.max_ndi_interfaces;
hidl_response->maxNdpSessions = legacy_response.max_ndp_sessions;
hidl_response->maxAppInfoLen = legacy_response.max_app_info_len;
hidl_response->maxQueuedTransmitFollowupMsgs = legacy_response.max_queued_transmit_followup_msgs;
- // TODO: b/34059183 to add to underlying HAL
- hidl_response->maxSubscribeInterfaceAddresses = NAN_MAX_SUBSCRIBE_MAX_ADDRESS;
+ hidl_response->maxSubscribeInterfaceAddresses = legacy_response.max_subscribe_address;
hidl_response->supportedCipherSuites = legacy_response.cipher_suites_supported;
return true;
@@ -1302,7 +1329,9 @@
hidl_ind->addr = hidl_array<uint8_t, 6>(legacy_ind.addr);
hidl_ind->serviceSpecificInfo = std::vector<uint8_t>(legacy_ind.service_specific_info,
legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
- // TODO: b/35193423 add support for extended service specific info
+ hidl_ind->extendedServiceSpecificInfo = std::vector<uint8_t>(
+ legacy_ind.sdea_service_specific_info,
+ legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len);
hidl_ind->matchFilter = std::vector<uint8_t>(legacy_ind.sdf_match_filter,
legacy_ind.sdf_match_filter + legacy_ind.sdf_match_filter_len);
hidl_ind->matchOccuredInBeaconFlag = legacy_ind.match_occured_flag == 1;
@@ -1313,8 +1342,8 @@
legacy_ind.peer_sdea_params.security_cfg == legacy_hal::NAN_DP_CONFIG_SECURITY;
hidl_ind->peerRequiresRanging =
legacy_ind.peer_sdea_params.ranging_state == legacy_hal::NAN_RANGING_ENABLE;
- hidl_ind->rangingMeasurementInCm = legacy_ind.range_result.range_measurement_cm;
- hidl_ind->rangingIndicationType = legacy_ind.range_result.ranging_event_type;
+ hidl_ind->rangingMeasurementInCm = legacy_ind.range_info.range_measurement_cm;
+ hidl_ind->rangingIndicationType = legacy_ind.range_info.ranging_event_type;
return true;
}
@@ -1332,6 +1361,9 @@
hidl_ind->receivedInFaw = legacy_ind.dw_or_faw == 1;
hidl_ind->serviceSpecificInfo = std::vector<uint8_t>(legacy_ind.service_specific_info,
legacy_ind.service_specific_info + legacy_ind.service_specific_info_len);
+ hidl_ind->extendedServiceSpecificInfo = std::vector<uint8_t>(
+ legacy_ind.sdea_service_specific_info,
+ legacy_ind.sdea_service_specific_info + legacy_ind.sdea_service_specific_info_len);
return true;
}
@@ -1749,6 +1781,7 @@
hidl_capabilities->lcrSupported = legacy_capabilities.lcr_support;
hidl_capabilities->responderSupported =
legacy_capabilities.responder_supported;
+ hidl_capabilities->preambleSupport = 0;
for (const auto flag : {legacy_hal::WIFI_RTT_PREAMBLE_LEGACY,
legacy_hal::WIFI_RTT_PREAMBLE_HT,
legacy_hal::WIFI_RTT_PREAMBLE_VHT}) {
@@ -1758,6 +1791,7 @@
convertLegacyRttPreambleToHidl(flag));
}
}
+ hidl_capabilities->bwSupport = 0;
for (const auto flag : {legacy_hal::WIFI_RTT_BW_5,
legacy_hal::WIFI_RTT_BW_10,
legacy_hal::WIFI_RTT_BW_20,
diff --git a/wifi/1.0/default/wifi.cpp b/wifi/1.0/default/wifi.cpp
index 8feb836..3d482b4 100644
--- a/wifi/1.0/default/wifi.cpp
+++ b/wifi/1.0/default/wifi.cpp
@@ -85,8 +85,9 @@
WifiStatus Wifi::registerEventCallbackInternal(
const sp<IWifiEventCallback>& event_callback) {
- // TODO(b/31632518): remove the callback when the client is destroyed
- event_callbacks_.emplace_back(event_callback);
+ if (!event_cb_handler_.addCallback(event_callback)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
return createWifiStatus(WifiStatusCode::SUCCESS);
}
@@ -102,13 +103,13 @@
// Create the chip instance once the HAL is started.
chip_ = new WifiChip(kChipId, legacy_hal_, mode_controller_);
run_state_ = RunState::STARTED;
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onStart().isOk()) {
LOG(ERROR) << "Failed to invoke onStart callback";
};
}
} else {
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onFailure(wifi_status).isOk()) {
LOG(ERROR) << "Failed to invoke onFailure callback";
}
@@ -126,13 +127,13 @@
}
WifiStatus wifi_status = stopLegacyHalAndDeinitializeModeController();
if (wifi_status.code == WifiStatusCode::SUCCESS) {
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onStop().isOk()) {
LOG(ERROR) << "Failed to invoke onStop callback";
};
}
} else {
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onFailure(wifi_status).isOk()) {
LOG(ERROR) << "Failed to invoke onFailure callback";
}
diff --git a/wifi/1.0/default/wifi.h b/wifi/1.0/default/wifi.h
index 40d3552..c6fa84c 100644
--- a/wifi/1.0/default/wifi.h
+++ b/wifi/1.0/default/wifi.h
@@ -23,6 +23,7 @@
#include <android/hardware/wifi/1.0/IWifi.h>
#include <utils/Looper.h>
+#include "hidl_callback_util.h"
#include "wifi_chip.h"
#include "wifi_legacy_hal.h"
#include "wifi_mode_controller.h"
@@ -71,8 +72,8 @@
std::shared_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::shared_ptr<mode_controller::WifiModeController> mode_controller_;
RunState run_state_;
- std::vector<sp<IWifiEventCallback>> event_callbacks_;
sp<WifiChip> chip_;
+ hidl_callback_util::HidlCallbackHandler<IWifiEventCallback> event_cb_handler_;
DISALLOW_COPY_AND_ASSIGN(Wifi);
};
diff --git a/wifi/1.0/default/wifi_chip.cpp b/wifi/1.0/default/wifi_chip.cpp
index 0e2d54e..6aeedf8 100644
--- a/wifi/1.0/default/wifi_chip.cpp
+++ b/wifi/1.0/default/wifi_chip.cpp
@@ -63,7 +63,7 @@
void WifiChip::invalidate() {
invalidateAndRemoveAllIfaces();
legacy_hal_.reset();
- event_callbacks_.clear();
+ event_cb_handler_.invalidate();
is_valid_ = false;
}
@@ -71,8 +71,8 @@
return is_valid_;
}
-std::vector<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() {
- return event_callbacks_;
+std::set<sp<IWifiChipEventCallback>> WifiChip::getEventCallbacks() {
+ return event_cb_handler_.getCallbacks();
}
Return<void> WifiChip::getId(getId_cb hidl_status_cb) {
@@ -353,8 +353,9 @@
WifiStatus WifiChip::registerEventCallbackInternal(
const sp<IWifiChipEventCallback>& event_callback) {
- // TODO(b/31632518): remove the callback when the client is destroyed
- event_callbacks_.emplace_back(event_callback);
+ if (!event_cb_handler_.addCallback(event_callback)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
return createWifiStatus(WifiStatusCode::SUCCESS);
}
@@ -414,14 +415,14 @@
}
WifiStatus status = handleChipConfiguration(mode_id);
if (status.code != WifiStatusCode::SUCCESS) {
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onChipReconfigureFailure(status).isOk()) {
LOG(ERROR) << "Failed to invoke onChipReconfigureFailure callback";
}
}
return status;
}
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onChipReconfigured(mode_id).isOk()) {
LOG(ERROR) << "Failed to invoke onChipReconfigured callback";
}
@@ -503,7 +504,7 @@
}
std::string ifname = legacy_hal_.lock()->getApIfaceName();
ap_iface_ = new WifiApIface(ifname, legacy_hal_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceAdded(IfaceType::AP, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
}
@@ -533,7 +534,7 @@
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
invalidateAndClear(ap_iface_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceRemoved(IfaceType::AP, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
}
@@ -549,7 +550,7 @@
}
std::string ifname = legacy_hal_.lock()->getNanIfaceName();
nan_iface_ = new WifiNanIface(ifname, legacy_hal_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceAdded(IfaceType::NAN, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
}
@@ -579,7 +580,7 @@
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
invalidateAndClear(nan_iface_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceRemoved(IfaceType::NAN, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
}
@@ -595,7 +596,7 @@
}
std::string ifname = legacy_hal_.lock()->getP2pIfaceName();
p2p_iface_ = new WifiP2pIface(ifname, legacy_hal_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceAdded(IfaceType::P2P, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
}
@@ -625,7 +626,7 @@
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
invalidateAndClear(p2p_iface_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceRemoved(IfaceType::P2P, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
}
@@ -639,7 +640,7 @@
}
std::string ifname = legacy_hal_.lock()->getStaIfaceName();
sta_iface_ = new WifiStaIface(ifname, legacy_hal_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceAdded(IfaceType::STA, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceAdded callback";
}
@@ -669,7 +670,7 @@
return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
}
invalidateAndClear(sta_iface_);
- for (const auto& callback : event_callbacks_) {
+ for (const auto& callback : event_cb_handler_.getCallbacks()) {
if (!callback->onIfaceRemoved(IfaceType::STA, ifname).isOk()) {
LOG(ERROR) << "Failed to invoke onIfaceRemoved callback";
}
diff --git a/wifi/1.0/default/wifi_chip.h b/wifi/1.0/default/wifi_chip.h
index 938b180..e1c2344 100644
--- a/wifi/1.0/default/wifi_chip.h
+++ b/wifi/1.0/default/wifi_chip.h
@@ -22,6 +22,7 @@
#include <android-base/macros.h>
#include <android/hardware/wifi/1.0/IWifiChip.h>
+#include "hidl_callback_util.h"
#include "wifi_ap_iface.h"
#include "wifi_legacy_hal.h"
#include "wifi_mode_controller.h"
@@ -62,7 +63,7 @@
// valid before processing them.
void invalidate();
bool isValid();
- std::vector<sp<IWifiChipEventCallback>> getEventCallbacks();
+ std::set<sp<IWifiChipEventCallback>> getEventCallbacks();
// HIDL methods exposed.
Return<void> getId(getId_cb hidl_status_cb) override;
@@ -179,7 +180,6 @@
ChipId chip_id_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
std::weak_ptr<mode_controller::WifiModeController> mode_controller_;
- std::vector<sp<IWifiChipEventCallback>> event_callbacks_;
sp<WifiApIface> ap_iface_;
sp<WifiNanIface> nan_iface_;
sp<WifiP2pIface> p2p_iface_;
@@ -191,6 +191,8 @@
// registration mechanism. Use this to check if we have already
// registered a callback.
bool debug_ring_buffer_cb_registered_;
+ hidl_callback_util::HidlCallbackHandler<IWifiChipEventCallback>
+ event_cb_handler_;
DISALLOW_COPY_AND_ASSIGN(WifiChip);
};
diff --git a/wifi/1.0/default/wifi_legacy_hal.cpp b/wifi/1.0/default/wifi_legacy_hal.cpp
index cd89acc..7d58254 100644
--- a/wifi/1.0/default/wifi_legacy_hal.cpp
+++ b/wifi/1.0/default/wifi_legacy_hal.cpp
@@ -289,6 +289,24 @@
on_nan_event_transmit_follow_up_user_callback(*event);
}
}
+
+std::function<void(const NanRangeRequestInd&)>
+ on_nan_event_range_request_user_callback;
+void onAysncNanEventRangeRequest(NanRangeRequestInd* event) {
+ const auto lock = hidl_sync_util::acquireGlobalLock();
+ if (on_nan_event_range_request_user_callback && event) {
+ on_nan_event_range_request_user_callback(*event);
+ }
+}
+
+std::function<void(const NanRangeReportInd&)>
+ on_nan_event_range_report_user_callback;
+void onAysncNanEventRangeReport(NanRangeReportInd* event) {
+ const auto lock = hidl_sync_util::acquireGlobalLock();
+ if (on_nan_event_range_report_user_callback && event) {
+ on_nan_event_range_report_user_callback(*event);
+ }
+}
// End of the free-standing "C" style callbacks.
WifiLegacyHal::WifiLegacyHal()
@@ -1023,6 +1041,10 @@
user_callbacks.on_event_data_path_end;
on_nan_event_transmit_follow_up_user_callback =
user_callbacks.on_event_transmit_follow_up;
+ on_nan_event_range_request_user_callback =
+ user_callbacks.on_event_range_request;
+ on_nan_event_range_report_user_callback =
+ user_callbacks.on_event_range_report;
return global_func_table_.wifi_nan_register_handler(
wlan_interface_handle_,
@@ -1039,7 +1061,9 @@
onAysncNanEventDataPathRequest,
onAysncNanEventDataPathConfirm,
onAysncNanEventDataPathEnd,
- onAysncNanEventTransmitFollowUp});
+ onAysncNanEventTransmitFollowUp,
+ onAysncNanEventRangeRequest,
+ onAysncNanEventRangeReport});
}
wifi_error WifiLegacyHal::nanEnableRequest(transaction_id id,
@@ -1261,6 +1285,8 @@
on_nan_event_data_path_confirm_user_callback = nullptr;
on_nan_event_data_path_end_user_callback = nullptr;
on_nan_event_transmit_follow_up_user_callback = nullptr;
+ on_nan_event_range_request_user_callback = nullptr;
+ on_nan_event_range_report_user_callback = nullptr;
}
} // namespace legacy_hal
diff --git a/wifi/1.0/default/wifi_legacy_hal.h b/wifi/1.0/default/wifi_legacy_hal.h
index e65b79b..ed020b0 100644
--- a/wifi/1.0/default/wifi_legacy_hal.h
+++ b/wifi/1.0/default/wifi_legacy_hal.h
@@ -89,6 +89,10 @@
std::function<void(const NanDataPathEndInd&)> on_event_data_path_end;
std::function<void(const NanTransmitFollowupInd&)>
on_event_transmit_follow_up;
+ std::function<void(const NanRangeRequestInd&)>
+ on_event_range_request;
+ std::function<void(const NanRangeReportInd&)>
+ on_event_range_report;
};
// Full scan results contain IE info and are hence passed by reference, to
diff --git a/wifi/1.0/default/wifi_nan_iface.cpp b/wifi/1.0/default/wifi_nan_iface.cpp
index 8d76f91..68be2a7 100644
--- a/wifi/1.0/default/wifi_nan_iface.cpp
+++ b/wifi/1.0/default/wifi_nan_iface.cpp
@@ -55,7 +55,7 @@
switch (msg.response_type) {
case legacy_hal::NAN_RESPONSE_ENABLED: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyEnableResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -63,7 +63,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_DISABLED: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyDisableResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -71,7 +71,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_PUBLISH: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyStartPublishResponse(id, wifiNanStatus,
msg.body.publish_response.publish_id).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -80,7 +80,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_PUBLISH_CANCEL: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyStopPublishResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -88,7 +88,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_TRANSMIT_FOLLOWUP: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyTransmitFollowupResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -96,7 +96,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_SUBSCRIBE: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyStartSubscribeResponse(id, wifiNanStatus,
msg.body.subscribe_response.subscribe_id).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -105,7 +105,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_SUBSCRIBE_CANCEL: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyStopSubscribeResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -113,7 +113,7 @@
break;
}
case legacy_hal::NAN_RESPONSE_CONFIG: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyConfigResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -127,7 +127,7 @@
LOG(ERROR) << "Failed to convert nan capabilities response";
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyCapabilitiesResponse(id, wifiNanStatus,
hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -136,7 +136,7 @@
break;
}
case legacy_hal::NAN_DP_INTERFACE_CREATE: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyCreateDataInterfaceResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -144,7 +144,7 @@
break;
}
case legacy_hal::NAN_DP_INTERFACE_DELETE: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyDeleteDataInterfaceResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -152,7 +152,7 @@
break;
}
case legacy_hal::NAN_DP_INITIATOR_RESPONSE: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyInitiateDataPathResponse(id, wifiNanStatus,
msg.body.data_request_response.ndp_instance_id).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -161,14 +161,14 @@
break;
}
case legacy_hal::NAN_DP_RESPONDER_RESPONSE: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyRespondToDataPathIndicationResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
}
}
case legacy_hal::NAN_DP_END: {
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->notifyTerminateDataPathResponse(id, wifiNanStatus).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -201,7 +201,7 @@
hidl_struct.eventType = (NanClusterEventType) msg.event_type;
hidl_struct.addr = msg.data.mac_addr.addr;
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventClusterEvent(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -219,7 +219,7 @@
status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
status.description = msg.nan_reason;
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventDisabled(status).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -237,7 +237,7 @@
status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
status.description = msg.nan_reason;
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventPublishTerminated(msg.publish_id, status).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -255,7 +255,7 @@
status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
status.description = msg.nan_reason;
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventSubscribeTerminated(msg.subscribe_id, status).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -276,7 +276,7 @@
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventMatch(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -290,7 +290,7 @@
LOG(ERROR) << "Callback invoked on an invalid object";
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventMatchExpired(msg.publish_subscribe_id,
msg.requestor_instance_id).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -312,7 +312,7 @@
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventFollowupReceived(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -330,7 +330,7 @@
status.status = hidl_struct_util::convertLegacyNanStatusTypeToHidl(msg.reason);
status.description = msg.nan_reason;
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventTransmitFollowup(msg.id, status).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -351,7 +351,7 @@
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventDataPathRequest(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -372,7 +372,7 @@
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
if (!callback->eventDataPathConfirm(hidl_struct).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
}
@@ -386,7 +386,7 @@
LOG(ERROR) << "Callback invoked on an invalid object";
return;
}
- for (const auto& callback : shared_ptr_this->event_callbacks_) {
+ for (const auto& callback : shared_ptr_this->getEventCallbacks()) {
for (int i = 0; i < msg.num_ndp_instances; ++i) {
if (!callback->eventDataPathTerminated(msg.ndp_instance_id[i]).isOk()) {
LOG(ERROR) << "Failed to invoke the callback";
@@ -400,6 +400,16 @@
LOG(ERROR) << "on_event_beacon_sdf_payload - should not be called";
};
+ callback_handlers.on_event_range_request = [weak_ptr_this](
+ const legacy_hal::NanRangeRequestInd& /* msg */) {
+ LOG(ERROR) << "on_event_range_request - should not be called";
+ };
+
+ callback_handlers.on_event_range_report = [weak_ptr_this](
+ const legacy_hal::NanRangeReportInd& /* msg */) {
+ LOG(ERROR) << "on_event_range_report - should not be called";
+ };
+
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->nanRegisterCallbackHandlers(callback_handlers);
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
@@ -410,7 +420,7 @@
void WifiNanIface::invalidate() {
legacy_hal_.reset();
- event_callbacks_.clear();
+ event_cb_handler_.invalidate();
is_valid_ = false;
}
@@ -418,6 +428,10 @@
return is_valid_;
}
+std::set<sp<IWifiNanIfaceEventCallback>> WifiNanIface::getEventCallbacks() {
+ return event_cb_handler_.getCallbacks();
+}
+
Return<void> WifiNanIface::getName(getName_cb hidl_status_cb) {
return validateAndCall(this,
WifiStatusCode::ERROR_WIFI_IFACE_INVALID,
@@ -609,11 +623,9 @@
WifiStatus WifiNanIface::registerEventCallbackInternal(
const sp<IWifiNanIfaceEventCallback>& callback) {
- // TODO(b/31632518): remove the callback when the client is destroyed and/or
- // make sure that the same callback is only registered once (i.e. detect duplicates)
- // OR: consider having a single listener - not clear why multiple listeners (managers) are
- // necessary, nor how they would coordinate (at least command IDs).
- event_callbacks_.emplace_back(callback);
+ if (!event_cb_handler_.addCallback(callback)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
return createWifiStatus(WifiStatusCode::SUCCESS);
}
diff --git a/wifi/1.0/default/wifi_nan_iface.h b/wifi/1.0/default/wifi_nan_iface.h
index d1da60e..e1edd29 100644
--- a/wifi/1.0/default/wifi_nan_iface.h
+++ b/wifi/1.0/default/wifi_nan_iface.h
@@ -21,6 +21,7 @@
#include <android/hardware/wifi/1.0/IWifiNanIface.h>
#include <android/hardware/wifi/1.0/IWifiNanIfaceEventCallback.h>
+#include "hidl_callback_util.h"
#include "wifi_legacy_hal.h"
namespace android {
@@ -119,10 +120,13 @@
WifiStatus terminateDataPathRequestInternal(
uint16_t cmd_id, uint32_t ndpInstanceId);
+ std::set<sp<IWifiNanIfaceEventCallback>> getEventCallbacks();
+
std::string ifname_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
- std::vector<sp<IWifiNanIfaceEventCallback>> event_callbacks_;
bool is_valid_;
+ hidl_callback_util::HidlCallbackHandler<IWifiNanIfaceEventCallback>
+ event_cb_handler_;
DISALLOW_COPY_AND_ASSIGN(WifiNanIface);
};
diff --git a/wifi/1.0/default/wifi_sta_iface.cpp b/wifi/1.0/default/wifi_sta_iface.cpp
index 6100334..55c9cf7 100644
--- a/wifi/1.0/default/wifi_sta_iface.cpp
+++ b/wifi/1.0/default/wifi_sta_iface.cpp
@@ -35,7 +35,7 @@
void WifiStaIface::invalidate() {
legacy_hal_.reset();
- event_callbacks_.clear();
+ event_cb_handler_.invalidate();
is_valid_ = false;
}
@@ -43,8 +43,8 @@
return is_valid_;
}
-std::vector<sp<IWifiStaIfaceEventCallback>> WifiStaIface::getEventCallbacks() {
- return event_callbacks_;
+std::set<sp<IWifiStaIfaceEventCallback>> WifiStaIface::getEventCallbacks() {
+ return event_cb_handler_.getCallbacks();
}
Return<void> WifiStaIface::getName(getName_cb hidl_status_cb) {
@@ -293,8 +293,9 @@
WifiStatus WifiStaIface::registerEventCallbackInternal(
const sp<IWifiStaIfaceEventCallback>& callback) {
- // TODO(b/31632518): remove the callback when the client is destroyed
- event_callbacks_.emplace_back(callback);
+ if (!event_cb_handler_.addCallback(callback)) {
+ return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+ }
return createWifiStatus(WifiStatusCode::SUCCESS);
}
@@ -570,7 +571,8 @@
return createWifiStatusFromLegacyError(legacy_status);
}
-WifiStatus WifiStaIface::setScanningMacOuiInternal(const std::array<uint8_t, 3>& oui) {
+WifiStatus WifiStaIface::setScanningMacOuiInternal(
+ const std::array<uint8_t, 3>& oui) {
legacy_hal::wifi_error legacy_status =
legacy_hal_.lock()->setScanningMacOui(oui);
return createWifiStatusFromLegacyError(legacy_status);
diff --git a/wifi/1.0/default/wifi_sta_iface.h b/wifi/1.0/default/wifi_sta_iface.h
index bc2d75f..5f0ffe9 100644
--- a/wifi/1.0/default/wifi_sta_iface.h
+++ b/wifi/1.0/default/wifi_sta_iface.h
@@ -21,6 +21,7 @@
#include <android/hardware/wifi/1.0/IWifiStaIface.h>
#include <android/hardware/wifi/1.0/IWifiStaIfaceEventCallback.h>
+#include "hidl_callback_util.h"
#include "wifi_legacy_hal.h"
namespace android {
@@ -39,7 +40,7 @@
// Refer to |WifiChip::invalidate()|.
void invalidate();
bool isValid();
- std::vector<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
+ std::set<sp<IWifiStaIfaceEventCallback>> getEventCallbacks();
// HIDL methods exposed.
Return<void> getName(getName_cb hidl_status_cb) override;
@@ -151,8 +152,9 @@
std::string ifname_;
std::weak_ptr<legacy_hal::WifiLegacyHal> legacy_hal_;
- std::vector<sp<IWifiStaIfaceEventCallback>> event_callbacks_;
bool is_valid_;
+ hidl_callback_util::HidlCallbackHandler<IWifiStaIfaceEventCallback>
+ event_cb_handler_;
DISALLOW_COPY_AND_ASSIGN(WifiStaIface);
};
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index 1c6d0e0..30e8943 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -844,11 +844,6 @@
*/
uint32_t macAddressRandomizationIntervalSec;
/**
- * Accept (if true) or not (if false) ranging requests from peers - whether in the context of
- * discovery or otherwise.
- */
- bool acceptRangingRequests;
- /**
* Additional configuration provided per band: indexed by |NanBandIndex|.
*/
NanBandSpecificConfig[2] bandSpecificConfig;
@@ -1014,7 +1009,22 @@
bool securityEnabledInNdp;
/**
* Specifies whether or not there is a ranging requirement in this discovery session.
- * Note that ranging is only performed if all other match criteria with the peer are met.
+ * Ranging is only performed if all other match criteria with the peer are met.
+ * Note: specifying that ranging is required also implies that this device must automatically
+ * accept ranging requests from peers.
+ * Solicited Publisher + Passive Subscriber:
+ * Publisher/Subscriber:
+ * true/true: ranging performed.
+ * true/false: subscriber doesn't require ranging (match if all other criteria met). I.e.
+ * publisher requiring range doesn't gate subscriber matching.
+ * false/true: subscriber tries ranging but publisher refuses (no match).
+ * false/false: ranging isn't attempted and doesn't impact match.
+ * Unsolicited Publisher + Active Subscriber:
+ * Publisher/Subscriber:
+ * true/true: ranging performed.
+ * true/false: publisher attempts ranging but subscriber doesn't allow - no match.
+ * false/true: publisher doesn't attempt ranging, should not impact match.
+ * false/false: ranging isn't attempted and doesn't impact match.
* NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Ranging Require.
*/
bool rangingRequired;
diff --git a/wifi/1.0/vts/functional/Android.bp b/wifi/1.0/vts/functional/Android.bp
index 8a5d7e0..01eeef5 100644
--- a/wifi/1.0/vts/functional/Android.bp
+++ b/wifi/1.0/vts/functional/Android.bp
@@ -15,10 +15,10 @@
//
cc_test {
- name: "wifi_hidl_test",
+ name: "VtsHalWifiV1_0TargetTest",
gtest: true,
srcs: [
- "main.cpp",
+ "VtsHalWifiV1_0TargetTest.cpp",
"wifi_ap_iface_hidl_test.cpp",
"wifi_chip_hidl_test.cpp",
"wifi_hidl_call_util_selftest.cpp",
diff --git a/wifi/1.0/vts/functional/main.cpp b/wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
similarity index 100%
rename from wifi/1.0/vts/functional/main.cpp
rename to wifi/1.0/vts/functional/VtsHalWifiV1_0TargetTest.cpp
diff --git a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
index 34237f0..dd1d1c4 100644
--- a/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
+++ b/wifi/supplicant/1.0/ISupplicantStaIfaceCallback.hal
@@ -214,45 +214,46 @@
* Used to indicate the result of ANQP (either for IEEE 802.11u Interworking
* or Hotspot 2.0) query.
*
- * @param macAddress MAC address of the access point.
+ * @param bssid BSSID of the access point.
* @param data ANQP data fetched from the access point.
* All the fields in this struct must be empty if the query failed.
* @param hs20Data ANQP data fetched from the Hotspot 2.0 access point.
* All the fields in this struct must be empty if the query failed.
*/
- oneway onAnqpQueryDone(MacAddress macAddress,
- AnqpData data,
- Hs20AnqpData hs20Data);
+ oneway onAnqpQueryDone(Bssid bssid, AnqpData data, Hs20AnqpData hs20Data);
/**
* Used to indicate the result of Hotspot 2.0 Icon query.
*
- * @param macAddress MAC address of the access point.
+ * @param bssid BSSID of the access point.
* @param fileName Name of the file that was requested.
* @param data Icon data fetched from the access point.
* Must be empty if the query failed.
*/
- oneway onHs20IconQueryDone(MacAddress macAddress,
- string fileName,
- vec<uint8_t> data);
+ oneway onHs20IconQueryDone(Bssid bssid, string fileName, vec<uint8_t> data);
/**
* Used to indicate a Hotspot 2.0 subscription remediation event.
*
+ * @param bssid BSSID of the access point.
* @param osuMethod OSU method.
* @param url URL of the server.
*/
- oneway onHs20SubscriptionRemediation(OsuMethod osuMethod, string url);
+ oneway onHs20SubscriptionRemediation(Bssid bssid,
+ OsuMethod osuMethod,
+ string url);
/**
* Used to indicate a Hotspot 2.0 imminent deauth notice.
*
+ * @param bssid BSSID of the access point.
* @param reasonCode Code to indicate the deauth reason.
* Refer to section 3.2.1.2 of the Hotspot 2.0 spec.
* @param reAuthDelayInSec Delay before reauthenticating.
* @param url URL of the server.
*/
- oneway onHs20DeauthImminentNotice(uint32_t reasonCode,
+ oneway onHs20DeauthImminentNotice(Bssid bssid,
+ uint32_t reasonCode,
uint32_t reAuthDelayInSec,
string url);
diff --git a/wifi/supplicant/1.0/vts/functional/Android.mk b/wifi/supplicant/1.0/vts/functional/Android.mk
index 8fa649f..52fecc2 100644
--- a/wifi/supplicant/1.0/vts/functional/Android.mk
+++ b/wifi/supplicant/1.0/vts/functional/Android.mk
@@ -16,10 +16,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_MODULE := supplicant_hidl_test
+LOCAL_MODULE := VtsHalWifiSupplicantV1_0TargetTest
LOCAL_CPPFLAGS := -Wall -Werror -Wextra
LOCAL_SRC_FILES := \
- main.cpp \
+ VtsHalWifiSupplicantV1_0TargetTest.cpp \
supplicant_hidl_test.cpp \
supplicant_hidl_test_utils.cpp \
supplicant_p2p_iface_hidl_test.cpp \
diff --git a/wifi/supplicant/1.0/vts/functional/main.cpp b/wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp
similarity index 100%
rename from wifi/supplicant/1.0/vts/functional/main.cpp
rename to wifi/supplicant/1.0/vts/functional/VtsHalWifiSupplicantV1_0TargetTest.cpp