Merge "Improved GNSS HAL VTS test coverage"
diff --git a/audio/2.0/default/StreamIn.cpp b/audio/2.0/default/StreamIn.cpp
index a8229d3..b641e82 100644
--- a/audio/2.0/default/StreamIn.cpp
+++ b/audio/2.0/default/StreamIn.cpp
@@ -103,7 +103,6 @@
// This implementation doesn't return control back to the Thread until it decides to stop,
// as the Thread uses mutexes, and this can lead to priority inversion.
while(!std::atomic_load_explicit(mStop, std::memory_order_acquire)) {
- // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
uint32_t efState = 0;
mEfGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL), &efState);
if (!(efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_FULL))) {
@@ -321,7 +320,6 @@
CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(), threadInfo);
return Void();
}
- // TODO: Remove event flag management once blocking MQ is implemented. b/33815422
status = EventFlag::createEventFlag(tempDataMQ->getEventFlagWord(), &mEfGroup);
if (status != OK || !mEfGroup) {
ALOGE("failed creating event flag for data MQ: %s", strerror(-status));
diff --git a/audio/2.0/default/StreamOut.cpp b/audio/2.0/default/StreamOut.cpp
index 6ccdbcd..d820f3c 100644
--- a/audio/2.0/default/StreamOut.cpp
+++ b/audio/2.0/default/StreamOut.cpp
@@ -101,7 +101,6 @@
// This implementation doesn't return control back to the Thread until it decides to stop,
// as the Thread uses mutexes, and this can lead to priority inversion.
while(!std::atomic_load_explicit(mStop, std::memory_order_acquire)) {
- // TODO: Remove manual event flag handling once blocking MQ is implemented. b/33815422
uint32_t efState = 0;
mEfGroup->wait(static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY), &efState);
if (!(efState & static_cast<uint32_t>(MessageQueueFlagBits::NOT_EMPTY))) {
@@ -304,7 +303,6 @@
CommandMQ::Descriptor(), DataMQ::Descriptor(), StatusMQ::Descriptor(), threadInfo);
return Void();
}
- // TODO: Remove event flag management once blocking MQ is implemented. b/33815422
status = EventFlag::createEventFlag(tempDataMQ->getEventFlagWord(), &mEfGroup);
if (status != OK || !mEfGroup) {
ALOGE("failed creating event flag for data MQ: %s", strerror(-status));
diff --git a/audio/common/2.0/types.hal b/audio/common/2.0/types.hal
index bad01fc..dd7281d 100644
--- a/audio/common/2.0/types.hal
+++ b/audio/common/2.0/types.hal
@@ -89,7 +89,6 @@
enum AudioStreamType : int32_t {
// These values must kept in sync with
// frameworks/base/media/java/android/media/AudioSystem.java
- // TODO: Synchronization should be done automatically by tools
DEFAULT = -1,
MIN = 0,
VOICE_CALL = 0,
@@ -169,10 +168,8 @@
OUTPUT_MIX = 0,
/*
* Application does not specify an explicit session ID to be used, and
- * requests a new session ID to be allocated TODO use unique values for
- * AUDIO_SESSION_OUTPUT_MIX and AUDIO_SESSION_ALLOCATE, after all uses have
- * been updated from 0 to the appropriate symbol, and have been tested.
- * Corresponds to AudioManager.AUDIO_SESSION_ID_GENERATE and
+ * requests a new session ID to be allocated. Corresponds to
+ * AudioManager.AUDIO_SESSION_ID_GENERATE and
* AudioSystem.AUDIO_SESSION_ALLOCATE.
*/
ALLOCATE = 0,
@@ -698,7 +695,6 @@
enum AudioUsage : int32_t {
// These values must kept in sync with
// frameworks/base/media/java/android/media/AudioAttributes.java
- // TODO: Synchronization should be done automatically by tools
UNKNOWN = 0,
MEDIA = 1,
VOICE_COMMUNICATION = 2,
diff --git a/audio/effect/2.0/IEffectBufferProviderCallback.hal b/audio/effect/2.0/IEffectBufferProviderCallback.hal
index 545e2e5..53f4d6e 100644
--- a/audio/effect/2.0/IEffectBufferProviderCallback.hal
+++ b/audio/effect/2.0/IEffectBufferProviderCallback.hal
@@ -27,7 +27,6 @@
*
* @return buffer audio buffer for processing
*/
- // TODO(mnaganov): replace with FMQ version.
getBuffer() generates (AudioBuffer buffer);
/*
@@ -35,6 +34,5 @@
*
* @param buffer audio buffer for processing
*/
- // TODO(mnaganov): replace with FMQ version.
putBuffer(AudioBuffer buffer);
};
diff --git a/audio/effect/2.0/default/Effect.cpp b/audio/effect/2.0/default/Effect.cpp
index 6704239..2d36604 100644
--- a/audio/effect/2.0/default/Effect.cpp
+++ b/audio/effect/2.0/default/Effect.cpp
@@ -205,7 +205,7 @@
halConfig->buffer.raw = NULL;
halConfig->samplingRate = config.samplingRateHz;
halConfig->channels = static_cast<uint32_t>(config.channels);
- // TODO(mnaganov): The framework code currently does not use BP, implement later.
+ // Note: The framework code does not use BP.
halConfig->bufferProvider.cookie = NULL;
halConfig->bufferProvider.getBuffer = NULL;
halConfig->bufferProvider.releaseBuffer = NULL;
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
index e6a3e56..03a65f3 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
@@ -104,7 +104,7 @@
for (auto& prop : mProps) {
emulator::VehiclePropValue* protoVal = respMsg.add_value();
- populateProtoVehiclePropValue(protoVal, prop.second.get());
+ populateProtoVehiclePropValue(protoVal, prop.second->get());
}
}
}
@@ -175,7 +175,7 @@
auto prop = mProps.find(std::make_pair(propId, areaId));
if (prop != mProps.end()) {
- return prop->second.get();
+ return prop->second->get();
}
ALOGW("%s: Property not found: propId = 0x%x, areaId = 0x%x", __func__, propId, areaId);
return nullptr;
@@ -530,6 +530,13 @@
return status;
}
+V2_0::StatusCode DefaultVehicleHal::addCustomProperty(int32_t property,
+ std::unique_ptr<CustomVehiclePropertyHandler>&& handler) {
+ mProps[std::make_pair(property, 0)] = std::move(handler);
+ ALOGW("%s: Added custom property: propId = 0x%x", __func__, property);
+ return StatusCode::OK;
+}
+
// Parse supported properties list and generate vector of property values to hold current values.
void DefaultVehicleHal::onCreate() {
// Initialize member variables
@@ -598,7 +605,11 @@
prop->areaId = curArea;
prop->prop = cfg.prop;
setDefaultValue(prop.get());
- mProps[std::make_pair(prop->prop, prop->areaId)] = std::move(prop);
+ std::unique_ptr<CustomVehiclePropertyHandler> handler;
+ handler.reset(new StoredValueCustomVehiclePropertyHandler());
+ handler->set(*prop);
+ mProps[std::make_pair(prop->prop, prop->areaId)] =
+ std::move(handler);
} while (supportedAreas != 0);
}
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
index bbbe955..c8310b3 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
@@ -44,7 +44,31 @@
class DefaultVehicleHal : public VehicleHal {
public:
- DefaultVehicleHal() : mRecurrentTimer(
+ class CustomVehiclePropertyHandler {
+ public:
+ virtual VehiclePropValue* get() = 0;
+ virtual StatusCode set(const VehiclePropValue& propValue) = 0;
+ virtual ~CustomVehiclePropertyHandler() = default;
+ };
+
+protected:
+ class StoredValueCustomVehiclePropertyHandler :
+ public CustomVehiclePropertyHandler {
+ public:
+ VehiclePropValue* get() override {
+ return mPropValue.get();
+ }
+
+ StatusCode set(const VehiclePropValue& propValue) {
+ *mPropValue = propValue;
+ return StatusCode::OK;
+ }
+private:
+ std::unique_ptr<VehiclePropValue> mPropValue{new VehiclePropValue()};
+};
+
+public:
+ DefaultVehicleHal() : mRecurrentTimer(
std::bind(&DefaultVehicleHal::onContinuousPropertyTimer, this, std::placeholders::_1)) {
for (size_t i = 0; i < arraysize(kVehicleProperties); i++) {
mPropConfigMap[kVehicleProperties[i].prop] = &kVehicleProperties[i];
@@ -77,6 +101,43 @@
StatusCode unsubscribe(int32_t property) override;
+ /**
+ * Add custom property information to this HAL instance.
+ *
+ * This is useful for allowing later versions of Vehicle HAL to coalesce
+ * the list of properties they support with a previous version of the HAL.
+ *
+ * @param property The identifier of the new property
+ * @param handler The object that will handle get/set requests
+ * @return OK on success, an error code on failure
+ */
+ virtual StatusCode addCustomProperty(int32_t,
+ std::unique_ptr<CustomVehiclePropertyHandler>&&);
+
+ /**
+ * Add custom property information to this HAL instance.
+ *
+ * This is useful for allowing later versions of Vehicle HAL to coalesce
+ * the list of properties they support with a previous version of the HAL.
+ *
+ * @param initialValue The initial value for the new property. This is not
+ * constant data, as later set() operations can change
+ * this value at will
+ * @return OK on success, an error code on failure
+ */
+ virtual StatusCode addCustomProperty(
+ const VehiclePropValue& initialValue) {
+ std::unique_ptr<CustomVehiclePropertyHandler> handler;
+ handler.reset(new StoredValueCustomVehiclePropertyHandler());
+ StatusCode setResponse = handler->set(initialValue);
+ if (StatusCode::OK == setResponse) {
+ return addCustomProperty(initialValue.prop,
+ std::move(handler));
+ } else {
+ return setResponse;
+ }
+ }
+
private:
void doGetConfig(emulator::EmulatorMessage& rxMsg, emulator::EmulatorMessage& respMsg);
void doGetConfigAll(emulator::EmulatorMessage& rxMsg, emulator::EmulatorMessage& respMsg);
@@ -106,7 +167,7 @@
private:
std::map<
std::pair<int32_t /*VehicleProperty*/, int32_t /*areaId*/>,
- std::unique_ptr<VehiclePropValue>> mProps;
+ std::unique_ptr<CustomVehiclePropertyHandler>> mProps;
std::atomic<int> mExit;
std::unordered_set<int32_t> mHvacPowerProps;
std::mutex mPropsMutex;
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.cpp b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.cpp
index d4eae7f..b147ce7 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.cpp
@@ -120,12 +120,12 @@
return sensorStore;
}
-void DefaultVehicleHal::initObd2LiveFrame(V2_0::VehiclePropConfig& propConfig) {
+void DefaultVehicleHal::initObd2LiveFrame(V2_0::VehiclePropConfig& propConfig,
+ V2_0::VehiclePropValue* liveObd2Frame) {
auto sensorStore = fillDefaultObd2Frame(propConfig.configArray[0],
propConfig.configArray[1]);
- mLiveObd2Frame = createVehiclePropValue(
- V2_0::VehiclePropertyType::COMPLEX, 0);
- sensorStore->fillPropValue(mLiveObd2Frame.get(), "");
+ sensorStore->fillPropValue(liveObd2Frame, "");
+ liveObd2Frame->prop = V2_0::toInt(VehicleProperty::OBD2_LIVE_FRAME);
}
void DefaultVehicleHal::initObd2FreezeFrame(V2_0::VehiclePropConfig& propConfig) {
@@ -144,14 +144,6 @@
sensorStore->fillPropValue(mFreezeObd2Frames[2].get(), "P0123");
}
-V2_0::StatusCode DefaultVehicleHal::fillObd2LiveFrame(V2_0::VehiclePropValue* v) {
- v->prop = V2_0::toInt(VehicleProperty::OBD2_LIVE_FRAME);
- v->value.int32Values = mLiveObd2Frame->value.int32Values;
- v->value.floatValues = mLiveObd2Frame->value.floatValues;
- v->value.bytes = mLiveObd2Frame->value.bytes;
- return V2_0::StatusCode::OK;
-}
-
template<typename Iterable>
typename Iterable::const_iterator findPropValueAtTimestamp(
const Iterable& frames,
@@ -224,8 +216,11 @@
std::vector<V2_0::VehiclePropConfig> configs = listProperties();
for (auto& cfg : configs) {
switch(cfg.prop) {
- case V2_0::toInt(V2_1::VehicleProperty::OBD2_LIVE_FRAME):
- initObd2LiveFrame(cfg);
+ case V2_0::toInt(V2_1::VehicleProperty::OBD2_LIVE_FRAME): {
+ auto liveObd2Frame = createVehiclePropValue(V2_0::VehiclePropertyType::COMPLEX, 0);
+ initObd2LiveFrame(cfg, liveObd2Frame.get());
+ mVehicleHal20->addCustomProperty(*liveObd2Frame);
+ }
break;
case V2_0::toInt(V2_1::VehicleProperty::OBD2_FREEZE_FRAME):
initObd2FreezeFrame(cfg);
@@ -245,10 +240,6 @@
auto& pool = *getValuePool();
switch (propId) {
- case V2_0::toInt(V2_1::VehicleProperty::OBD2_LIVE_FRAME):
- v = pool.obtainComplex();
- *outStatus = fillObd2LiveFrame(v.get());
- return v;
case V2_0::toInt(V2_1::VehicleProperty::OBD2_FREEZE_FRAME):
v = pool.obtainComplex();
*outStatus = fillObd2FreezeFrame(requestedPropValue, v.get());
diff --git a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.h b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.h
index ac65fc6..af21138 100644
--- a/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.1/default/impl/vhal_v2_1/DefaultVehicleHal.h
@@ -39,7 +39,8 @@
class DefaultVehicleHal : public V2_0::VehicleHal {
public:
- DefaultVehicleHal(V2_0::VehicleHal* vhal20) : mVehicleHal20(vhal20) {}
+ DefaultVehicleHal(V2_0::impl::DefaultVehicleHal* vhal20) :
+ mVehicleHal20(vhal20) {}
std::vector<V2_0::VehiclePropConfig> listProperties() override {
std::vector<V2_0::VehiclePropConfig> propConfigs(mVehicleHal20->listProperties());
@@ -70,17 +71,16 @@
void onCreate() override;
private:
- void initObd2LiveFrame(V2_0::VehiclePropConfig& propConfig);
+ void initObd2LiveFrame(V2_0::VehiclePropConfig& propConfig,
+ V2_0::VehiclePropValue* liveObd2Frame);
void initObd2FreezeFrame(V2_0::VehiclePropConfig& propConfig);
- V2_0::StatusCode fillObd2LiveFrame(V2_0::VehiclePropValue* v);
V2_0::StatusCode fillObd2FreezeFrame(const V2_0::VehiclePropValue& requestedPropValue,
V2_0::VehiclePropValue* v);
V2_0::StatusCode fillObd2DtcInfo(V2_0::VehiclePropValue *v);
V2_0::StatusCode clearObd2FreezeFrames(const V2_0::VehiclePropValue& propValue);
private:
- V2_0::VehicleHal* mVehicleHal20;
- std::unique_ptr<V2_0::VehiclePropValue> mLiveObd2Frame {nullptr};
+ V2_0::impl::DefaultVehicleHal* mVehicleHal20;
std::vector<std::unique_ptr<V2_0::VehiclePropValue>> mFreezeObd2Frames;
};
diff --git a/bluetooth/1.0/default/bluetooth_hci.cc b/bluetooth/1.0/default/bluetooth_hci.cc
index fec5b81..8eccfc7 100644
--- a/bluetooth/1.0/default/bluetooth_hci.cc
+++ b/bluetooth/1.0/default/bluetooth_hci.cc
@@ -15,9 +15,10 @@
//
#define LOG_TAG "android.hardware.bluetooth@1.0-impl"
+#include "bluetooth_hci.h"
+
#include <utils/Log.h>
-#include "bluetooth_hci.h"
#include "vendor_interface.h"
namespace android {
@@ -38,59 +39,77 @@
uint64_t /*cookie*/,
const wp<::android::hidl::base::V1_0::IBase>& /*who*/) {
ALOGE("BluetoothDeathRecipient::serviceDied - Bluetooth service died");
+ has_died_ = true;
mHci->close();
}
sp<IBluetoothHci> mHci;
+ bool getHasDied() const { return has_died_; }
+ void setHasDied(bool has_died) { has_died_ = has_died; }
+
+ private:
+ bool has_died_;
};
BluetoothHci::BluetoothHci()
- : deathRecipient(new BluetoothDeathRecipient(this)) {}
+ : death_recipient_(new BluetoothDeathRecipient(this)) {}
Return<void> BluetoothHci::initialize(
const ::android::sp<IBluetoothHciCallbacks>& cb) {
- ALOGW("BluetoothHci::initialize()");
- cb->linkToDeath(deathRecipient, 0);
- event_cb_ = cb;
+ ALOGI("BluetoothHci::initialize()");
+ if (cb == nullptr) {
+ ALOGE("cb == nullptr! -> Unable to call initializationComplete(ERR)");
+ return Void();
+ }
+
+ death_recipient_->setHasDied(false);
+ cb->linkToDeath(death_recipient_, 0);
bool rc = VendorInterface::Initialize(
- [this](bool status) {
- auto hidl_status = event_cb_->initializationComplete(
+ [cb](bool status) {
+ auto hidl_status = cb->initializationComplete(
status ? Status::SUCCESS : Status::INITIALIZATION_ERROR);
if (!hidl_status.isOk()) {
ALOGE("VendorInterface -> Unable to call initializationComplete()");
}
},
- [this](const hidl_vec<uint8_t>& packet) {
- auto hidl_status = event_cb_->hciEventReceived(packet);
+ [cb](const hidl_vec<uint8_t>& packet) {
+ auto hidl_status = cb->hciEventReceived(packet);
if (!hidl_status.isOk()) {
ALOGE("VendorInterface -> Unable to call hciEventReceived()");
}
},
- [this](const hidl_vec<uint8_t>& packet) {
- auto hidl_status = event_cb_->aclDataReceived(packet);
+ [cb](const hidl_vec<uint8_t>& packet) {
+ auto hidl_status = cb->aclDataReceived(packet);
if (!hidl_status.isOk()) {
ALOGE("VendorInterface -> Unable to call aclDataReceived()");
}
},
- [this](const hidl_vec<uint8_t>& packet) {
- auto hidl_status = event_cb_->scoDataReceived(packet);
+ [cb](const hidl_vec<uint8_t>& packet) {
+ auto hidl_status = cb->scoDataReceived(packet);
if (!hidl_status.isOk()) {
ALOGE("VendorInterface -> Unable to call scoDataReceived()");
}
});
if (!rc) {
- auto hidl_status =
- event_cb_->initializationComplete(Status::INITIALIZATION_ERROR);
+ auto hidl_status = cb->initializationComplete(Status::INITIALIZATION_ERROR);
if (!hidl_status.isOk()) {
ALOGE("VendorInterface -> Unable to call initializationComplete(ERR)");
}
}
+
+ unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
+ if (death_recipient->getHasDied())
+ ALOGI("Skipping unlink call, service died.");
+ else
+ cb->unlinkToDeath(death_recipient);
+ };
+
return Void();
}
Return<void> BluetoothHci::close() {
- ALOGW("BluetoothHci::close()");
- event_cb_->unlinkToDeath(deathRecipient);
+ ALOGI("BluetoothHci::close()");
+ unlink_cb_(death_recipient_);
VendorInterface::Shutdown();
return Void();
}
diff --git a/bluetooth/1.0/default/bluetooth_hci.h b/bluetooth/1.0/default/bluetooth_hci.h
index 4f92231..6912405 100644
--- a/bluetooth/1.0/default/bluetooth_hci.h
+++ b/bluetooth/1.0/default/bluetooth_hci.h
@@ -44,8 +44,8 @@
private:
void sendDataToController(const uint8_t type, const hidl_vec<uint8_t>& data);
- ::android::sp<IBluetoothHciCallbacks> event_cb_;
- ::android::sp<BluetoothDeathRecipient> deathRecipient;
+ ::android::sp<BluetoothDeathRecipient> death_recipient_;
+ std::function<void(sp<BluetoothDeathRecipient>&)> unlink_cb_;
};
extern "C" IBluetoothHci* HIDL_FETCH_IBluetoothHci(const char* name);
diff --git a/broadcastradio/1.0/default/BroadcastRadio.cpp b/broadcastradio/1.0/default/BroadcastRadio.cpp
index 45ffdb2..72cdc19 100644
--- a/broadcastradio/1.0/default/BroadcastRadio.cpp
+++ b/broadcastradio/1.0/default/BroadcastRadio.cpp
@@ -63,6 +63,7 @@
if (rc != 0) {
ALOGE("couldn't load radio module %s.%s (%s)",
RADIO_HARDWARE_MODULE_ID, classString, strerror(-rc));
+ mStatus = Result::INVALID_ARGUMENTS;
return;
}
rc = radio_hw_device_open(mod, &mHwDevice);
diff --git a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
index 4ec19c7..ebeadb1 100644
--- a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
+++ b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
@@ -48,21 +48,42 @@
using ::android::hardware::broadcastradio::V1_0::MetaData;
+#define RETURN_IF_SKIPPED \
+ if (skipped) { \
+ std::cout << "[ SKIPPED ] This device class is not supported. " << std::endl; \
+ return; \
+ }
+
// The main test class for Broadcast Radio HIDL HAL.
-class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+class BroadcastRadioHidlTest : public ::testing::VtsHalHidlTargetTestBase,
+ public ::testing::WithParamInterface<Class> {
protected:
virtual void SetUp() override {
+ ASSERT_EQ(nullptr, mRadio.get());
+
+ radioClass = GetParam();
+ skipped = false;
+
sp<IBroadcastRadioFactory> factory =
::testing::VtsHalHidlTargetTestBase::getService<IBroadcastRadioFactory>();
- if (factory != 0) {
- factory->connectModule(Class::AM_FM,
- [&](Result retval, const ::android::sp<IBroadcastRadio>& result) {
- if (retval == Result::OK) {
- mRadio = result;
- }
- });
+ ASSERT_NE(nullptr, factory.get());
+
+ Result connectResult;
+ factory->connectModule(radioClass, [&](Result ret, const sp<IBroadcastRadio>& radio) {
+ connectResult = ret;
+ mRadio = radio;
+ onCallback_l();
+ });
+ EXPECT_EQ(true, waitForCallback(kConnectCallbacktimeoutNs));
+ mCallbackCalled = false;
+
+ if (connectResult == Result::INVALID_ARGUMENTS) {
+ skipped = true;
+ return;
}
+ ASSERT_EQ(connectResult, Result::OK);
+
mTunerCallback = new MyCallback(this);
ASSERT_NE(nullptr, mRadio.get());
ASSERT_NE(nullptr, mTunerCallback.get());
@@ -175,9 +196,9 @@
}
- BroadcastRadioHidlTest() :
- mCallbackCalled(false), mBoolCallbackData(false),
- mResultCallbackData(Result::OK), mHwFailure(false) {}
+ BroadcastRadioHidlTest()
+ : mCallbackCalled(false), mBoolCallbackData(false), mResultCallbackData(Result::OK),
+ mHwFailure(false) {}
void onCallback_l() {
if (!mCallbackCalled) {
@@ -208,9 +229,12 @@
bool openTuner();
bool checkAntenna();
+ static const nsecs_t kConnectCallbacktimeoutNs = seconds_to_nanoseconds(1);
static const nsecs_t kConfigCallbacktimeoutNs = seconds_to_nanoseconds(10);
static const nsecs_t kTuneCallbacktimeoutNs = seconds_to_nanoseconds(30);
+ Class radioClass;
+ bool skipped;
sp<IBroadcastRadio> mRadio;
Properties mHalProperties;
sp<ITuner> mTuner;
@@ -225,13 +249,6 @@
bool mHwFailure;
};
-// A class for test environment setup (kept since this file is a template).
-class BroadcastRadioHidlEnvironment : public ::testing::Environment {
- public:
- virtual void SetUp() {}
- virtual void TearDown() {}
-};
-
namespace android {
namespace hardware {
namespace broadcastradio {
@@ -331,7 +348,8 @@
* - the implementation supports at least one tuner
* - the implementation supports at one band
*/
-TEST_F(BroadcastRadioHidlTest, GetProperties) {
+TEST_P(BroadcastRadioHidlTest, GetProperties) {
+ RETURN_IF_SKIPPED;
EXPECT_EQ(true, getProperties());
}
@@ -342,7 +360,8 @@
* - the HAL implements the method
* - the method returns 0 (no error) and a valid ITuner interface
*/
-TEST_F(BroadcastRadioHidlTest, OpenTuner) {
+TEST_P(BroadcastRadioHidlTest, OpenTuner) {
+ RETURN_IF_SKIPPED;
EXPECT_EQ(true, openTuner());
}
@@ -353,7 +372,8 @@
* - ITuner destruction gets propagated through HAL
* - the openTuner method works well when called for the second time
*/
-TEST_F(BroadcastRadioHidlTest, ReopenTuner) {
+TEST_P(BroadcastRadioHidlTest, ReopenTuner) {
+ RETURN_IF_SKIPPED;
EXPECT_TRUE(openTuner());
mTuner.clear();
EXPECT_TRUE(openTuner());
@@ -366,7 +386,8 @@
* - the openTuner method fails when called for the second time without deleting previous
* ITuner instance
*/
-TEST_F(BroadcastRadioHidlTest, OpenTunerTwice) {
+TEST_P(BroadcastRadioHidlTest, OpenTunerTwice) {
+ RETURN_IF_SKIPPED;
EXPECT_TRUE(openTuner());
Result halResult = Result::NOT_INITIALIZED;
@@ -389,7 +410,8 @@
* - the configuration callback is received within kConfigCallbacktimeoutNs ns
* - the configuration read back from HAl has the same class Id
*/
-TEST_F(BroadcastRadioHidlTest, SetAndGetConfiguration) {
+TEST_P(BroadcastRadioHidlTest, SetAndGetConfiguration) {
+ RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
// test setConfiguration
mCallbackCalled = false;
@@ -422,7 +444,8 @@
* - the methods returns INVALID_ARGUMENTS on invalid arguments
* - the method recovers and succeeds after passing correct arguments
*/
-TEST_F(BroadcastRadioHidlTest, SetConfigurationFails) {
+TEST_P(BroadcastRadioHidlTest, SetConfigurationFails) {
+ RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
// Let's define a config that's bad for sure.
@@ -456,7 +479,8 @@
* - the tuned callback is received within kTuneCallbacktimeoutNs ns
* - skipping sub-channel or not does not fail the call
*/
-TEST_F(BroadcastRadioHidlTest, Scan) {
+TEST_P(BroadcastRadioHidlTest, Scan) {
+ RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
ASSERT_TRUE(checkAntenna());
// test scan UP
@@ -483,7 +507,8 @@
* - the tuned callback is received within kTuneCallbacktimeoutNs ns
* - skipping sub-channel or not does not fail the call
*/
-TEST_F(BroadcastRadioHidlTest, Step) {
+TEST_P(BroadcastRadioHidlTest, Step) {
+ RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
ASSERT_TRUE(checkAntenna());
// test step UP
@@ -509,7 +534,8 @@
* - the methods return 0 (no error)
* - the tuned callback is received within kTuneCallbacktimeoutNs ns after tune()
*/
-TEST_F(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
+TEST_P(BroadcastRadioHidlTest, TuneAndGetProgramInformationAndCancel) {
+ RETURN_IF_SKIPPED;
ASSERT_EQ(true, openTuner());
ASSERT_TRUE(checkAntenna());
@@ -566,7 +592,8 @@
* - the method returns INVALID_ARGUMENTS when applicable
* - the method recovers and succeeds after passing correct arguments
*/
-TEST_F(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
+TEST_P(BroadcastRadioHidlTest, TuneFailsOutOfBounds) {
+ RETURN_IF_SKIPPED;
ASSERT_TRUE(openTuner());
ASSERT_TRUE(checkAntenna());
@@ -595,9 +622,12 @@
EXPECT_TRUE(waitForCallback(kTuneCallbacktimeoutNs));
}
+INSTANTIATE_TEST_CASE_P(
+ BroadcastRadioHidlTestCases,
+ BroadcastRadioHidlTest,
+ ::testing::Values(Class::AM_FM, Class::SAT, Class::DT));
int main(int argc, char** argv) {
- ::testing::AddGlobalTestEnvironment(new BroadcastRadioHidlEnvironment);
::testing::InitGoogleTest(&argc, argv);
int status = RUN_ALL_TESTS();
ALOGI("Test result = %d", status);
diff --git a/camera/device/3.2/ICameraDeviceSession.hal b/camera/device/3.2/ICameraDeviceSession.hal
index d8d3177..e186c8d 100644
--- a/camera/device/3.2/ICameraDeviceSession.hal
+++ b/camera/device/3.2/ICameraDeviceSession.hal
@@ -152,6 +152,7 @@
* camera3_stream_configuration_t->operation_mode requirements
* for non-NORMAL mode, or the requested operation_mode is not
* supported by the HAL.
+ * - Unsupported usage flag
* The camera service cannot filter out all possible illegal stream
* configurations, since some devices may support more simultaneous
* streams or larger stream resolutions than the minimum required
diff --git a/camera/device/3.2/types.hal b/camera/device/3.2/types.hal
index c7d38c1..ba5bbe0 100644
--- a/camera/device/3.2/types.hal
+++ b/camera/device/3.2/types.hal
@@ -248,6 +248,12 @@
* streamType INPUT, the value of this field is always 0. For all streams
* passed via configureStreams(), the HAL must set its own
* additional usage flags in its output HalStreamConfiguration.
+ *
+ * The usage flag for an output stream may be bitwise combination of usage
+ * flags for multiple consumers, for the purpose of sharing one camera
+ * stream between those consumers. The HAL must fail configureStreams call
+ * with ILLEGAL_ARGUMENT if the combined flags cannot be supported due to
+ * imcompatible buffer format, dataSpace, or other hardware limitations.
*/
ConsumerUsageFlags usage;
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.cpp b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
index 87c9ffb..9469ab4 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.cpp
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.cpp
@@ -123,11 +123,6 @@
return Void();
}
-// Methods from ::android::hidl::base::V1_0::IBase follow.
-ISurfaceFlingerConfigs* HIDL_FETCH_ISurfaceFlingerConfigs(const char* /* name */) {
- return new SurfaceFlingerConfigs();
-}
-
} // namespace implementation
} // namespace V1_0
} // namespace configstore
diff --git a/configstore/1.0/default/SurfaceFlingerConfigs.h b/configstore/1.0/default/SurfaceFlingerConfigs.h
index 9f9b217..9300511 100644
--- a/configstore/1.0/default/SurfaceFlingerConfigs.h
+++ b/configstore/1.0/default/SurfaceFlingerConfigs.h
@@ -40,8 +40,6 @@
};
-extern "C" ISurfaceFlingerConfigs* HIDL_FETCH_ISurfaceFlingerConfigs(const char* name);
-
} // namespace implementation
} // namespace V1_0
} // namespace configstore
diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h
index 98ccae9..46cc9b0 100644
--- a/configstore/utils/include/configstore/Utils.h
+++ b/configstore/utils/include/configstore/Utils.h
@@ -20,6 +20,10 @@
#include <hidl/Status.h>
#include <stdatomic.h>
+#pragma push_macro("LOG_TAG")
+#undef LOG_TAG
+#define LOG_TAG "ConfigStoreUtil"
+
namespace android {
namespace hardware {
namespace configstore {
@@ -39,9 +43,13 @@
// fallback to the default value
ret.specified = false;
} else {
- (*configs.*func)([&ret](V v) {
+ auto status = (*configs.*func)([&ret](V v) {
ret = v;
});
+ if (!status.isOk()) {
+ ALOGE("HIDL call failed. %s", status.description().c_str());
+ ret.specified = false;
+ }
}
return ret;
@@ -91,4 +99,6 @@
} // namespace hardware
} // namespace android
+#pragma pop_macro("LOG_TAG")
+
#endif // ANDROID_HARDWARE_CONFIGSTORE_UTILS_H
diff --git a/keymaster/3.0/default/KeymasterDevice.cpp b/keymaster/3.0/default/KeymasterDevice.cpp
index 0969355..01f0795 100644
--- a/keymaster/3.0/default/KeymasterDevice.cpp
+++ b/keymaster/3.0/default/KeymasterDevice.cpp
@@ -525,6 +525,8 @@
case Tag::ATTESTATION_ID_SERIAL:
case Tag::ATTESTATION_ID_IMEI:
case Tag::ATTESTATION_ID_MEID:
+ case Tag::ATTESTATION_ID_MANUFACTURER:
+ case Tag::ATTESTATION_ID_MODEL:
// Device id attestation may only be supported if the device is able to permanently
// destroy its knowledge of the ids. This device is unable to do this, so it must
// never perform any device id attestation.
diff --git a/keymaster/3.0/types.hal b/keymaster/3.0/types.hal
index 9f29b6a..1f4a0cc 100644
--- a/keymaster/3.0/types.hal
+++ b/keymaster/3.0/types.hal
@@ -135,7 +135,10 @@
in attestation */
ATTESTATION_ID_MEID = TagType:BYTES | 715, /* Used to provide the device's MEID to be included
in attestation */
-
+ ATTESTATION_ID_MANUFACTURER = TagType:BYTES | 716, /* Used to provide the device's manufacturer
+ name to be included in attestation */
+ ATTESTATION_ID_MODEL = TagType:BYTES | 717, /* Used to provide the device's model name to be
+ included in attestation */
/* Tags used only to provide data to or receive data from operations */
ASSOCIATED_DATA = TagType:BYTES | 1000, /* Used to provide associated data for AEAD modes. */
diff --git a/nfc/1.0/default/Nfc.cpp b/nfc/1.0/default/Nfc.cpp
index c610406..d337a36 100644
--- a/nfc/1.0/default/Nfc.cpp
+++ b/nfc/1.0/default/Nfc.cpp
@@ -12,7 +12,7 @@
namespace V1_0 {
namespace implementation {
-sp<INfcClientCallback> Nfc::mCallback = NULL;
+sp<INfcClientCallback> Nfc::mCallback = nullptr;
Nfc::Nfc(nfc_nci_device_t* device) : mDevice(device),
mDeathRecipient(new NfcDeathRecipient(this)) {
@@ -21,35 +21,58 @@
// Methods from ::android::hardware::nfc::V1_0::INfc follow.
::android::hardware::Return<NfcStatus> Nfc::open(const sp<INfcClientCallback>& clientCallback) {
mCallback = clientCallback;
+
+ if (mDevice == nullptr || mCallback == nullptr) {
+ return NfcStatus::FAILED;
+ }
mCallback->linkToDeath(mDeathRecipient, 0 /*cookie*/);
int ret = mDevice->open(mDevice, eventCallback, dataCallback);
return ret == 0 ? NfcStatus::OK : NfcStatus::FAILED;
}
::android::hardware::Return<uint32_t> Nfc::write(const hidl_vec<uint8_t>& data) {
+ if (mDevice == nullptr) {
+ return -1;
+ }
return mDevice->write(mDevice, data.size(), &data[0]);
}
::android::hardware::Return<NfcStatus> Nfc::coreInitialized(const hidl_vec<uint8_t>& data) {
hidl_vec<uint8_t> copy = data;
+
+ if (mDevice == nullptr) {
+ return NfcStatus::FAILED;
+ }
int ret = mDevice->core_initialized(mDevice, ©[0]);
return ret == 0 ? NfcStatus::OK : NfcStatus::FAILED;
}
::android::hardware::Return<NfcStatus> Nfc::prediscover() {
+ if (mDevice == nullptr) {
+ return NfcStatus::FAILED;
+ }
return mDevice->pre_discover(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
::android::hardware::Return<NfcStatus> Nfc::close() {
+ if (mDevice == nullptr || mCallback == nullptr) {
+ return NfcStatus::FAILED;
+ }
mCallback->unlinkToDeath(mDeathRecipient);
return mDevice->close(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
::android::hardware::Return<NfcStatus> Nfc::controlGranted() {
+ if (mDevice == nullptr) {
+ return NfcStatus::FAILED;
+ }
return mDevice->control_granted(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
::android::hardware::Return<NfcStatus> Nfc::powerCycle() {
+ if (mDevice == nullptr) {
+ return NfcStatus::FAILED;
+ }
return mDevice->power_cycle(mDevice) ? NfcStatus::FAILED : NfcStatus::OK;
}
@@ -57,11 +80,10 @@
INfc* HIDL_FETCH_INfc(const char * /*name*/) {
nfc_nci_device_t* nfc_device;
int ret = 0;
- const hw_module_t* hw_module = NULL;
+ const hw_module_t* hw_module = nullptr;
ret = hw_get_module (NFC_NCI_HARDWARE_MODULE_ID, &hw_module);
- if (ret == 0)
- {
+ if (ret == 0) {
ret = nfc_nci_open (hw_module, &nfc_device);
if (ret != 0) {
ALOGE ("nfc_nci_open failed: %d", ret);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 5fa11fc..f704520 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -417,6 +417,23 @@
}
/*
+ * Test IRadio.setCdmaSubscriptionSource() for the response returned.
+ */
+TEST_F(RadioHidlTest, setCdmaSubscriptionSource) {
+ int serial = 1;
+
+ radio->setCdmaSubscriptionSource(++serial, CdmaSubscriptionSource::RUIM_SIM);
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SIM_ABSENT
+ || radioRsp->rspInfo.error == RadioError::SUBSCRIPTION_NOT_AVAILABLE);
+ }
+}
+
+/*
* Test IRadio.getVoiceRadioTechnology() for the response returned.
*/
TEST_F(RadioHidlTest, getVoiceRadioTechnology) {
@@ -455,7 +472,7 @@
int serial = 1;
// TODO(sanketpadawe): RIL crashes with value of rate = 10
- radio->setCellInfoListRate(++serial, 0);
+ radio->setCellInfoListRate(++serial, 10);
EXPECT_EQ(std::cv_status::no_timeout, wait());
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
index 3638ccb..fa2871d 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
@@ -28,8 +28,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE
- || radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
}
@@ -87,8 +86,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -106,8 +104,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -125,8 +122,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -144,8 +140,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -163,8 +158,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -182,8 +176,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
}
@@ -218,8 +211,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -319,8 +311,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -358,10 +349,29 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_STATE
+ || radioRsp->rspInfo.error == RadioError::MODEM_ERR
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ }
+}
+
+/*
+ * Test IRadio.sendCDMAFeatureCode() for the response returned.
+ */
+TEST_F(RadioHidlTest, sendCDMAFeatureCode) {
+ int serial = 1;
+
+ radio->sendCDMAFeatureCode(serial, hidl_string());
+ EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp->rspInfo.type);
+ EXPECT_EQ(serial, radioRsp->rspInfo.serial);
+
+ if (cardStatus.cardState == CardState::ABSENT) {
ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
|| radioRsp->rspInfo.error == RadioError::INVALID_STATE
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
- || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
+ || radioRsp->rspInfo.error == RadioError::INTERNAL_ERR
+ || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR);
}
}
@@ -414,8 +424,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::SYSTEM_ERR
|| radioRsp->rspInfo.error == RadioError::MODEM_ERR
|| radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
}
@@ -450,8 +459,7 @@
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
if (cardStatus.cardState == CardState::ABSENT) {
- ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS
- || radioRsp->rspInfo.error == RadioError::NONE);
+ ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
}
}
diff --git a/radio/1.0/vts/functional/radio_response.cpp b/radio/1.0/vts/functional/radio_response.cpp
index 8759003..c889a18 100644
--- a/radio/1.0/vts/functional/radio_response.cpp
+++ b/radio/1.0/vts/functional/radio_response.cpp
@@ -496,7 +496,9 @@
return Void();
}
-Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::setCdmaSubscriptionSourceResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
@@ -539,7 +541,9 @@
return Void();
}
-Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const RadioResponseInfo& /*info*/) {
+Return<void> RadioResponse::sendCDMAFeatureCodeResponse(const RadioResponseInfo& info) {
+ rspInfo = info;
+ parent.notify();
return Void();
}
diff --git a/tests/baz/1.0/default/Baz.cpp b/tests/baz/1.0/default/Baz.cpp
index 6252fbe..875fe65 100644
--- a/tests/baz/1.0/default/Baz.cpp
+++ b/tests/baz/1.0/default/Baz.cpp
@@ -1,3 +1,19 @@
+/*
+ * 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.
+ */
+
#include "Baz.h"
#include <android-base/logging.h>
@@ -26,150 +42,6 @@
return Void();
}
-// TODO(b/35703683) : replace usage of below methods with toString()
-
-static std::string to_string(const IBaz::Foo::Bar &bar);
-static std::string to_string(const IBaz::Foo &foo);
-static std::string to_string(const hidl_string &s);
-static std::string to_string(bool x);
-static std::string to_string(const IBaz::StringMatrix5x3 &M);
-
-template<typename T, size_t SIZE>
-static std::string to_string(const hidl_array<T, SIZE> &array);
-
-template<size_t SIZE>
-static std::string to_string(const hidl_array<uint8_t, SIZE> &array);
-
-template<typename T>
-static std::string to_string(const hidl_vec<T> &vec) {
- std::string out;
- out = "[";
- for (size_t i = 0; i < vec.size(); ++i) {
- if (i > 0) {
- out += ", ";
- }
- out += to_string(vec[i]);
- }
- out += "]";
-
- return out;
-}
-
-template<typename T, size_t SIZE>
-static std::string to_string(const hidl_array<T, SIZE> &array) {
- std::string out;
- out = "[";
- for (size_t i = 0; i < SIZE; ++i) {
- if (i > 0) {
- out += ", ";
- }
- out += to_string(array[i]);
- }
- out += "]";
-
- return out;
-}
-
-template<size_t SIZE>
-static std::string to_string(const hidl_array<uint8_t, SIZE> &array) {
- std::string out;
- for (size_t i = 0; i < SIZE; ++i) {
- if (i > 0) {
- out += ":";
- }
-
- char tmp[3];
- sprintf(tmp, "%02x", array[i]);
-
- out += tmp;
- }
-
- return out;
-}
-
-template<typename T, size_t SIZE1, size_t SIZE2>
-static std::string to_string(const hidl_array<T, SIZE1, SIZE2> &array) {
- std::string out;
- out = "[";
- for (size_t i = 0; i < SIZE1; ++i) {
- if (i > 0) {
- out += ", ";
- }
-
- out += "[";
- for (size_t j = 0; j < SIZE2; ++j) {
- if (j > 0) {
- out += ", ";
- }
-
- out += to_string(array[i][j]);
- }
- out += "]";
- }
- out += "]";
-
- return out;
-}
-
-static std::string to_string(bool x) {
- return x ? "true" : "false";
-}
-
-static std::string to_string(const hidl_string &s) {
- return std::string("'") + s.c_str() + "'";
-}
-
-static std::string to_string(const IBaz::Foo::Bar &bar) {
- std::string out;
- out = "Bar(";
- out += "z = " + to_string(bar.z) + ", ";
- out += "s = '" + std::string(bar.s.c_str()) + "'";
- out += ")";
-
- return out;
-}
-
-static std::string to_string(const IBaz::Foo &foo) {
- std::string out;
- out = "Foo(";
- out += "x = " + to_string(foo.x) + ", ";
- out += "y = " + to_string(foo.y) + ", ";
- out += "aaa = " + to_string(foo.aaa);
- out += ")";
-
- return out;
-}
-
-static std::string to_string(const IBaz::StringMatrix5x3 &M) {
- return to_string(M.s);
-}
-
-static std::string VectorOfArray_to_string(const IBaz::VectorOfArray &in) {
- std::string out;
- out += "VectorOfArray(";
-
- for (size_t i = 0; i < in.addresses.size(); ++i) {
- if (i > 0) {
- out += ", ";
- }
-
- for (size_t j = 0; j < 6; ++j) {
- if (j > 0) {
- out += ":";
- }
-
- char tmp[3];
- sprintf(tmp, "%02x", in.addresses[i][j]);
-
- out += tmp;
- }
- }
-
- out += ")";
-
- return out;
-}
-
// Methods from ::android::hardware::tests::baz::V1_0::IBase follow.
Return<void> Baz::someBaseMethod() {
LOG(INFO) << "Baz::someBaseMethod";
@@ -178,20 +50,14 @@
}
Return<bool> Baz::someBoolMethod(bool x) {
- LOG(INFO) << "Baz::someBoolMethod(" << to_string(x) << ")";
+ LOG(INFO) << "Baz::someBoolMethod(" << std::to_string(x) << ")";
return !x;
}
Return<void> Baz::someBoolArrayMethod(const hidl_array<bool, 3>& x,
someBoolArrayMethod_cb _hidl_cb) {
- LOG(INFO) << "Baz::someBoolArrayMethod("
- << to_string(x[0])
- << ", "
- << to_string(x[1])
- << ", "
- << to_string(x[2])
- << ")";
+ LOG(INFO) << "Baz::someBoolArrayMethod(" << toString(x) << ")";
hidl_array<bool, 4> out;
out[0] = !x[0];
@@ -205,7 +71,7 @@
}
Return<void> Baz::someBoolVectorMethod(const hidl_vec<bool>& x, someBoolVectorMethod_cb _hidl_cb) {
- LOG(INFO) << "Baz::someBoolVectorMethod(" << to_string(x) << ")";
+ LOG(INFO) << "Baz::someBoolVectorMethod(" << toString(x) << ")";
hidl_vec<bool> out;
out.resize(x.size());
@@ -220,7 +86,7 @@
Return<void> Baz::someOtherBaseMethod(const IBase::Foo& foo, someOtherBaseMethod_cb _hidl_cb) {
LOG(INFO) << "Baz::someOtherBaseMethod "
- << to_string(foo);
+ << toString(foo);
_hidl_cb(foo);
@@ -230,7 +96,7 @@
Return<void> Baz::someMethodWithFooArrays(const hidl_array<IBase::Foo, 2>& fooInput,
someMethodWithFooArrays_cb _hidl_cb) {
LOG(INFO) << "Baz::someMethodWithFooArrays "
- << to_string(fooInput);
+ << toString(fooInput);
hidl_array<IBaz::Foo, 2> fooOutput;
fooOutput[0] = fooInput[1];
@@ -244,7 +110,7 @@
Return<void> Baz::someMethodWithFooVectors(const hidl_vec<IBase::Foo>& fooInput,
someMethodWithFooVectors_cb _hidl_cb) {
LOG(INFO) << "Baz::someMethodWithFooVectors "
- << to_string(fooInput);
+ << toString(fooInput);
hidl_vec<IBaz::Foo> fooOutput;
fooOutput.resize(2);
@@ -259,7 +125,7 @@
Return<void> Baz::someMethodWithVectorOfArray(const IBase::VectorOfArray& in,
someMethodWithVectorOfArray_cb _hidl_cb) {
LOG(INFO) << "Baz::someMethodWithVectorOfArray "
- << VectorOfArray_to_string(in);
+ << toString(in);
IBase::VectorOfArray out;
@@ -278,7 +144,7 @@
Return<void> Baz::someMethodTakingAVectorOfArray(const hidl_vec<hidl_array<uint8_t, 6>>& in,
someMethodTakingAVectorOfArray_cb _hidl_cb) {
LOG(INFO) << "Baz::someMethodTakingAVectorOfArray "
- << to_string(in);
+ << toString(in);
const size_t n = in.size();
@@ -295,7 +161,7 @@
}
Return<void> Baz::transpose(const IBase::StringMatrix5x3& in, transpose_cb _hidl_cb) {
- LOG(INFO) << "Baz::transpose " << to_string(in);
+ LOG(INFO) << "Baz::transpose " << toString(in);
IBase::StringMatrix3x5 out;
for (size_t i = 0; i < 3; ++i) {
@@ -310,7 +176,7 @@
}
Return<void> Baz::transpose2(const hidl_array<hidl_string, 5, 3>& in, transpose2_cb _hidl_cb) {
- LOG(INFO) << "Baz::transpose2 " << to_string(in);
+ LOG(INFO) << "Baz::transpose2 " << toString(in);
hidl_array<hidl_string, 3, 5> out;
for (size_t i = 0; i < 3; ++i) {
@@ -443,7 +309,7 @@
Return<void> Baz::haveSomeStrings(const hidl_array<hidl_string, 3>& array,
haveSomeStrings_cb _hidl_cb) {
LOG(INFO) << "haveSomeStrings("
- << to_string(array)
+ << toString(array)
<< ")";
hidl_array<hidl_string, 2> result;
@@ -457,7 +323,7 @@
Return<void> Baz::haveAStringVec(const hidl_vec<hidl_string>& vector,
haveAStringVec_cb _hidl_cb) {
- LOG(INFO) << "haveAStringVec(" << to_string(vector) << ")";
+ LOG(INFO) << "haveAStringVec(" << toString(vector) << ")";
hidl_vec<hidl_string> result;
result.resize(2);
diff --git a/wifi/1.0/Android.mk b/wifi/1.0/Android.mk
index eabc63d..82409de 100644
--- a/wifi/1.0/Android.mk
+++ b/wifi/1.0/Android.mk
@@ -226,6 +226,44 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (NanDataPathSecurityConfig)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathSecurityConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanDataPathSecurityConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanDataPathSecurityType)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathSecurityType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanDataPathSecurityType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (NanDebugConfig)
#
GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDebugConfig.java
@@ -359,6 +397,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (NanParamSizeLimits)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanParamSizeLimits.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanParamSizeLimits
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (NanPublishRequest)
#
GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishRequest.java
@@ -2048,6 +2105,44 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (NanDataPathSecurityConfig)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathSecurityConfig.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanDataPathSecurityConfig
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (NanDataPathSecurityType)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDataPathSecurityType.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanDataPathSecurityType
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (NanDebugConfig)
#
GEN := $(intermediates)/android/hardware/wifi/V1_0/NanDebugConfig.java
@@ -2181,6 +2276,25 @@
LOCAL_GENERATED_SOURCES += $(GEN)
#
+# Build types.hal (NanParamSizeLimits)
+#
+GEN := $(intermediates)/android/hardware/wifi/V1_0/NanParamSizeLimits.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+ $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+ -Ljava \
+ -randroid.hardware:hardware/interfaces \
+ -randroid.hidl:system/libhidl/transport \
+ android.hardware.wifi@1.0::types.NanParamSizeLimits
+
+$(GEN): $(LOCAL_PATH)/types.hal
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
# Build types.hal (NanPublishRequest)
#
GEN := $(intermediates)/android/hardware/wifi/V1_0/NanPublishRequest.java
diff --git a/wifi/1.0/default/hidl_struct_util.cpp b/wifi/1.0/default/hidl_struct_util.cpp
index fb93c5a..c005213 100644
--- a/wifi/1.0/default/hidl_struct_util.cpp
+++ b/wifi/1.0/default/hidl_struct_util.cpp
@@ -973,17 +973,41 @@
hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
legacy_request->recv_indication_cfg |=
hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
- legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.cipherType;
- legacy_request->pmk_len = hidl_request.baseConfigs.pmk.size();
- if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: pmk_len too large";
- return false;
+ legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.securityConfig.cipherType;
+ if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
+ legacy_request->key_info.body.pmk_info.pmk_len =
+ hidl_request.baseConfigs.securityConfig.pmk.size();
+ if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: pmk_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.pmk_info.pmk,
+ hidl_request.baseConfigs.securityConfig.pmk.data(),
+ legacy_request->key_info.body.pmk_info.pmk_len);
}
- memcpy(legacy_request->pmk,
- hidl_request.baseConfigs.pmk.data(),
- legacy_request->pmk_len);
- legacy_request->sdea_params.security_cfg = hidl_request.baseConfigs.securityEnabledInNdp ?
- legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+ if (hidl_request.baseConfigs.securityConfig.securityType
+ == NanDataPathSecurityType::PASSPHRASE) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
+ legacy_request->key_info.body.passphrase_info.passphrase_len =
+ hidl_request.baseConfigs.securityConfig.passphrase.size();
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ < NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: passphrase_len too small";
+ return false;
+ }
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ > NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanPublishRequestToLegacy: passphrase_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
+ hidl_request.baseConfigs.securityConfig.passphrase.data(),
+ legacy_request->key_info.body.passphrase_info.passphrase_len);
+ }
+ legacy_request->sdea_params.security_cfg = (hidl_request.baseConfigs.securityConfig.securityType
+ != NanDataPathSecurityType::OPEN) ? legacy_hal::NAN_DP_CONFIG_SECURITY
+ : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired ?
legacy_hal::NAN_RANGING_ENABLE : legacy_hal::NAN_RANGING_DISABLE;
legacy_request->ranging_cfg.ranging_interval_msec = hidl_request.baseConfigs.rangingIntervalMsec;
@@ -1066,17 +1090,40 @@
hidl_request.baseConfigs.disableMatchExpirationIndication ? 0x2 : 0x0;
legacy_request->recv_indication_cfg |=
hidl_request.baseConfigs.disableFollowupReceivedIndication ? 0x4 : 0x0;
- legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.cipherType;
- legacy_request->pmk_len = hidl_request.baseConfigs.pmk.size();
- if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: pmk_len too large";
- return false;
+ legacy_request->cipher_type = (unsigned int) hidl_request.baseConfigs.securityConfig.cipherType;
+ if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PMK) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
+ legacy_request->key_info.body.pmk_info.pmk_len =
+ hidl_request.baseConfigs.securityConfig.pmk.size();
+ if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: pmk_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.pmk_info.pmk,
+ hidl_request.baseConfigs.securityConfig.pmk.data(),
+ legacy_request->key_info.body.pmk_info.pmk_len);
}
- memcpy(legacy_request->pmk,
- hidl_request.baseConfigs.pmk.data(),
- legacy_request->pmk_len);
- legacy_request->sdea_params.security_cfg = hidl_request.baseConfigs.securityEnabledInNdp ?
- legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+ if (hidl_request.baseConfigs.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
+ legacy_request->key_info.body.passphrase_info.passphrase_len =
+ hidl_request.baseConfigs.securityConfig.passphrase.size();
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ < NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: passphrase_len too small";
+ return false;
+ }
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ > NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanSubscribeRequestToLegacy: passphrase_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
+ hidl_request.baseConfigs.securityConfig.passphrase.data(),
+ legacy_request->key_info.body.passphrase_info.passphrase_len);
+ }
+ legacy_request->sdea_params.security_cfg = (hidl_request.baseConfigs.securityConfig.securityType
+ != NanDataPathSecurityType::OPEN) ? legacy_hal::NAN_DP_CONFIG_SECURITY
+ : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->sdea_params.ranging_state = hidl_request.baseConfigs.rangingRequired ?
legacy_hal::NAN_RANGING_ENABLE : legacy_hal::NAN_RANGING_DISABLE;
legacy_request->ranging_cfg.ranging_interval_msec = hidl_request.baseConfigs.rangingIntervalMsec;
@@ -1251,8 +1298,9 @@
(legacy_hal::NanDataPathChannelCfg) hidl_request.channelRequestType;
legacy_request->channel = hidl_request.channel;
strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str());
- legacy_request->ndp_cfg.security_cfg = hidl_request.securityRequired ?
- legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+ legacy_request->ndp_cfg.security_cfg = (hidl_request.securityConfig.securityType
+ != NanDataPathSecurityType::OPEN) ? legacy_hal::NAN_DP_CONFIG_SECURITY
+ : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: ndp_app_info_len too large";
@@ -1260,13 +1308,43 @@
}
memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
legacy_request->app_info.ndp_app_info_len);
- legacy_request->cipher_type = (unsigned int) hidl_request.cipherType;
- legacy_request->pmk_len = hidl_request.pmk.size();
- if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: pmk_len too large";
+ legacy_request->cipher_type = (unsigned int) hidl_request.securityConfig.cipherType;
+ if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
+ legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
+ if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: pmk_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.pmk_info.pmk,
+ hidl_request.securityConfig.pmk.data(),
+ legacy_request->key_info.body.pmk_info.pmk_len);
+ }
+ if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
+ legacy_request->key_info.body.passphrase_info.passphrase_len =
+ hidl_request.securityConfig.passphrase.size();
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ < NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: passphrase_len too small";
+ return false;
+ }
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ > NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: passphrase_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
+ hidl_request.securityConfig.passphrase.data(),
+ legacy_request->key_info.body.passphrase_info.passphrase_len);
+ }
+ legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size();
+ if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathInitiatorRequestToLegacy: service_name_len too large";
return false;
}
- memcpy(legacy_request->pmk, hidl_request.pmk.data(), legacy_request->pmk_len);
+ memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(),
+ legacy_request->service_name_len);
return true;
}
@@ -1284,8 +1362,9 @@
legacy_hal::NAN_DP_REQUEST_ACCEPT : legacy_hal::NAN_DP_REQUEST_REJECT;
legacy_request->ndp_instance_id = hidl_request.ndpInstanceId;
strcpy(legacy_request->ndp_iface, hidl_request.ifaceName.c_str());
- legacy_request->ndp_cfg.security_cfg = hidl_request.securityRequired ?
- legacy_hal::NAN_DP_CONFIG_SECURITY : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
+ legacy_request->ndp_cfg.security_cfg = (hidl_request.securityConfig.securityType
+ != NanDataPathSecurityType::OPEN) ? legacy_hal::NAN_DP_CONFIG_SECURITY
+ : legacy_hal::NAN_DP_CONFIG_NO_SECURITY;
legacy_request->app_info.ndp_app_info_len = hidl_request.appInfo.size();
if (legacy_request->app_info.ndp_app_info_len > NAN_DP_MAX_APP_INFO_LEN) {
LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: ndp_app_info_len too large";
@@ -1293,13 +1372,43 @@
}
memcpy(legacy_request->app_info.ndp_app_info, hidl_request.appInfo.data(),
legacy_request->app_info.ndp_app_info_len);
- legacy_request->cipher_type = (unsigned int) hidl_request.cipherType;
- legacy_request->pmk_len = hidl_request.pmk.size();
- if (legacy_request->pmk_len > NAN_PMK_INFO_LEN) {
- LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: pmk_len too large";
+ legacy_request->cipher_type = (unsigned int) hidl_request.securityConfig.cipherType;
+ if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PMK) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PMK;
+ legacy_request->key_info.body.pmk_info.pmk_len = hidl_request.securityConfig.pmk.size();
+ if (legacy_request->key_info.body.pmk_info.pmk_len > NAN_PMK_INFO_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: pmk_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.pmk_info.pmk,
+ hidl_request.securityConfig.pmk.data(),
+ legacy_request->key_info.body.pmk_info.pmk_len);
+ }
+ if (hidl_request.securityConfig.securityType == NanDataPathSecurityType::PASSPHRASE) {
+ legacy_request->key_info.key_type = legacy_hal::NAN_SECURITY_KEY_INPUT_PASSPHRASE;
+ legacy_request->key_info.body.passphrase_info.passphrase_len =
+ hidl_request.securityConfig.passphrase.size();
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ < NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: passphrase_len too small";
+ return false;
+ }
+ if (legacy_request->key_info.body.passphrase_info.passphrase_len
+ > NAN_SECURITY_MIN_PASSPHRASE_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: passphrase_len too large";
+ return false;
+ }
+ memcpy(legacy_request->key_info.body.passphrase_info.passphrase,
+ hidl_request.securityConfig.passphrase.data(),
+ legacy_request->key_info.body.passphrase_info.passphrase_len);
+ }
+ legacy_request->service_name_len = hidl_request.serviceNameOutOfBand.size();
+ if (legacy_request->service_name_len > NAN_MAX_SERVICE_NAME_LEN) {
+ LOG(ERROR) << "convertHidlNanDataPathIndicationResponseToLegacy: service_name_len too large";
return false;
}
- memcpy(legacy_request->pmk, hidl_request.pmk.data(), legacy_request->pmk_len);
+ memcpy(legacy_request->service_name, hidl_request.serviceNameOutOfBand.data(),
+ legacy_request->service_name_len);
return true;
}
diff --git a/wifi/1.0/types.hal b/wifi/1.0/types.hal
index d3845c9..17aadee 100644
--- a/wifi/1.0/types.hal
+++ b/wifi/1.0/types.hal
@@ -586,6 +586,17 @@
*/
/**
+ * Size limits for parameters used in the NAN interface.
+ */
+enum NanParamSizeLimits : uint32_t {
+ /* Minimum length of Passphrase argument for data-path configuration */
+ MIN_PASSPHRASE_LENGTH = 8,
+
+ /* Maximum length of Passphrase argument for data-path configuration */
+ MAX_PASSPHRASE_LENGTH = 63,
+};
+
+/**
* A unique short handle provided by the client to identify individual invocations of
* certain API's like |IWifiNanIface.*|.
*/
@@ -701,6 +712,15 @@
};
/**
+ * NAN DP (data-path) security configuration options.
+ */
+enum NanDataPathSecurityType : uint32_t {
+ OPEN, // no security
+ PMK, // security: PMK
+ PASSPHRASE, // security: passphrase
+};
+
+/**
* NAN band-specific configuration.
*/
struct NanBandSpecificConfig {
@@ -910,6 +930,38 @@
};
/**
+ * Configuration of NAN data-path security.
+ */
+struct NanDataPathSecurityConfig {
+ /**
+ * Security configuration of the data-path (NDP). Security is required if not equal to
+ * |NanDataPathSecurityType.OPEN|.
+ * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required
+ */
+ NanDataPathSecurityType securityType;
+ /**
+ * Cipher type for data-paths. If |securityType| is |NanDataPathSecurityType.OPEN| then must
+ * be set to |NanCipherSuiteType.NONE|, otherwise a non-|NanCipherSuiteType.NONE| cipher suite
+ * must be specified.
+ */
+ NanCipherSuiteType cipherType;
+ /**
+ * Optional Pairwise Master Key (PMK). Must be specified (and is only used) if |securityType| is
+ * set to |NanDataPathSecurityType.PMK|.
+ * Ref: IEEE 802.11i
+ */
+ uint8_t[32] pmk;
+ /**
+ * Optional Passphrase. Must be specified (and is only used) if |securityType| is set to
+ * |NanDataPathSecurityType.PASSPHRASE|.
+ * Min length: |MIN_PASSPHRASE_LENGTH|
+ * Max length: |MAX_PASSPHRASE_LENGTH|
+ * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
+ */
+ vec<uint8_t> passphrase;
+};
+
+/**
* Configurations of NAN discovery sessions: common to publish and subscribe discovery.
*/
struct NanDiscoveryCommonConfig {
@@ -1009,25 +1061,11 @@
*/
bool disableFollowupReceivedIndication;
/**
- * Cipher type for data-paths constructed in the context of this discovery session. Must be
- * specified as |NanCipherSuiteType.NONE| if no |pmk| is provided.
+ * Security configuration of data-paths created in the context of this discovery session. Security
+ * parameters can be overridden during the actual construction of the data-path - allowing
+ * individual data-paths to have unique PMKs or Passphrases.
*/
- NanCipherSuiteType cipherType;
- /**
- * Optional Pairwise Master Key (PMK) for data-paths constructed in the context of this discovery
- * session. A PMK can also be provided during the actual construction of the data-path (which
- * allows for unique PMKs for each data-path). The |cipherType| must be specified if a PMK is
- * provided.
- * Max length: 32
- * Ref: IEEE 802.11i
- */
- vec<uint8_t> pmk;
- /**
- * Specifies whether or not security is enabled in any data-path (NDP) constructed in the context
- * of this discovery session.
- * NAN Spec: Service Discovery Extension Attribute (SDEA) / Control / Security Required
- */
- bool securityEnabledInNdp;
+ NanDataPathSecurityConfig securityConfig;
/**
* Specifies whether or not there is a ranging requirement in this discovery session.
* Ranging is only performed if all other match criteria with the peer are met. Ranging must
@@ -1213,10 +1251,9 @@
*/
string ifaceName;
/**
- * Specifies whether or not security is required for the data-path being created.
- * NAN Spec: Data Path Attributes / NDP Attribute / NDP Control / Security Present
+ * Security configuration of the requested data-path.
*/
- bool securityRequired;
+ NanDataPathSecurityConfig securityConfig;
/**
* Arbitrary information communicated to the peer as part of the data-path setup process - there
* is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is
@@ -1226,17 +1263,13 @@
*/
vec<uint8_t> appInfo;
/**
- * Cipher type for the data-path being requested. Must be specified as |NanCipherSuiteType.NONE|
- * if no |pmk| is provided.
+ * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the
+ * data-path. Only relevant when a data-path is requested which is not associated with a NAN
+ * discovery session - e.g. using out-of-band discovery.
+ * Constraints: same as |NanDiscoveryCommonConfig.serviceName|
+ * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
- NanCipherSuiteType cipherType;
- /**
- * Pairwise Master Key (PMK) for the data-path being requested (if |securityRequired| is true).
- * The |cipherType| must be specified if a PMK is provided.
- * Max length: 32
- * Ref: IEEE 802.11i
- */
- vec<uint8_t> pmk;
+ vec<uint8_t> serviceNameOutOfBand;
};
/**
@@ -1259,10 +1292,9 @@
*/
string ifaceName;
/**
- * Specifies whether or not security is required for the data-path being created.
- * NAN Spec: Data Path Attributes / NDP Attribute / NDP Control / Security Present
+ * Security configuration of the requested data-path.
*/
- bool securityRequired;
+ NanDataPathSecurityConfig securityConfig;
/**
* Arbitrary information communicated to the peer as part of the data-path setup process - there
* is no semantic meaning to these bytes. They are passed-through from sender to receiver as-is
@@ -1272,16 +1304,13 @@
*/
vec<uint8_t> appInfo;
/**
- * Cipher type for the data-path being negotiated. Must be specified as |NanCipherSuiteType.NONE|
- * if no |pmk| is provided.
+ * A service name to be used with |passphrase| to construct a Pairwise Master Key (PMK) for the
+ * data-path. Only relevant when a data-path is requested which is not associated with a NAN
+ * discovery session - e.g. using out-of-band discovery.
+ * Constraints: same as |NanDiscoveryCommonConfig.serviceName|
+ * NAN Spec: Appendix: Mapping pass-phrase to PMK for NCS-SK Cipher Suites
*/
- NanCipherSuiteType cipherType;
- /**
- * Pairwise Master Key (PMK) for the data-path being negotiated (if |securityRequired| is true).
- * The |cipherType| must be specified if a PMK is provided.
- * Max length: 32
- */
- vec<uint8_t> pmk;
+ vec<uint8_t> serviceNameOutOfBand;
};
/**