Merge "Added more methods in IVirtualHal interface" into main
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 8bb8cd5..b67b9d2 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -64,6 +64,9 @@
],
min_sdk_version: "31",
},
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
@@ -112,6 +115,13 @@
],
}
+rust_defaults {
+ name: "latest_android_hardware_audio_common_rust",
+ rustlibs: [
+ latest_android_hardware_audio_common + "-rust",
+ ],
+}
+
aidl_interface_defaults {
name: "latest_android_hardware_audio_common_import_interface",
imports: [
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index 03de74f..7192d97 100644
--- a/audio/aidl/default/EffectImpl.cpp
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -23,6 +23,9 @@
#include "include/effect-impl/EffectTypes.h"
using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty;
+using aidl::android::hardware::audio::effect::kEventFlagNotEmpty;
+using aidl::android::hardware::audio::effect::kReopenSupportedVersion;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::PcmType;
using ::android::hardware::EventFlag;
@@ -43,7 +46,6 @@
ndk::ScopedAStatus EffectImpl::open(const Parameter::Common& common,
const std::optional<Parameter::Specific>& specific,
OpenEffectReturn* ret) {
- LOG(DEBUG) << getEffectName() << __func__;
// effect only support 32bits float
RETURN_IF(common.input.base.format.pcm != common.output.base.format.pcm ||
common.input.base.format.pcm != PcmType::FLOAT_32_BIT,
@@ -54,11 +56,12 @@
mImplContext = createContext(common);
RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
- int version = 0;
- RETURN_IF(!getInterfaceVersion(&version).isOk(), EX_UNSUPPORTED_OPERATION,
+ RETURN_IF(!getInterfaceVersion(&mVersion).isOk(), EX_UNSUPPORTED_OPERATION,
"FailedToGetInterfaceVersion");
- mImplContext->setVersion(version);
+ mImplContext->setVersion(mVersion);
mEventFlag = mImplContext->getStatusEventFlag();
+ mDataMqNotEmptyEf =
+ mVersion >= kReopenSupportedVersion ? kEventFlagDataMqNotEmpty : kEventFlagNotEmpty;
if (specific.has_value()) {
RETURN_IF_ASTATUS_NOT_OK(setParameterSpecific(specific.value()), "setSpecParamErr");
@@ -66,8 +69,9 @@
mState = State::IDLE;
mImplContext->dupeFmq(ret);
- RETURN_IF(createThread(getEffectName()) != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
- "FailedToCreateWorker");
+ RETURN_IF(createThread(getEffectNameWithVersion()) != RetCode::SUCCESS,
+ EX_UNSUPPORTED_OPERATION, "FailedToCreateWorker");
+ LOG(INFO) << getEffectNameWithVersion() << __func__;
return ndk::ScopedAStatus::ok();
}
@@ -89,7 +93,7 @@
mState = State::INIT;
}
- RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
"notifyEventFlagNotEmptyFailed");
// stop the worker thread, ignore the return code
RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
@@ -101,13 +105,13 @@
mImplContext.reset();
}
- LOG(DEBUG) << getEffectName() << __func__;
+ LOG(INFO) << getEffectNameWithVersion() << __func__;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
std::lock_guard lg(mImplMutex);
- LOG(VERBOSE) << getEffectName() << __func__ << " with: " << param.toString();
+ LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << " with: " << param.toString();
const auto& tag = param.getTag();
switch (tag) {
@@ -122,7 +126,7 @@
return setParameterSpecific(param.get<Parameter::specific>());
}
default: {
- LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag "
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << " unsupportedParameterTag "
<< toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"ParameterNotSupported");
@@ -147,7 +151,7 @@
break;
}
}
- LOG(VERBOSE) << getEffectName() << __func__ << id.toString() << param->toString();
+ LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << id.toString() << param->toString();
return ndk::ScopedAStatus::ok();
}
@@ -180,7 +184,7 @@
EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed");
break;
default: {
- LOG(ERROR) << getEffectName() << __func__ << " unsupportedParameterTag "
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << " unsupportedParameterTag "
<< toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"commonParamNotSupported");
@@ -214,7 +218,8 @@
break;
}
default: {
- LOG(DEBUG) << getEffectName() << __func__ << " unsupported tag " << toString(tag);
+ LOG(DEBUG) << getEffectNameWithVersion() << __func__ << " unsupported tag "
+ << toString(tag);
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"tagNotSupported");
}
@@ -236,7 +241,7 @@
RETURN_OK_IF(mState == State::PROCESSING);
RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
mState = State::PROCESSING;
- RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
"notifyEventFlagNotEmptyFailed");
startThread();
break;
@@ -244,17 +249,18 @@
case CommandId::RESET:
RETURN_OK_IF(mState == State::IDLE);
mState = State::IDLE;
- RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ RETURN_IF(notifyEventFlag(mDataMqNotEmptyEf) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
"notifyEventFlagNotEmptyFailed");
stopThread();
RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
break;
default:
- LOG(ERROR) << getEffectName() << __func__ << " instance still processing";
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << " instance still processing";
return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT,
"CommandIdNotSupported");
}
- LOG(VERBOSE) << getEffectName() << __func__ << " transfer to state: " << toString(mState);
+ LOG(VERBOSE) << getEffectNameWithVersion() << __func__
+ << " transfer to state: " << toString(mState);
return ndk::ScopedAStatus::ok();
}
@@ -284,14 +290,14 @@
RetCode EffectImpl::notifyEventFlag(uint32_t flag) {
if (!mEventFlag) {
- LOG(ERROR) << getEffectName() << __func__ << ": StatusEventFlag invalid";
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": StatusEventFlag invalid";
return RetCode::ERROR_EVENT_FLAG_ERROR;
}
if (const auto ret = mEventFlag->wake(flag); ret != ::android::OK) {
- LOG(ERROR) << getEffectName() << __func__ << ": wake failure with ret " << ret;
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": wake failure with ret " << ret;
return RetCode::ERROR_EVENT_FLAG_ERROR;
}
- LOG(VERBOSE) << getEffectName() << __func__ << ": " << std::hex << mEventFlag;
+ LOG(VERBOSE) << getEffectNameWithVersion() << __func__ << ": " << std::hex << mEventFlag;
return RetCode::SUCCESS;
}
@@ -304,17 +310,17 @@
}
void EffectImpl::process() {
- ATRACE_NAME(getEffectName().c_str());
+ ATRACE_NAME(getEffectNameWithVersion().c_str());
/**
* wait for the EventFlag without lock, it's ok because the mEfGroup pointer will not change
* in the life cycle of workerThread (threadLoop).
*/
uint32_t efState = 0;
if (!mEventFlag ||
- ::android::OK != mEventFlag->wait(kEventFlagNotEmpty, &efState, 0 /* no timeout */,
+ ::android::OK != mEventFlag->wait(mDataMqNotEmptyEf, &efState, 0 /* no timeout */,
true /* retry */) ||
- !(efState & kEventFlagNotEmpty)) {
- LOG(ERROR) << getEffectName() << __func__ << ": StatusEventFlag - " << mEventFlag
+ !(efState & mDataMqNotEmptyEf)) {
+ LOG(ERROR) << getEffectNameWithVersion() << __func__ << ": StatusEventFlag - " << mEventFlag
<< " efState - " << std::hex << efState;
return;
}
@@ -322,7 +328,8 @@
{
std::lock_guard lg(mImplMutex);
if (mState != State::PROCESSING) {
- LOG(DEBUG) << getEffectName() << " skip process in state: " << toString(mState);
+ LOG(DEBUG) << getEffectNameWithVersion()
+ << " skip process in state: " << toString(mState);
return;
}
RETURN_VALUE_IF(!mImplContext, void(), "nullContext");
diff --git a/audio/aidl/default/include/effect-impl/EffectImpl.h b/audio/aidl/default/include/effect-impl/EffectImpl.h
index 21f6502..d3bb7f4 100644
--- a/audio/aidl/default/include/effect-impl/EffectImpl.h
+++ b/audio/aidl/default/include/effect-impl/EffectImpl.h
@@ -89,6 +89,11 @@
void process() override;
protected:
+ // current Hal version
+ int mVersion = 0;
+ // Use kEventFlagNotEmpty for V1 HAL, kEventFlagDataMqNotEmpty for V2 and above
+ int mDataMqNotEmptyEf = aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty;
+
State mState GUARDED_BY(mImplMutex) = State::INIT;
IEffect::Status status(binder_status_t status, size_t consumed, size_t produced);
@@ -107,6 +112,11 @@
virtual ndk::ScopedAStatus commandImpl(CommandId id) REQUIRES(mImplMutex);
RetCode notifyEventFlag(uint32_t flag);
+
+ std::string getEffectNameWithVersion() {
+ return getEffectName() + "V" + std::to_string(mVersion);
+ }
+
::android::hardware::EventFlag* mEventFlag;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 0d1e0dc..0fdf7a7 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -43,8 +43,10 @@
using aidl::android::hardware::audio::effect::CommandId;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::hardware::audio::effect::kEventFlagDataMqNotEmpty;
using aidl::android::hardware::audio::effect::kEventFlagDataMqUpdate;
using aidl::android::hardware::audio::effect::kEventFlagNotEmpty;
+using aidl::android::hardware::audio::effect::kReopenSupportedVersion;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Range;
using aidl::android::hardware::audio::effect::State;
@@ -160,7 +162,7 @@
std::fill(buffer.begin(), buffer.end(), 0x5a);
}
static void writeToFmq(std::unique_ptr<StatusMQ>& statusMq, std::unique_ptr<DataMQ>& dataMq,
- const std::vector<float>& buffer) {
+ const std::vector<float>& buffer, int version) {
const size_t available = dataMq->availableToWrite();
ASSERT_NE(0Ul, available);
auto bufferFloats = buffer.size();
@@ -171,7 +173,8 @@
ASSERT_EQ(::android::OK,
EventFlag::createEventFlag(statusMq->getEventFlagWord(), &efGroup));
ASSERT_NE(nullptr, efGroup);
- efGroup->wake(kEventFlagNotEmpty);
+ efGroup->wake(version >= kReopenSupportedVersion ? kEventFlagDataMqNotEmpty
+ : kEventFlagNotEmpty);
ASSERT_EQ(::android::OK, EventFlag::deleteEventFlag(&efGroup));
}
static void readFromFmq(std::unique_ptr<StatusMQ>& statusMq, size_t statusNum,
@@ -322,7 +325,10 @@
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
// Write from buffer to message queues and calling process
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, inputBuffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, inputBuffer, [&]() {
+ int version = 0;
+ return (mEffect && mEffect->getInterfaceVersion(&version).isOk()) ? version : 0;
+ }()));
// Read the updated message queues into buffer
EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 1, outputMQ,
diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp
index 2b86271..d24c4c8 100644
--- a/audio/aidl/vts/ModuleConfig.cpp
+++ b/audio/aidl/vts/ModuleConfig.cpp
@@ -551,6 +551,11 @@
return result;
}
+std::optional<AudioPort> ModuleConfig::getPort(int32_t portId) {
+ auto portsIt = findById(mPorts, portId);
+ return portsIt != mPorts.end() ? std::optional<AudioPort>(*portsIt) : std::nullopt;
+}
+
ndk::ScopedAStatus ModuleConfig::onExternalDeviceConnected(IModule* module, const AudioPort& port) {
RETURN_STATUS_IF_ERROR(module->getAudioPorts(&mPorts));
RETURN_STATUS_IF_ERROR(module->getAudioRoutes(&mRoutes));
diff --git a/audio/aidl/vts/ModuleConfig.h b/audio/aidl/vts/ModuleConfig.h
index 4a87f8c..27286e5 100644
--- a/audio/aidl/vts/ModuleConfig.h
+++ b/audio/aidl/vts/ModuleConfig.h
@@ -166,6 +166,8 @@
return *config.begin();
}
+ std::optional<aidl::android::media::audio::common::AudioPort> getPort(int32_t portId);
+
ndk::ScopedAStatus onExternalDeviceConnected(
aidl::android::hardware::audio::core::IModule* module,
const aidl::android::media::audio::common::AudioPort& port);
diff --git a/audio/aidl/vts/TestUtils.h b/audio/aidl/vts/TestUtils.h
index 0a5addc..3a6c137 100644
--- a/audio/aidl/vts/TestUtils.h
+++ b/audio/aidl/vts/TestUtils.h
@@ -108,7 +108,7 @@
({ \
if ((flags).hwAcceleratorMode == \
aidl::android::hardware::audio::effect::Flags::HardwareAccelerator::TUNNEL || \
- (flags).bypass) { \
+ (flags).bypass || (flags).offloadIndication) { \
GTEST_SKIP() << "Skip data path for offload"; \
} \
})
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 8b08945..d576c7c 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -133,13 +133,23 @@
}
template <typename C>
-std::vector<int32_t> GetNonExistentIds(const C& allIds) {
+std::vector<int32_t> GetNonExistentIds(const C& allIds, bool includeZero = true) {
if (allIds.empty()) {
- return std::vector<int32_t>{-1, 0, 1};
+ return includeZero ? std::vector<int32_t>{-1, 0, 1} : std::vector<int32_t>{-1, 1};
}
std::vector<int32_t> nonExistentIds;
- nonExistentIds.push_back(*std::min_element(allIds.begin(), allIds.end()) - 1);
- nonExistentIds.push_back(*std::max_element(allIds.begin(), allIds.end()) + 1);
+ if (auto value = *std::min_element(allIds.begin(), allIds.end()) - 1;
+ includeZero || value != 0) {
+ nonExistentIds.push_back(value);
+ } else {
+ nonExistentIds.push_back(value - 1);
+ }
+ if (auto value = *std::max_element(allIds.begin(), allIds.end()) + 1;
+ includeZero || value != 0) {
+ nonExistentIds.push_back(value);
+ } else {
+ nonExistentIds.push_back(value + 1);
+ }
return nonExistentIds;
}
@@ -781,6 +791,13 @@
};
return helper(v.begin(), helper);
}
+ Node makeNodes(StreamDescriptor::State s, TransitionTrigger t, size_t count, Node last) {
+ auto helper = [&](size_t c, auto&& h) -> Node {
+ if (c == 0) return last;
+ return makeNode(s, t, h(--c, h));
+ };
+ return helper(count, helper);
+ }
Node makeNodes(const std::vector<StateTransitionFrom>& v, StreamDescriptor::State f) {
return makeNodes(v, makeFinalNode(f));
}
@@ -1040,7 +1057,9 @@
<< ": received invalid byte count in the reply: " << reply.fmqByteCount;
return Status::ABORT;
}
- if (getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
+ // It is OK for the implementation to leave data in the MQ when the stream is paused.
+ if (reply.state != StreamDescriptor::State::PAUSED &&
+ getDataMQ()->availableToWrite() != getDataMQ()->getQuantumCount()) {
LOG(ERROR) << __func__ << ": the HAL module did not consume all data from the data MQ: "
<< "available to write " << getDataMQ()->availableToWrite()
<< ", total size: " << getDataMQ()->getQuantumCount();
@@ -2883,6 +2902,182 @@
std::unique_ptr<WithStream<Stream>> mStream;
};
+class StreamLogicDefaultDriver : public StreamLogicDriver {
+ public:
+ StreamLogicDefaultDriver(std::shared_ptr<StateSequence> commands, size_t frameSizeBytes)
+ : mCommands(commands), mFrameSizeBytes(frameSizeBytes) {
+ mCommands->rewind();
+ }
+
+ // The three methods below is intended to be called after the worker
+ // thread has joined, thus no extra synchronization is needed.
+ bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; }
+ bool hasRetrogradeObservablePosition() const { return mRetrogradeObservablePosition; }
+ std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; }
+
+ bool done() override { return mCommands->done(); }
+ TransitionTrigger getNextTrigger(int maxDataSize, int* actualSize) override {
+ auto trigger = mCommands->getTrigger();
+ if (StreamDescriptor::Command* command = std::get_if<StreamDescriptor::Command>(&trigger);
+ command != nullptr) {
+ if (command->getTag() == StreamDescriptor::Command::Tag::burst) {
+ if (actualSize != nullptr) {
+ // In the output scenario, reduce slightly the fmqByteCount to verify
+ // that the HAL module always consumes all data from the MQ.
+ if (maxDataSize > static_cast<int>(mFrameSizeBytes)) {
+ LOG(DEBUG) << __func__ << ": reducing data size by " << mFrameSizeBytes;
+ maxDataSize -= mFrameSizeBytes;
+ }
+ *actualSize = maxDataSize;
+ }
+ command->set<StreamDescriptor::Command::Tag::burst>(maxDataSize);
+ } else {
+ if (actualSize != nullptr) *actualSize = 0;
+ }
+ }
+ return trigger;
+ }
+ bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; }
+ bool processValidReply(const StreamDescriptor::Reply& reply) override {
+ if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) {
+ if (mPreviousFrames.has_value()) {
+ if (reply.observable.frames > mPreviousFrames.value()) {
+ mObservablePositionIncrease = true;
+ } else if (reply.observable.frames < mPreviousFrames.value()) {
+ mRetrogradeObservablePosition = true;
+ }
+ }
+ mPreviousFrames = reply.observable.frames;
+ }
+
+ auto expected = mCommands->getExpectedStates();
+ if (expected.count(reply.state) == 0) {
+ std::string s =
+ std::string("Unexpected transition from the state ")
+ .append(mPreviousState.has_value() ? toString(mPreviousState.value())
+ : "<initial state>")
+ .append(" to ")
+ .append(toString(reply.state))
+ .append(" (expected one of ")
+ .append(::android::internal::ToString(expected))
+ .append(") caused by the ")
+ .append(toString(mCommands->getTrigger()));
+ LOG(ERROR) << __func__ << ": " << s;
+ mUnexpectedTransition = std::move(s);
+ return false;
+ }
+ mCommands->advance(reply.state);
+ mPreviousState = reply.state;
+ return true;
+ }
+
+ protected:
+ std::shared_ptr<StateSequence> mCommands;
+ const size_t mFrameSizeBytes;
+ std::optional<StreamDescriptor::State> mPreviousState;
+ std::optional<int64_t> mPreviousFrames;
+ bool mObservablePositionIncrease = false;
+ bool mRetrogradeObservablePosition = false;
+ std::string mUnexpectedTransition;
+};
+
+// Defined later together with state transition sequences.
+std::shared_ptr<StateSequence> makeBurstCommands(bool isSync);
+
+// Certain types of ports can not be used without special preconditions.
+static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig) {
+ return (portConfig.flags.value().getTag() == AudioIoFlags::input &&
+ isAnyBitPositionFlagSet(portConfig.flags.value().template get<AudioIoFlags::input>(),
+ {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX,
+ AudioInputFlags::HW_HOTWORD, AudioInputFlags::HOTWORD_TAP})) ||
+ (portConfig.flags.value().getTag() == AudioIoFlags::output &&
+ isAnyBitPositionFlagSet(
+ portConfig.flags.value().template get<AudioIoFlags::output>(),
+ {AudioOutputFlags::MMAP_NOIRQ, AudioOutputFlags::VOIP_RX,
+ AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}));
+}
+
+// Certain types of devices can not be used without special preconditions.
+static bool skipStreamIoTestForDevice(const AudioDevice& device) {
+ return device.type.type == AudioDeviceType::IN_ECHO_REFERENCE;
+}
+
+template <typename Stream>
+class StreamFixtureWithWorker {
+ public:
+ explicit StreamFixtureWithWorker(bool isSync) : mIsSync(isSync) {}
+
+ void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) {
+ mStream = std::make_unique<StreamFixture<Stream>>();
+ ASSERT_NO_FATAL_FAILURE(
+ mStream->SetUpStreamForDevicePort(module, moduleConfig, devicePort));
+ MaybeSetSkipTestReason();
+ }
+
+ void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& mixPort,
+ const AudioPort& devicePort) {
+ mStream = std::make_unique<StreamFixture<Stream>>();
+ ASSERT_NO_FATAL_FAILURE(
+ mStream->SetUpStreamForPortsPair(module, moduleConfig, mixPort, devicePort));
+ MaybeSetSkipTestReason();
+ }
+
+ void SendBurstCommands(bool validatePosition = true) {
+ ASSERT_NO_FATAL_FAILURE(StartWorkerToSendBurstCommands());
+ ASSERT_NO_FATAL_FAILURE(JoinWorkerAfterBurstCommands(validatePosition));
+ }
+
+ void StartWorkerToSendBurstCommands() {
+ const StreamContext* context = mStream->getStreamContext();
+ mWorkerDriver = std::make_unique<StreamLogicDefaultDriver>(makeBurstCommands(mIsSync),
+ context->getFrameSizeBytes());
+ mWorker = std::make_unique<typename IOTraits<Stream>::Worker>(
+ *context, mWorkerDriver.get(), mStream->getStreamEventReceiver());
+ LOG(DEBUG) << __func__ << ": starting " << IOTraits<Stream>::directionStr << " worker...";
+ ASSERT_TRUE(mWorker->start());
+ }
+
+ void JoinWorkerAfterBurstCommands(bool validatePosition = true) {
+ // Must call 'prepareToClose' before attempting to join because the stream may be stuck.
+ std::shared_ptr<IStreamCommon> common;
+ ASSERT_IS_OK(mStream->getStream()->getStreamCommon(&common));
+ ASSERT_IS_OK(common->prepareToClose());
+ LOG(DEBUG) << __func__ << ": joining " << IOTraits<Stream>::directionStr << " worker...";
+ mWorker->join();
+ EXPECT_FALSE(mWorker->hasError()) << mWorker->getError();
+ EXPECT_EQ("", mWorkerDriver->getUnexpectedStateTransition());
+ if (validatePosition) {
+ if (IOTraits<Stream>::is_input) {
+ EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease());
+ }
+ EXPECT_FALSE(mWorkerDriver->hasRetrogradeObservablePosition());
+ }
+ mWorker.reset();
+ mWorkerDriver.reset();
+ }
+
+ void TeardownPatch() { mStream->TeardownPatch(); }
+
+ const AudioDevice& getDevice() const { return mStream->getDevice(); }
+ Stream* getStream() const { return mStream->getStream(); }
+ std::string skipTestReason() const {
+ return !mSkipTestReason.empty() ? mSkipTestReason : mStream->skipTestReason();
+ }
+
+ private:
+ void MaybeSetSkipTestReason() {
+ if (skipStreamIoTestForMixPortConfig(mStream->getPortConfig())) {
+ mSkipTestReason = "Mix port config is not supported for stream I/O tests";
+ }
+ }
+
+ const bool mIsSync;
+ std::string mSkipTestReason;
+ std::unique_ptr<StreamFixture<Stream>> mStream;
+ std::unique_ptr<StreamLogicDefaultDriver> mWorkerDriver;
+ std::unique_ptr<typename IOTraits<Stream>::Worker> mWorker;
+};
+
template <typename Stream>
class AudioStream : public AudioCoreModule {
public:
@@ -3288,10 +3483,12 @@
if (micDevicePorts.empty()) continue;
atLeastOnePort = true;
SCOPED_TRACE(port.toString());
- StreamFixture<IStreamIn> stream;
- ASSERT_NO_FATAL_FAILURE(stream.SetUpStreamForPortsPair(module.get(), moduleConfig.get(),
- port, micDevicePorts[0]));
+ StreamFixtureWithWorker<IStreamIn> stream(true /*isSync*/);
+ ASSERT_NO_FATAL_FAILURE(
+ stream.SetUp(module.get(), moduleConfig.get(), port, micDevicePorts[0]));
if (!stream.skipTestReason().empty()) continue;
+
+ ASSERT_NO_FATAL_FAILURE(stream.SendBurstCommands(false /*validatePosition*/));
std::vector<MicrophoneDynamicInfo> activeMics;
EXPECT_IS_OK(stream.getStream()->getActiveMicrophones(&activeMics));
EXPECT_FALSE(activeMics.empty());
@@ -3305,6 +3502,7 @@
EXPECT_NE(0UL, mic.channelMapping.size())
<< "No channels specified for the microphone \"" << mic.id << "\"";
}
+
stream.TeardownPatch();
// Now the port of the stream is not connected, check that there are no active microphones.
std::vector<MicrophoneDynamicInfo> emptyMics;
@@ -3682,85 +3880,6 @@
}
}
-class StreamLogicDefaultDriver : public StreamLogicDriver {
- public:
- StreamLogicDefaultDriver(std::shared_ptr<StateSequence> commands, size_t frameSizeBytes)
- : mCommands(commands), mFrameSizeBytes(frameSizeBytes) {
- mCommands->rewind();
- }
-
- // The three methods below is intended to be called after the worker
- // thread has joined, thus no extra synchronization is needed.
- bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; }
- bool hasRetrogradeObservablePosition() const { return mRetrogradeObservablePosition; }
- std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; }
-
- bool done() override { return mCommands->done(); }
- TransitionTrigger getNextTrigger(int maxDataSize, int* actualSize) override {
- auto trigger = mCommands->getTrigger();
- if (StreamDescriptor::Command* command = std::get_if<StreamDescriptor::Command>(&trigger);
- command != nullptr) {
- if (command->getTag() == StreamDescriptor::Command::Tag::burst) {
- if (actualSize != nullptr) {
- // In the output scenario, reduce slightly the fmqByteCount to verify
- // that the HAL module always consumes all data from the MQ.
- if (maxDataSize > static_cast<int>(mFrameSizeBytes)) {
- LOG(DEBUG) << __func__ << ": reducing data size by " << mFrameSizeBytes;
- maxDataSize -= mFrameSizeBytes;
- }
- *actualSize = maxDataSize;
- }
- command->set<StreamDescriptor::Command::Tag::burst>(maxDataSize);
- } else {
- if (actualSize != nullptr) *actualSize = 0;
- }
- }
- return trigger;
- }
- bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; }
- bool processValidReply(const StreamDescriptor::Reply& reply) override {
- if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) {
- if (mPreviousFrames.has_value()) {
- if (reply.observable.frames > mPreviousFrames.value()) {
- mObservablePositionIncrease = true;
- } else if (reply.observable.frames < mPreviousFrames.value()) {
- mRetrogradeObservablePosition = true;
- }
- }
- mPreviousFrames = reply.observable.frames;
- }
-
- auto expected = mCommands->getExpectedStates();
- if (expected.count(reply.state) == 0) {
- std::string s =
- std::string("Unexpected transition from the state ")
- .append(mPreviousState.has_value() ? toString(mPreviousState.value())
- : "<initial state>")
- .append(" to ")
- .append(toString(reply.state))
- .append(" (expected one of ")
- .append(::android::internal::ToString(expected))
- .append(") caused by the ")
- .append(toString(mCommands->getTrigger()));
- LOG(ERROR) << __func__ << ": " << s;
- mUnexpectedTransition = std::move(s);
- return false;
- }
- mCommands->advance(reply.state);
- mPreviousState = reply.state;
- return true;
- }
-
- protected:
- std::shared_ptr<StateSequence> mCommands;
- const size_t mFrameSizeBytes;
- std::optional<StreamDescriptor::State> mPreviousState;
- std::optional<int64_t> mPreviousFrames;
- bool mObservablePositionIncrease = false;
- bool mRetrogradeObservablePosition = false;
- std::string mUnexpectedTransition;
-};
-
enum {
NAMED_CMD_NAME,
NAMED_CMD_DELAY_MS,
@@ -3791,20 +3910,11 @@
GTEST_SKIP() << "No mix ports have attached devices";
}
for (const auto& portConfig : allPortConfigs) {
+ auto port = moduleConfig->getPort(portConfig.portId);
+ ASSERT_TRUE(port.has_value());
+ SCOPED_TRACE(port->toString());
SCOPED_TRACE(portConfig.toString());
- // Certain types of ports can not be used without special preconditions.
- if ((IOTraits<Stream>::is_input &&
- isAnyBitPositionFlagSet(
- portConfig.flags.value().template get<AudioIoFlags::Tag::input>(),
- {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX,
- AudioInputFlags::HW_HOTWORD})) ||
- (!IOTraits<Stream>::is_input &&
- isAnyBitPositionFlagSet(
- portConfig.flags.value().template get<AudioIoFlags::Tag::output>(),
- {AudioOutputFlags::MMAP_NOIRQ, AudioOutputFlags::VOIP_RX,
- AudioOutputFlags::COMPRESS_OFFLOAD, AudioOutputFlags::INCALL_MUSIC}))) {
- continue;
- }
+ if (skipStreamIoTestForMixPortConfig(portConfig)) continue;
const bool isNonBlocking =
IOTraits<Stream>::is_input
? false
@@ -3885,6 +3995,7 @@
StreamFixture<Stream> stream;
ASSERT_NO_FATAL_FAILURE(
stream.SetUpStreamForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
+ if (skipStreamIoTestForDevice(stream.getDevice())) return;
ASSERT_EQ("", stream.skipTestReason());
StreamLogicDefaultDriver driver(commandsAndStates,
stream.getStreamContext()->getFrameSizeBytes());
@@ -3913,6 +4024,7 @@
StreamFixture<Stream> stream;
ASSERT_NO_FATAL_FAILURE(
stream.SetUpPatchForMixPortConfig(module.get(), moduleConfig.get(), portConfig));
+ if (skipStreamIoTestForDevice(stream.getDevice())) return;
ASSERT_EQ("", stream.skipTestReason());
ASSERT_NO_FATAL_FAILURE(stream.TeardownPatchSetUpStream(module.get()));
StreamLogicDefaultDriver driver(commandsAndStates,
@@ -4111,7 +4223,7 @@
// Then use the same patch setting, except for having an invalid ID.
std::set<int32_t> patchIds;
ASSERT_NO_FATAL_FAILURE(GetAllPatchIds(&patchIds));
- for (const auto patchId : GetNonExistentIds(patchIds)) {
+ for (const auto patchId : GetNonExistentIds(patchIds, false /*includeZero*/)) {
AudioPatch patchWithNonExistendId = patch.get();
patchWithNonExistendId.id = patchId;
EXPECT_STATUS(EX_ILLEGAL_ARGUMENT,
@@ -4294,17 +4406,22 @@
using State = StreamDescriptor::State;
auto d = std::make_unique<StateDag>();
StateDag::Node last = d->makeFinalNode(State::ACTIVE);
- // Use a couple of bursts to ensure that the driver starts reporting the position.
- StateDag::Node active2 = d->makeNode(State::ACTIVE, kBurstCommand, last);
- StateDag::Node active = d->makeNode(State::ACTIVE, kBurstCommand, active2);
- StateDag::Node idle = d->makeNode(State::IDLE, kBurstCommand, active);
- if (!isSync) {
+ if (isSync) {
+ StateDag::Node idle = d->makeNode(
+ State::IDLE, kBurstCommand,
+ // Use several bursts to ensure that the driver starts reporting the position.
+ d->makeNodes(State::ACTIVE, kBurstCommand, 10, last));
+ d->makeNode(State::STANDBY, kStartCommand, idle);
+ } else {
+ StateDag::Node active2 = d->makeNode(State::ACTIVE, kBurstCommand, last);
+ StateDag::Node active = d->makeNode(State::ACTIVE, kBurstCommand, active2);
+ StateDag::Node idle = d->makeNode(State::IDLE, kBurstCommand, active);
// Allow optional routing via the TRANSFERRING state on bursts.
active2.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, last));
active.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, active2));
idle.children().push_back(d->makeNode(State::TRANSFERRING, kTransferReadyEvent, active));
+ d->makeNode(State::STANDBY, kStartCommand, idle);
}
- d->makeNode(State::STANDBY, kStartCommand, idle);
return std::make_shared<StateSequenceFollower>(std::move(d));
}
static const NamedCommandSequence kReadSeq =
@@ -4467,9 +4584,8 @@
std::make_pair(State::PAUSED, kStartCommand),
std::make_pair(State::ACTIVE, kPauseCommand),
std::make_pair(State::PAUSED, kBurstCommand),
- std::make_pair(State::PAUSED, kStartCommand),
- std::make_pair(State::ACTIVE, kPauseCommand)},
- State::PAUSED);
+ std::make_pair(State::PAUSED, kFlushCommand)},
+ State::IDLE);
if (!isSync) {
idle.children().push_back(
d->makeNodes({std::make_pair(State::TRANSFERRING, kPauseCommand),
@@ -4616,8 +4732,9 @@
template <typename Stream>
class WithRemoteSubmix {
public:
- WithRemoteSubmix() = default;
- explicit WithRemoteSubmix(AudioDeviceAddress address) : mAddress(address) {}
+ WithRemoteSubmix() : mStream(true /*isSync*/) {}
+ explicit WithRemoteSubmix(AudioDeviceAddress address)
+ : mStream(true /*isSync*/), mAddress(address) {}
WithRemoteSubmix(const WithRemoteSubmix&) = delete;
WithRemoteSubmix& operator=(const WithRemoteSubmix&) = delete;
@@ -4637,57 +4754,31 @@
void SetUp(IModule* module, ModuleConfig* moduleConfig) {
auto devicePort = getRemoteSubmixAudioPort(moduleConfig, mAddress);
ASSERT_TRUE(devicePort.has_value()) << "Device port for remote submix device not found";
- ASSERT_NO_FATAL_FAILURE(SetUp(module, moduleConfig, *devicePort));
+ ASSERT_NO_FATAL_FAILURE(mStream.SetUp(module, moduleConfig, *devicePort));
+ mAddress = mStream.getDevice().address;
}
- void SendBurstCommandsStartWorker() {
- const StreamContext* context = mStream->getStreamContext();
- mWorkerDriver = std::make_unique<StreamLogicDefaultDriver>(makeBurstCommands(true),
- context->getFrameSizeBytes());
- mWorker = std::make_unique<typename IOTraits<Stream>::Worker>(
- *context, mWorkerDriver.get(), mStream->getStreamEventReceiver());
- LOG(DEBUG) << __func__ << ": starting " << IOTraits<Stream>::directionStr << " worker...";
- ASSERT_TRUE(mWorker->start());
+ void StartWorkerToSendBurstCommands() {
+ ASSERT_NO_FATAL_FAILURE(mStream.StartWorkerToSendBurstCommands());
}
- void SendBurstCommandsJoinWorker() {
- // Must call 'prepareToClose' before attempting to join because the stream may be
- // stuck due to absence of activity from the other side of the remote submix pipe.
- std::shared_ptr<IStreamCommon> common;
- ASSERT_IS_OK(mStream->getStream()->getStreamCommon(&common));
- ASSERT_IS_OK(common->prepareToClose());
- LOG(DEBUG) << __func__ << ": joining " << IOTraits<Stream>::directionStr << " worker...";
- mWorker->join();
- EXPECT_FALSE(mWorker->hasError()) << mWorker->getError();
- EXPECT_EQ("", mWorkerDriver->getUnexpectedStateTransition());
- if (IOTraits<Stream>::is_input) {
- EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease());
- }
- EXPECT_FALSE(mWorkerDriver->hasRetrogradeObservablePosition());
- mWorker.reset();
- mWorkerDriver.reset();
+ void JoinWorkerAfterBurstCommands() {
+ ASSERT_NO_FATAL_FAILURE(mStream.JoinWorkerAfterBurstCommands());
}
void SendBurstCommands() {
- ASSERT_NO_FATAL_FAILURE(SendBurstCommandsStartWorker());
- ASSERT_NO_FATAL_FAILURE(SendBurstCommandsJoinWorker());
+ ASSERT_NO_FATAL_FAILURE(mStream.StartWorkerToSendBurstCommands());
+ ASSERT_NO_FATAL_FAILURE(mStream.JoinWorkerAfterBurstCommands());
}
std::optional<AudioDeviceAddress> getAudioDeviceAddress() const { return mAddress; }
- std::string skipTestReason() const { return mStream->skipTestReason(); }
+ std::string skipTestReason() const { return mStream.skipTestReason(); }
private:
- void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) {
- mStream = std::make_unique<StreamFixture<Stream>>();
- ASSERT_NO_FATAL_FAILURE(
- mStream->SetUpStreamForDevicePort(module, moduleConfig, devicePort));
- mAddress = mStream->getDevice().address;
- }
+ void SetUp(IModule* module, ModuleConfig* moduleConfig, const AudioPort& devicePort) {}
+ StreamFixtureWithWorker<Stream> mStream;
std::optional<AudioDeviceAddress> mAddress;
- std::unique_ptr<StreamFixture<Stream>> mStream;
- std::unique_ptr<StreamLogicDefaultDriver> mWorkerDriver;
- std::unique_ptr<typename IOTraits<Stream>::Worker> mWorker;
};
class AudioModuleRemoteSubmix : public AudioCoreModule {
@@ -4737,10 +4828,10 @@
ASSERT_EQ("", streamIn.skipTestReason());
// Start writing into the output stream.
- ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsStartWorker());
+ ASSERT_NO_FATAL_FAILURE(streamOut.StartWorkerToSendBurstCommands());
// Simultaneously, read from the input stream.
ASSERT_NO_FATAL_FAILURE(streamIn.SendBurstCommands());
- ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsJoinWorker());
+ ASSERT_NO_FATAL_FAILURE(streamOut.JoinWorkerAfterBurstCommands());
}
TEST_P(AudioModuleRemoteSubmix, OpenInputMultipleTimes) {
@@ -4758,15 +4849,15 @@
ASSERT_EQ("", streamIns[i]->skipTestReason());
}
// Start writing into the output stream.
- ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsStartWorker());
+ ASSERT_NO_FATAL_FAILURE(streamOut.StartWorkerToSendBurstCommands());
// Simultaneously, read from input streams.
for (size_t i = 0; i < streamInCount; i++) {
- ASSERT_NO_FATAL_FAILURE(streamIns[i]->SendBurstCommandsStartWorker());
+ ASSERT_NO_FATAL_FAILURE(streamIns[i]->StartWorkerToSendBurstCommands());
}
for (size_t i = 0; i < streamInCount; i++) {
- ASSERT_NO_FATAL_FAILURE(streamIns[i]->SendBurstCommandsJoinWorker());
+ ASSERT_NO_FATAL_FAILURE(streamIns[i]->JoinWorkerAfterBurstCommands());
}
- ASSERT_NO_FATAL_FAILURE(streamOut.SendBurstCommandsJoinWorker());
+ ASSERT_NO_FATAL_FAILURE(streamOut.JoinWorkerAfterBurstCommands());
// Clean up input streams in the reverse order because the device connection is owned
// by the first one.
for (size_t i = streamInCount; i != 0; --i) {
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 4693f10..5b83d73 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -42,7 +42,6 @@
using aidl::android::hardware::audio::effect::Flags;
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::IFactory;
-using aidl::android::hardware::audio::effect::kReopenSupportedVersion;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::AudioDeviceDescription;
@@ -58,6 +57,7 @@
public:
AudioEffectTest() {
std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
+ mVersion = EffectFactoryHelper::getHalVersion(mFactory);
}
void SetUp() override {}
@@ -76,6 +76,7 @@
std::shared_ptr<IFactory> mFactory;
std::shared_ptr<IEffect> mEffect;
Descriptor mDescriptor;
+ int mVersion = 0;
void setAndGetParameter(Parameter::Id id, const Parameter& set) {
Parameter get;
@@ -682,7 +683,7 @@
std::vector<float> buffer;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
@@ -722,7 +723,7 @@
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
@@ -759,7 +760,7 @@
ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START));
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
@@ -779,7 +780,7 @@
// verify data consume again
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
@@ -810,7 +811,7 @@
std::vector<float> buffer;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START));
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
@@ -844,7 +845,7 @@
std::vector<float> buffer;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer));
ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START));
@@ -853,7 +854,7 @@
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
@@ -886,13 +887,13 @@
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
std::vector<float> buffer;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::STOP));
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::IDLE));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer));
ASSERT_NO_FATAL_FAILURE(command(mEffect, CommandId::START));
@@ -928,7 +929,7 @@
std::vector<float> buffer;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common, inputMQ, buffer));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ, inputMQ, buffer, mVersion));
EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(statusMQ, 0, outputMQ, 0, buffer));
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
@@ -964,7 +965,7 @@
std::vector<float> buffer1, buffer2;
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common1, inputMQ1, buffer1));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ1, inputMQ1, buffer1));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ1, inputMQ1, buffer1, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ1, 1, outputMQ1, buffer1.size(), buffer1));
@@ -975,7 +976,7 @@
auto outputMQ2 = std::make_unique<EffectHelper::DataMQ>(ret2.outputDataMQ);
ASSERT_TRUE(outputMQ2->isValid());
EXPECT_NO_FATAL_FAILURE(EffectHelper::allocateInputData(common2, inputMQ2, buffer2));
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ2, inputMQ2, buffer2));
+ EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(statusMQ2, inputMQ2, buffer2, mVersion));
EXPECT_NO_FATAL_FAILURE(
EffectHelper::readFromFmq(statusMQ2, 1, outputMQ2, buffer2.size(), buffer2));
diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
index a075423..7a53502 100644
--- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
@@ -53,6 +53,7 @@
kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE));
ASSERT_NE(nullptr, mEffect);
+ mVersion = EffectFactoryHelper::getHalVersion(mFactory);
}
void TearDownLoudnessEnhancer() {
@@ -114,6 +115,7 @@
std::shared_ptr<IFactory> mFactory;
std::shared_ptr<IEffect> mEffect;
Descriptor mDescriptor;
+ int mVersion = 0;
};
/**
@@ -190,7 +192,8 @@
ASSERT_NO_FATAL_FAILURE(expectState(mEffect, State::PROCESSING));
// Write from buffer to message queues and calling process
- EXPECT_NO_FATAL_FAILURE(EffectHelper::writeToFmq(mStatusMQ, mInputMQ, mInputBuffer));
+ EXPECT_NO_FATAL_FAILURE(
+ EffectHelper::writeToFmq(mStatusMQ, mInputMQ, mInputBuffer, mVersion));
// Read the updated message queues into buffer
EXPECT_NO_FATAL_FAILURE(EffectHelper::readFromFmq(mStatusMQ, 1, mOutputMQ,
diff --git a/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp b/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp
index 4308d52..d63695d 100644
--- a/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp
+++ b/automotive/audiocontrol/1.0/default/test/fuzzer/Android.bp
@@ -19,6 +19,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/audiocontrol/aidl/vts/Android.bp b/automotive/audiocontrol/aidl/vts/Android.bp
index c73ad79..d94ad55 100644
--- a/automotive/audiocontrol/aidl/vts/Android.bp
+++ b/automotive/audiocontrol/aidl/vts/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/can/1.0/default/tests/fuzzer/Android.bp b/automotive/can/1.0/default/tests/fuzzer/Android.bp
index de0b96f..01c8a9d 100644
--- a/automotive/can/1.0/default/tests/fuzzer/Android.bp
+++ b/automotive/can/1.0/default/tests/fuzzer/Android.bp
@@ -16,6 +16,7 @@
*/
package {
+ default_team: "trendy_team_connectivity_telemetry",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/can/1.0/tools/libprotocan/tests/Android.bp b/automotive/can/1.0/tools/libprotocan/tests/Android.bp
index 251cc06..f7e6d87 100644
--- a/automotive/can/1.0/tools/libprotocan/tests/Android.bp
+++ b/automotive/can/1.0/tools/libprotocan/tests/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/evs/1.1/vts/fuzzing/Android.bp b/automotive/evs/1.1/vts/fuzzing/Android.bp
index 1764821..909d80d 100644
--- a/automotive/evs/1.1/vts/fuzzing/Android.bp
+++ b/automotive/evs/1.1/vts/fuzzing/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/evs/aidl/impl/default/Android.bp b/automotive/evs/aidl/impl/default/Android.bp
index 3d5b7c4..7818804 100644
--- a/automotive/evs/aidl/impl/default/Android.bp
+++ b/automotive/evs/aidl/impl/default/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h
index a850d65..9d1610a 100644
--- a/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h
+++ b/automotive/evs/aidl/impl/default/include/EvsVideoEmulatedCamera.h
@@ -93,6 +93,8 @@
bool initialize();
+ bool initializeMediaCodec();
+
void generateFrames();
void renderOneFrame();
diff --git a/automotive/evs/aidl/impl/default/src/EvsCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp
index bc3bfdd..005c71f 100644
--- a/automotive/evs/aidl/impl/default/src/EvsCamera.cpp
+++ b/automotive/evs/aidl/impl/default/src/EvsCamera.cpp
@@ -198,9 +198,14 @@
auto status = ndk::ScopedAStatus::ok();
{
std::unique_lock lck(mMutex);
+ if (mStreamState != StreamState::RUNNING) {
+ // We're already in the middle of the procedure to stop current data
+ // stream.
+ return status;
+ }
+
if ((!preVideoStreamStop_locked(status, lck) || !stopVideoStreamImpl_locked(status, lck) ||
- !postVideoStreamStop_locked(status, lck)) &&
- !status.isOk()) {
+ !postVideoStreamStop_locked(status, lck)) && !status.isOk()) {
needShutdown = true;
}
}
diff --git a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
index e3f7b5e..480c28d 100644
--- a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
+++ b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
@@ -81,6 +81,10 @@
}
}
+ return initializeMediaCodec();
+}
+
+bool EvsVideoEmulatedCamera::initializeMediaCodec() {
// Initialize Media Codec and file format.
std::unique_ptr<AMediaFormat, FormatDeleter> format;
const char* mime;
@@ -304,6 +308,13 @@
LOG(ERROR) << __func__
<< ": Received error in releasing output buffer. Error code: " << release_status;
}
+
+ if ((info.flags & AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM) != 0) {
+ LOG(INFO) << "Start video playback from the beginning.";
+ AMediaExtractor_seekTo(mVideoExtractor.get(), /* seekPosUs= */ 0,
+ AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC);
+ AMediaCodec_flush(mVideoCodec.get());
+ }
}
void EvsVideoEmulatedCamera::initializeParameters() {
@@ -337,11 +348,24 @@
std::unique_lock<std::mutex>& /* lck */) {
mStream = receiver;
- const media_status_t status = AMediaCodec_start(mVideoCodec.get());
- if (status != AMEDIA_OK) {
- LOG(ERROR) << __func__ << ": Received error in starting decoder. Error code: " << status
- << ".";
- return false;
+ if (auto status = AMediaCodec_start(mVideoCodec.get()); status != AMEDIA_OK) {
+ LOG(INFO) << __func__ << ": Received error in starting decoder. "
+ << "Trying again after resetting this emulated device.";
+
+ if (!initializeMediaCodec()) {
+ LOG(ERROR) << __func__ << ": Failed to re-configure the media codec.";
+ return false;
+ }
+
+ AMediaExtractor_seekTo(mVideoExtractor.get(), /* seekPosUs= */ 0,
+ AMEDIAEXTRACTOR_SEEK_CLOSEST_SYNC);
+ AMediaCodec_flush(mVideoCodec.get());
+
+ if(auto status = AMediaCodec_start(mVideoCodec.get()); status != AMEDIA_OK) {
+ LOG(ERROR) << __func__ << ": Received error again in starting decoder. "
+ << "Error code: " << status;
+ return false;
+ }
}
mCaptureThread = std::thread([this]() { generateFrames(); });
@@ -364,6 +388,12 @@
if (!Base::postVideoStreamStop_locked(status, lck)) {
return false;
}
+
+ EvsEventDesc event = { .aType = EvsEventType::STREAM_STOPPED, };
+ if (auto result = mStream->notify(event); !result.isOk()) {
+ LOG(WARNING) << "Failed to notify the end of the stream.";
+ }
+
mStream = nullptr;
return true;
}
diff --git a/automotive/evs/common/utils/default/test/fuzz/Android.bp b/automotive/evs/common/utils/default/test/fuzz/Android.bp
index a2cf273..b4581e4 100644
--- a/automotive/evs/common/utils/default/test/fuzz/Android.bp
+++ b/automotive/evs/common/utils/default/test/fuzz/Android.bp
@@ -15,6 +15,7 @@
//
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
@@ -25,12 +26,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyNV21toRGB32",
+ name: "FormatConvertFuzzer_copyNV21toRGB32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_NV21_TO_RGB32",
@@ -39,12 +40,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyNV21toBGR32",
+ name: "FormatConvertFuzzer_copyNV21toBGR32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_NV21_TO_BGR32",
@@ -53,12 +54,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyYV12toRGB32",
+ name: "FormatConvertFuzzer_copyYV12toRGB32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_YV12_TO_RGB32",
@@ -67,12 +68,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyYV12toBGR32",
+ name: "FormatConvertFuzzer_copyYV12toBGR32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_YV12_TO_BGR32",
@@ -81,12 +82,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyYUYVtoRGB32",
+ name: "FormatConvertFuzzer_copyYUYVtoRGB32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_YUYV_TO_RGB32",
@@ -95,12 +96,12 @@
cc_fuzz {
host_supported: true,
- name : "FormatConvertFuzzer_copyYUYVtoBGR32",
+ name: "FormatConvertFuzzer_copyYUYVtoBGR32",
srcs: [
"FormatConvertFuzzer.cpp",
],
static_libs: [
- "android.hardware.automotive.evs@common-default-lib"
+ "android.hardware.automotive.evs@common-default-lib",
],
cflags: [
"-DCOPY_YUYV_TO_BGR32",
diff --git a/automotive/ivn_android_device/impl/default/test/Android.bp b/automotive/ivn_android_device/impl/default/test/Android.bp
index a100575..1873e79 100644
--- a/automotive/ivn_android_device/impl/default/test/Android.bp
+++ b/automotive/ivn_android_device/impl/default/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_android_kernel",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/ivn_android_device/vts/Android.bp b/automotive/ivn_android_device/vts/Android.bp
index e4b9d64..07388f3 100644
--- a/automotive/ivn_android_device/vts/Android.bp
+++ b/automotive/ivn_android_device/vts/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/occupant_awareness/aidl/default/Android.bp b/automotive/occupant_awareness/aidl/default/Android.bp
index dc280df..5f009d8 100644
--- a/automotive/occupant_awareness/aidl/default/Android.bp
+++ b/automotive/occupant_awareness/aidl/default/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_android_kernel",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/occupant_awareness/aidl/vts/functional/Android.bp b/automotive/occupant_awareness/aidl/vts/functional/Android.bp
index f248aa9..648dd49 100644
--- a/automotive/occupant_awareness/aidl/vts/functional/Android.bp
+++ b/automotive/occupant_awareness/aidl/vts/functional/Android.bp
@@ -1,4 +1,5 @@
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/remoteaccess/hal/default/Android.bp b/automotive/remoteaccess/hal/default/Android.bp
index cf173d5..cc8f2b0 100644
--- a/automotive/remoteaccess/hal/default/Android.bp
+++ b/automotive/remoteaccess/hal/default/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/remoteaccess/hal/default/test/Android.bp b/automotive/remoteaccess/hal/default/test/Android.bp
index 227175a..378a330 100644
--- a/automotive/remoteaccess/hal/default/test/Android.bp
+++ b/automotive/remoteaccess/hal/default/test/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/remoteaccess/test_grpc_server/impl/Android.bp b/automotive/remoteaccess/test_grpc_server/impl/Android.bp
index fd174bf..8d8d72a 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/Android.bp
+++ b/automotive/remoteaccess/test_grpc_server/impl/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
index 5d33fcb..515dc98 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
+++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
@@ -169,7 +169,8 @@
Looper::setForThread(mLooper);
while (true) {
- mLooper->pollAll(/*timeoutMillis=*/-1);
+ // Don't use pollAll since it might swallow wake.
+ mLooper->pollOnce(/*timeoutMillis=*/-1);
if (mServerStopped) {
return;
}
diff --git a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
index dd08e32..a7927f5 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
+++ b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
@@ -53,6 +53,9 @@
public:
virtual void SetUp() override {
int selectedPort = 0;
+ mServerStarted = false;
+ mService.reset();
+ mServer.reset();
mServerThread = std::thread([this, &selectedPort] {
mService = std::make_unique<MyTestWakeupClientServiceImpl>();
ServerBuilder builder;
diff --git a/automotive/sv/1.0/default/tests/fuzzer/Android.bp b/automotive/sv/1.0/default/tests/fuzzer/Android.bp
index 696bfad..accc470 100644
--- a/automotive/sv/1.0/default/tests/fuzzer/Android.bp
+++ b/automotive/sv/1.0/default/tests/fuzzer/Android.bp
@@ -16,6 +16,7 @@
*/
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 586a98e..94a5882 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/vehicle/2.0/utils/Android.bp b/automotive/vehicle/2.0/utils/Android.bp
index 770d447..802b4b3 100644
--- a/automotive/vehicle/2.0/utils/Android.bp
+++ b/automotive/vehicle/2.0/utils/Android.bp
@@ -14,6 +14,7 @@
// User HAL helper library.
package {
+ default_team: "trendy_team_aaos_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/vehicle/OWNERS b/automotive/vehicle/OWNERS
index 9a6b65d..f099287 100644
--- a/automotive/vehicle/OWNERS
+++ b/automotive/vehicle/OWNERS
@@ -2,7 +2,7 @@
shanyu@google.com
# GRPC VHAL
-per-file aidl/impl/grpc/** = chenhaosjtuacm@google.com, egranata@google.com
+per-file aidl/impl/grpc/** =egranata@google.com
# Property definition
per-file aidl_property/** = tylertrephan@google.com
diff --git a/automotive/vehicle/aidl/aidl_test/Android.bp b/automotive/vehicle/aidl/aidl_test/Android.bp
index bb976af..2dc9ee1 100644
--- a/automotive/vehicle/aidl/aidl_test/Android.bp
+++ b/automotive/vehicle/aidl/aidl_test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
index 726d419..9387965 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehicleAreaConfig.aidl
@@ -62,7 +62,9 @@
* For example, if a property is defined as READ_WRITE, but the OEM wants to specify certain
* area Ids as READ-only, the corresponding areaIds should have an access set to READ, while the
* others must be set to READ_WRITE. We do not support setting specific area Ids to WRITE-only
- * when the property is READ-WRITE.
+ * when the property is READ-WRITE. If any one area config has access
+ * VehiclePropertyAccess::WRITE, then all VehicleAreaConfig.access values and
+ * VehiclePropConfig.access must be set to WRITE for the property.
*
* VehiclePropConfig.access should be equal the maximal subset of the accesses set in
* VehiclePropConfig.areaConfigs, excluding those with access == VehiclePropertyAccess.NONE. For
@@ -73,6 +75,8 @@
* In the scenario where the OEM actually wants to set VehicleAreaConfig.access =
* VehiclePropertyAccess.NONE, the maximal subset rule should apply with this area config
* included, making the VehiclePropConfig.access = VehiclePropertyAccess.NONE.
+ *
+ * See VehiclePropConfig.access for more information.
*/
VehiclePropertyAccess access = VehiclePropertyAccess.NONE;
diff --git a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
index 3109621..d8304f6 100644
--- a/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
+++ b/automotive/vehicle/aidl/android/hardware/automotive/vehicle/VehiclePropConfig.aidl
@@ -44,6 +44,36 @@
* VehiclePropertyAccess.NONE for a particular area config, the maximal subset rule should apply
* with this area config included, making the VehiclePropConfig.access =
* VehiclePropertyAccess.NONE.
+ *
+ * Currently we do not support scenarios where some areaIds are WRITE while others are
+ * READ_WRITE. See the documentation for VehicleAreaConfig.access for more details.
+ *
+ * Examples:
+ * Suppose we have a property with two areaIds which we will call "LEFT" and "RIGHT". Here
+ * are some scenarios that can describe what the VehiclePropConfig.access value should be for
+ * this property.
+ * 1. LEFT is READ and RIGHT is READ_WRITE. VehiclePropConfig.access must be READ as that is
+ * the maximal common access across all areaIds.
+ * 2. LEFT is READ_WRITE and RIGHT is READ_WRITE. VehiclePropConfig.access must be READ_WRITE
+ * as that is the maximal common access across all areaIds.
+ * 3. LEFT is WRITE and RIGHT is WRITE. VehiclePropConfig.access must be WRITE as that is the
+ * maximal common access across all areaIds.
+ * 4. LEFT is READ_WRITE and RIGHT is not set (i.e. defaults to NONE)/is set to NONE, with the
+ * expectation that RIGHT should be populated with the default access mode of the property.
+ * VehiclePropConfig.access can be set to READ or READ_WRITE, whatever the OEM feels is the
+ * appropriate default access for the property.
+ * 5. LEFT is READ and RIGHT is not set (i.e. defaults to NONE)/is set to NONE, with the
+ * expectation that RIGHT should be populated with the default access mode of the property.
+ * VehiclePropConfig.access must be set to READ because setting to READ_WRITE breaks the
+ * rule of having the global access being the maximal subset of the area config accesses.
+ * If the OEM wants RIGHT to be READ_WRITE in this scenario, the config should be rewritten
+ * such that LEFT is not set/is set to NONE and RIGHT is set to READ_WRITE with
+ * VehiclePropConfig.access set to READ.
+ * 6. LEFT is READ_WRITE and RIGHT is set to NONE with the intention of RIGHT to specifically
+ * have no access. VehiclePropConfig.access must be NONE to support RIGHT maintaining its
+ * NONE access.
+ * 7. LEFT is READ_WRITE and RIGHT is WRITE. This is unsupported behaviour and the config
+ * should not be defined this way.
*/
VehiclePropertyAccess access = VehiclePropertyAccess.NONE;
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
index dae37b9..abf15c5 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 8702eae..651ed90 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
index 2eef13c..4bc0b12 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_automotive",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
index ac70b51..664c877 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
index 55b8c93..7c7c0ab 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/obd2frame/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
index 7d0a534..30411f2 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/userhal/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/grpc/test/Android.bp b/automotive/vehicle/aidl/impl/grpc/test/Android.bp
index e53826f..b3c6089 100644
--- a/automotive/vehicle/aidl/impl/grpc/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/grpc/test/Android.bp
@@ -13,6 +13,7 @@
// limitations under the License.
package {
+ default_team: "trendy_team_automotive",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
index 2b4059c..52ef7be 100644
--- a/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
+++ b/automotive/vehicle/aidl/impl/grpc/utils/proto_message_converter/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_automotive",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
index dd43712..69ec7a2 100644
--- a/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/utils/common/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/vhal/Android.bp b/automotive/vehicle/aidl/impl/vhal/Android.bp
index aa30f80..ae1102f 100644
--- a/automotive/vehicle/aidl/impl/vhal/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/aidl/impl/vhal/test/Android.bp b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
index 7122aa5..d6c2f8e 100644
--- a/automotive/vehicle/aidl/impl/vhal/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/vhal/test/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["Android-Apache-2.0"],
}
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index 4ea6dfe..608a328 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -603,6 +603,7 @@
<< "skip testing";
}
+ // Subscribe to PERF_VEHICLE_SPEED using the max sample rate.
auto client = mVhalClient->getSubscriptionClient(mCallback);
ASSERT_NE(client, nullptr) << "Failed to get subscription client";
SubscribeOptionsBuilder builder(propId);
@@ -616,18 +617,17 @@
", error: %s",
propId, result.error().message().c_str());
- ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, 1, std::chrono::seconds(2)))
- << "Must get at least 1 events within 2 seconds after subscription for rate: "
- << maxSampleRate;
-
// Sleep for 1 seconds to wait for more possible events to arrive.
std::this_thread::sleep_for(std::chrono::seconds(1));
client->unsubscribe({propId});
auto events = mCallback->getEvents(propId);
- if (events.size() == 1) {
- // We only received one event, the value is not changing so nothing to check here.
+ if (events.size() <= 1) {
+ // We received 0 or 1 event, the value is not changing so nothing to check here.
+ // If all VHAL clients are subscribing to PERF_VEHICLE_SPEED with VUR on, then we
+ // will receive 0 event. If there are other VHAL clients subscribing to PERF_VEHICLE_SPEED
+ // with VUR off, then we will receive 1 event which is the initial value.
return;
}
@@ -752,9 +752,15 @@
}
}
- if (readOnlyPresent && !writeOnlyPresent) {
+ if (readOnlyPresent) {
+ ASSERT_FALSE(writeOnlyPresent) << StringPrintf(
+ "Found both READ_ONLY and WRITE_ONLY access modes in area configs, which is not "
+ "supported");
maximalAreaAccessSubset = toInt(VehiclePropertyAccess::READ);
} else if (writeOnlyPresent) {
+ ASSERT_FALSE(readWritePresent) << StringPrintf(
+ "Found both WRITE_ONLY and READ_WRITE access modes in area configs, which is not "
+ "supported");
maximalAreaAccessSubset = toInt(VehiclePropertyAccess::WRITE);
} else if (readWritePresent) {
maximalAreaAccessSubset = toInt(VehiclePropertyAccess::READ_WRITE);
diff --git a/biometrics/OWNERS b/biometrics/OWNERS
index 58998c1..a0a5e51 100644
--- a/biometrics/OWNERS
+++ b/biometrics/OWNERS
@@ -1,8 +1,10 @@
-ilyamaty@google.com
+# Bug component: 879035
+
+include platform/frameworks/base:/services/core/java/com/android/server/biometrics/OWNERS
+
jeffpu@google.com
jbolinger@google.com
joshmccloskey@google.com
diyab@google.com
austindelgado@google.com
spdonghao@google.com
-wenhuiy@google.com
diff --git a/biometrics/common/config/Config.cpp b/biometrics/common/config/Config.cpp
index a13bdf0..49f7cc8 100644
--- a/biometrics/common/config/Config.cpp
+++ b/biometrics/common/config/Config.cpp
@@ -132,6 +132,7 @@
}
bool Config::setInternal(const std::string& name, const ConfigValue& val) {
+ LOG(INFO) << "Config::set " << name << " to " << toString(val);
bool res = false;
auto& data = mMap[name];
diff --git a/biometrics/common/thread/Android.bp b/biometrics/common/thread/Android.bp
index a497d01..e7a7e4c 100644
--- a/biometrics/common/thread/Android.bp
+++ b/biometrics/common/thread/Android.bp
@@ -1,3 +1,7 @@
+package {
+ default_team: "trendy_team_biometrics_framework",
+}
+
cc_library {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp
index 4e8390a..685639c 100644
--- a/biometrics/face/aidl/default/Android.bp
+++ b/biometrics/face/aidl/default/Android.bp
@@ -1,4 +1,5 @@
package {
+ default_team: "trendy_team_biometrics_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/biometrics/face/aidl/vts/Android.bp b/biometrics/face/aidl/vts/Android.bp
index f62c4e4..e037eac 100644
--- a/biometrics/face/aidl/vts/Android.bp
+++ b/biometrics/face/aidl/vts/Android.bp
@@ -1,4 +1,5 @@
package {
+ default_team: "trendy_team_biometrics_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/biometrics/fingerprint/2.3/vts/functional/Android.bp b/biometrics/fingerprint/2.3/vts/functional/Android.bp
index 100aa29..c299761 100644
--- a/biometrics/fingerprint/2.3/vts/functional/Android.bp
+++ b/biometrics/fingerprint/2.3/vts/functional/Android.bp
@@ -15,6 +15,7 @@
*/
package {
+ default_team: "trendy_team_biometrics_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp
index 6d8b68b..9b72c87 100644
--- a/biometrics/fingerprint/aidl/default/Android.bp
+++ b/biometrics/fingerprint/aidl/default/Android.bp
@@ -1,4 +1,5 @@
package {
+ default_team: "trendy_team_biometrics_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/biometrics/fingerprint/aidl/default/Fingerprint.cpp b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
index e407f17..3055da1 100644
--- a/biometrics/fingerprint/aidl/default/Fingerprint.cpp
+++ b/biometrics/fingerprint/aidl/default/Fingerprint.cpp
@@ -125,6 +125,8 @@
}
::android::base::WriteStringToFd(mEngine->toString(), fd);
+ ::android::base::WriteStringToFd(Fingerprint::cfg().toString(), fd);
+
fsync(fd);
return STATUS_OK;
}
diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp
index 1652905..fc32fe6 100644
--- a/biometrics/fingerprint/aidl/vts/Android.bp
+++ b/biometrics/fingerprint/aidl/vts/Android.bp
@@ -1,4 +1,5 @@
package {
+ default_team: "trendy_team_biometrics_framework",
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "hardware_interfaces_license"
diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
index 140b956..aaf436f 100644
--- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
+++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
@@ -1095,6 +1095,37 @@
}
+/**
+ * VSR-5.3.14-012 MUST support at least eight LE concurrent connections with
+ * three in peripheral role.
+ */
+// @VsrTest = 5.3.14-012
+TEST_P(BluetoothAidlTest, Vsr_BlE_Connection_Requirement) {
+ std::vector<uint8_t> version_event;
+ send_and_wait_for_cmd_complete(ReadLocalVersionInformationBuilder::Create(),
+ version_event);
+ auto version_view = ReadLocalVersionInformationCompleteView::Create(
+ CommandCompleteView::Create(EventView::Create(PacketView<true>(
+ std::make_shared<std::vector<uint8_t>>(version_event)))));
+ ASSERT_TRUE(version_view.IsValid());
+ ASSERT_EQ(::bluetooth::hci::ErrorCode::SUCCESS, version_view.GetStatus());
+ auto version = version_view.GetLocalVersionInformation();
+ if (version.hci_version_ < ::bluetooth::hci::HciVersion::V_5_0) {
+ // This test does not apply to controllers below 5.0
+ return;
+ };
+
+ int max_connections = ::android::base::GetIntProperty(
+ "bluetooth.core.le.max_number_of_concurrent_connections", -1);
+ if (max_connections == -1) {
+ // With the property not set the default minimum of 8 will be used
+ ALOGI("Max number of LE concurrent connections isn't set");
+ return;
+ }
+ ALOGI("Max number of LE concurrent connections = %d", max_connections);
+ ASSERT_GE(max_connections, 8);
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothAidlTest);
INSTANTIATE_TEST_SUITE_P(PerInstance, BluetoothAidlTest,
testing::ValuesIn(android::getAidlHalInstanceNames(
diff --git a/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp b/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
index fee9e242..be07a7d 100644
--- a/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
+++ b/bluetooth/finder/aidl/vts/VtsHalBluetoothFinderTargetTest.cpp
@@ -18,7 +18,6 @@
#include <aidl/Vintf.h>
#include <aidl/android/hardware/bluetooth/finder/IBluetoothFinder.h>
#include <android-base/logging.h>
-#include <android-base/properties.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/IServiceManager.h>
@@ -72,12 +71,6 @@
return bluetooth_finder->getPoweredOffFinderMode(status);
}
-TEST_P(BluetoothFinderTest, PropertyIsSet) {
- ASSERT_EQ(
- android::base::GetProperty("ro.bluetooth.finder.supported", "false"),
- "true");
-}
-
TEST_P(BluetoothFinderTest, SendEidsSingle) {
ScopedAStatus status = sendEids(1);
ASSERT_TRUE(status.isOk());
diff --git a/broadcastradio/aidl/Android.bp b/broadcastradio/aidl/Android.bp
index 187f283..82ee949 100644
--- a/broadcastradio/aidl/Android.bp
+++ b/broadcastradio/aidl/Android.bp
@@ -36,6 +36,9 @@
sdk_version: "module_current",
min_sdk_version: "Tiramisu",
},
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
@@ -51,3 +54,27 @@
frozen: true,
}
+
+// Note: This should always be one version ahead of the last frozen version
+latest_android_hardware_broadcastradio = "android.hardware.broadcastradio-V2"
+
+cc_defaults {
+ name: "latest_android_hardware_broadcastradio_ndk_static",
+ static_libs: [
+ latest_android_hardware_broadcastradio + "-ndk",
+ ],
+}
+
+java_defaults {
+ name: "latest_android_hardware_broadcastradio_java_static",
+ static_libs: [
+ latest_android_hardware_broadcastradio + "-java",
+ ],
+}
+
+rust_defaults {
+ name: "latest_android_hardware_broadcastradio_rust",
+ rustlibs: [
+ latest_android_hardware_broadcastradio + "-rust",
+ ],
+}
diff --git a/broadcastradio/aidl/default/Android.bp b/broadcastradio/aidl/default/Android.bp
index d7bb751..b620a59 100644
--- a/broadcastradio/aidl/default/Android.bp
+++ b/broadcastradio/aidl/default/Android.bp
@@ -20,14 +20,17 @@
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["hardware_interfaces_license"],
}
cc_defaults {
name: "BroadcastRadioHalDefaults",
+ defaults: [
+ "latest_android_hardware_broadcastradio_ndk_static",
+ ],
static_libs: [
- "android.hardware.broadcastradio-V2-ndk",
- "android.hardware.broadcastradio@common-utils-aidl-lib-V2",
+ "android.hardware.broadcastradio@common-utils-aidl-lib-latest",
"android.hardware.broadcastradio@common-utils-lib",
],
shared_libs: [
@@ -79,12 +82,12 @@
// TODO(b/307611931): avoid fuzzing on vendor until hermiticity issue is fixed
// vendor: true,
defaults: [
+ "latest_android_hardware_broadcastradio_ndk_static",
"BroadcastRadioHalDefaults",
"service_fuzzer_defaults",
],
static_libs: [
"DefaultBroadcastRadioHal",
- "android.hardware.broadcastradio-V2-ndk",
],
srcs: [
"fuzzer.cpp",
diff --git a/broadcastradio/aidl/rust_impl/Android.bp b/broadcastradio/aidl/rust_impl/Android.bp
new file mode 100644
index 0000000..d6f984e
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/Android.bp
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+rust_binary {
+ name: "android.hardware.broadcastradio-rust-service",
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: ["src/*.rs"],
+ crate_root: "src/main.rs",
+ defaults: [
+ "latest_android_hardware_broadcastradio_rust",
+ ],
+ vintf_fragments: ["broadcastradio-rust-service.xml"],
+ init_rc: ["broadcastradio-rust-service.rc"],
+ rustlibs: [
+ "libbinder_rs",
+ ],
+}
diff --git a/broadcastradio/aidl/rust_impl/README.md b/broadcastradio/aidl/rust_impl/README.md
new file mode 100644
index 0000000..17e0c18
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/README.md
@@ -0,0 +1,13 @@
+# Rust Skeleton BroadcastRadio HAL implementation.
+
+WARNING: This is not a reference BroadcastRadio HAL implementation and does
+not contain any actual implementation.
+
+This folder contains a skeleton broadcast radio HAL implementation in Rust to
+demonstrate how vendor may implement a Rust broadcast radio HAL. To run this
+broadcast radio HAL, include `android.hardware.broadcastradio-rust-service`
+in your image.
+
+This implementation returns `StatusCode::UNKNOWN_ERROR` for all operations
+and does not pass VTS/CTS. Vendor must replace the logic in
+`default_broadcastradio_hal.rs` with the actual implementation
\ No newline at end of file
diff --git a/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc
new file mode 100644
index 0000000..4dad616
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.rc
@@ -0,0 +1,5 @@
+service vendor.broadcastradio-default /vendor/bin/hw/android.hardware.broadcastradio-service.default
+ interface aidl android.hardware.broadcastradio.IBroadcastRadio/amfm
+ class hal
+ user audioserver
+ group audio
diff --git a/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml
new file mode 100644
index 0000000..ced2d78
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/broadcastradio-rust-service.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ Copyright (C) 2024 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.
+ -->
+
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.broadcastradio</name>
+ <version>2</version>
+ <fqname>IBroadcastRadio/amfm</fqname>
+ </hal>
+</manifest>
diff --git a/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs b/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs
new file mode 100644
index 0000000..ea2f9d3
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/src/default_broadcastradio_hal.rs
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+use android_hardware_broadcastradio::aidl::android::hardware::broadcastradio::{
+ AmFmRegionConfig::AmFmRegionConfig,
+ AnnouncementType::AnnouncementType,
+ ConfigFlag::ConfigFlag,
+ DabTableEntry::DabTableEntry,
+ IAnnouncementListener::IAnnouncementListener,
+ IBroadcastRadio::IBroadcastRadio,
+ ICloseHandle::ICloseHandle,
+ ITunerCallback::ITunerCallback,
+ ProgramFilter::ProgramFilter,
+ ProgramSelector::ProgramSelector,
+ Properties::Properties,
+ VendorKeyValue::VendorKeyValue,
+};
+use binder::{Interface, Result as BinderResult, StatusCode, Strong};
+use std::vec::Vec;
+
+/// This struct is defined to implement IBroadcastRadio AIDL interface.
+pub struct DefaultBroadcastRadioHal;
+
+impl Interface for DefaultBroadcastRadioHal {}
+
+impl IBroadcastRadio for DefaultBroadcastRadioHal {
+ fn getAmFmRegionConfig(&self, _full : bool) -> BinderResult<AmFmRegionConfig> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getDabRegionConfig(&self) -> BinderResult<Vec<DabTableEntry>> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getProperties(&self) -> BinderResult<Properties> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getImage(&self, _id : i32) -> BinderResult<Vec<u8>> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn setTunerCallback(&self, _callback : &Strong<dyn ITunerCallback>) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn unsetTunerCallback(&self) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn tune(&self, _program : &ProgramSelector) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn seek(&self, _direction_up : bool, _skip_sub_channel : bool) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn step(&self, _direction_up : bool) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn cancel(&self) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn startProgramListUpdates(&self, _filter : &ProgramFilter) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn stopProgramListUpdates(&self) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn isConfigFlagSet(&self, _flag : ConfigFlag) -> BinderResult<bool> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn setConfigFlag(&self, _flag : ConfigFlag, _value : bool) -> BinderResult<()> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn setParameters(&self, _parameters : &[VendorKeyValue]) -> BinderResult<Vec<VendorKeyValue>> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getParameters(&self, _parameters : &[String]) -> BinderResult<Vec<VendorKeyValue>> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn registerAnnouncementListener(&self, _listener : &Strong<dyn IAnnouncementListener>,
+ _enabled : &[AnnouncementType]) -> BinderResult<Strong<dyn ICloseHandle>> {
+ Err(StatusCode::UNKNOWN_ERROR.into())
+ }
+}
diff --git a/broadcastradio/aidl/rust_impl/src/main.rs b/broadcastradio/aidl/rust_impl/src/main.rs
new file mode 100644
index 0000000..c0bc055
--- /dev/null
+++ b/broadcastradio/aidl/rust_impl/src/main.rs
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+ mod default_broadcastradio_hal;
+
+use android_hardware_broadcastradio::aidl::android::hardware::broadcastradio::IBroadcastRadio::BnBroadcastRadio;
+use crate::default_broadcastradio_hal::DefaultBroadcastRadioHal;
+
+fn main() {
+ binder::ProcessState::start_thread_pool();
+ let my_service = DefaultBroadcastRadioHal;
+ let service_name = "android.hardware.broadcastradio.IBroadcastRadio/amfm";
+ let my_service_binder = BnBroadcastRadio::new_binder(
+ my_service,
+ binder::BinderFeatures::default(),
+ );
+ binder::add_service(service_name, my_service_binder.as_binder())
+ .expect(format!("Failed to register {}?", service_name).as_str());
+ // Does not return.
+ binder::ProcessState::join_thread_pool()
+}
diff --git a/broadcastradio/aidl/vts/Android.bp b/broadcastradio/aidl/vts/Android.bp
index 87e48a9..78c377d 100644
--- a/broadcastradio/aidl/vts/Android.bp
+++ b/broadcastradio/aidl/vts/Android.bp
@@ -18,6 +18,7 @@
// all of the 'license_kinds' from "hardware_interfaces_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
+ default_team: "trendy_team_aaos_framework",
default_applicable_licenses: ["hardware_interfaces_license"],
}
@@ -25,6 +26,7 @@
name: "VtsHalBroadcastradioAidlTargetTest",
defaults: [
"VtsHalTargetTestDefaults",
+ "latest_android_hardware_broadcastradio_ndk_static",
"use_libaidlvintf_gtest_helper_static",
],
tidy_timeout_srcs: ["src/*.cpp"],
@@ -35,9 +37,7 @@
"libxml2",
],
static_libs: [
- "android.hardware.broadcastradio-V2-ndk",
- "android.hardware.broadcastradio@common-utils-aidl-lib-V2",
- "android.hardware.broadcastradio@vts-utils-lib",
+ "android.hardware.broadcastradio@common-utils-aidl-lib-latest",
"libgmock",
],
test_suites: [
diff --git a/broadcastradio/common/utilsaidl/Android.bp b/broadcastradio/common/utilsaidl/Android.bp
index e3bdfdd..d88081f 100644
--- a/broadcastradio/common/utilsaidl/Android.bp
+++ b/broadcastradio/common/utilsaidl/Android.bp
@@ -47,17 +47,28 @@
],
}
+cc_library_static {
+ name: "android.hardware.broadcastradio@common-utils-aidl-lib-latest",
+ defaults: [
+ "BroadcastRadioUtilsDefaults",
+ "latest_android_hardware_broadcastradio_ndk_static",
+ ],
+ srcs: [
+ "src/UtilsV2.cpp",
+ ],
+}
+
cc_test {
name: "broadcastradio_utils_aidl_test",
defaults: [
"BroadcastRadioUtilsDefaults",
+ "latest_android_hardware_broadcastradio_ndk_static",
],
srcs: [
"test/*.cpp",
],
static_libs: [
- "android.hardware.broadcastradio@common-utils-aidl-lib-V2",
- "android.hardware.broadcastradio-V2-ndk",
+ "android.hardware.broadcastradio@common-utils-aidl-lib-latest",
],
test_suites: ["general-tests"],
}
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index c8e683c..82666ae 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -8140,7 +8140,7 @@
ANDROID_LENS_POSE_REFERENCE, &entry);
if (0 == retcode && entry.count > 0) {
uint8_t poseReference = entry.data.u8[0];
- ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_UNDEFINED &&
+ ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE &&
poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA);
}
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 368e954..31e8014 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -341,6 +341,10 @@
ret = device->getSessionCharacteristics(config, &session_chars);
ASSERT_TRUE(ret.isOk());
verifySessionCharacteristics(session_chars, camera_chars);
+
+ ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
}
} else {
ALOGI("getSessionCharacteristics: Test skipped.\n");
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 1d6f013..a01fb04 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -694,8 +694,8 @@
retcode = find_camera_metadata_ro_entry(metadata, ANDROID_LENS_POSE_REFERENCE, &entry);
if (0 == retcode && entry.count > 0) {
uint8_t poseReference = entry.data.u8[0];
- ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_UNDEFINED &&
- poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA);
+ ASSERT_TRUE(poseReference <= ANDROID_LENS_POSE_REFERENCE_AUTOMOTIVE &&
+ poseReference >= ANDROID_LENS_POSE_REFERENCE_PRIMARY_CAMERA);
}
retcode =
diff --git a/dumpstate/OWNERS b/dumpstate/OWNERS
index 4c9173e..b0ef9da 100644
--- a/dumpstate/OWNERS
+++ b/dumpstate/OWNERS
@@ -1,3 +1,3 @@
-# Bug component: 298624585
+# Bug component: 153446
include platform/frameworks/native:/cmds/dumpstate/OWNERS
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 9381a0a..4309187 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -1714,7 +1714,8 @@
* 2. verify the SvStatus are received at expected interval
*/
TEST_P(GnssHalTest, TestSvStatusIntervals) {
- if (aidl_gnss_hal_->getInterfaceVersion() <= 2) {
+ // Only runs on devices launched in Android 15+
+ if (aidl_gnss_hal_->getInterfaceVersion() <= 3) {
return;
}
ALOGD("TestSvStatusIntervals");
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 61df350..0227e39 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -2203,13 +2203,13 @@
TEST_P(GraphicsComposerAidlCommandTest, DisplayDecoration) {
for (VtsDisplay& display : mDisplays) {
- auto& writer = getWriter(display.getDisplayId());
+ const auto displayId = display.getDisplayId();
+ auto& writer = getWriter(displayId);
const auto [layerStatus, layer] =
- mComposerClient->createLayer(display.getDisplayId(), kBufferSlotCount, &writer);
- EXPECT_TRUE(layerStatus.isOk());
+ mComposerClient->createLayer(displayId, kBufferSlotCount, &writer);
+ ASSERT_TRUE(layerStatus.isOk());
- const auto [error, support] =
- mComposerClient->getDisplayDecorationSupport(display.getDisplayId());
+ const auto [error, support] = mComposerClient->getDisplayDecorationSupport(displayId);
const auto format = (error.isOk() && support) ? support->format
: aidl::android::hardware::graphics::common::PixelFormat::RGBA_8888;
@@ -2229,9 +2229,9 @@
configureLayer(display, layer, Composition::DISPLAY_DECORATION, display.getFrameRect(),
display.getCrop());
- writer.setLayerBuffer(display.getDisplayId(), layer, /*slot*/ 0, decorBuffer->handle,
+ writer.setLayerBuffer(displayId, layer, /*slot*/ 0, decorBuffer->handle,
/*acquireFence*/ -1);
- writer.validateDisplay(display.getDisplayId(), ComposerClientWriter::kNoTimestamp,
+ writer.validateDisplay(displayId, ComposerClientWriter::kNoTimestamp,
VtsComposerClient::kNoFrameIntervalNs);
execute();
if (support) {
@@ -2241,6 +2241,7 @@
ASSERT_EQ(1, errors.size());
EXPECT_EQ(IComposerClient::EX_UNSUPPORTED, errors[0].errorCode);
}
+ EXPECT_TRUE(mComposerClient->destroyLayer(displayId, layer, &writer).isOk());
}
}
diff --git a/media/1.0/xml/Android.bp b/media/1.0/xml/Android.bp
new file mode 100644
index 0000000..5b5a95c
--- /dev/null
+++ b/media/1.0/xml/Android.bp
@@ -0,0 +1,26 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+///////////////////////////////////////
+// media_profiles_V1_0.dtd
+
+prebuilt_etc {
+ name: "media_profiles_V1_0.dtd",
+ src: "media_profiles.dtd",
+ filename: "media_profiles_V1_0.dtd",
+}
diff --git a/media/1.0/xml/Android.mk b/media/1.0/xml/Android.mk
deleted file mode 100644
index a795288..0000000
--- a/media/1.0/xml/Android.mk
+++ /dev/null
@@ -1,16 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-#######################################
-# media_profiles_V1_0.dtd
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := media_profiles_V1_0.dtd
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
-LOCAL_SRC_FILES := media_profiles.dtd
-LOCAL_MODULE_CLASS := ETC
-LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
-
-include $(BUILD_PREBUILT)
diff --git a/power/aidl/android/hardware/power/SessionConfig.aidl b/power/aidl/android/hardware/power/SessionConfig.aidl
index 93dc9a2..ca89183 100644
--- a/power/aidl/android/hardware/power/SessionConfig.aidl
+++ b/power/aidl/android/hardware/power/SessionConfig.aidl
@@ -25,6 +25,9 @@
/**
* The session's unique ID, used to identify the session for debugging and
* for multiplexing on the per-process FMQ channel.
+ *
+ * Values that fit in the 32-bit int range value must be provided when using
+ * the FMQ API, as the FMQ messages can only accept 32-bit Session IDs.
*/
long id;
}
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index 0cf53cf..fbb6140 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -7,6 +7,13 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
+// The following target has an insecure implementation of KeyMint where the
+// trusted application (TA) code runs in-process alongside the HAL service
+// code.
+//
+// A real device is required to run the TA code in a secure environment, as
+// per CDD 9.11 [C-1-1]: "MUST back up the keystore implementation with an
+// isolated execution environment."
cc_binary {
name: "android.hardware.security.keymint-service",
relative_install_path: "hw",
@@ -46,6 +53,13 @@
],
}
+// The following target has an insecure implementation of KeyMint where the
+// trusted application (TA) code runs in-process alongside the HAL service
+// code.
+//
+// A real device is required to run the TA code in a secure environment, as
+// per CDD 9.11 [C-1-1]: "MUST back up the keystore implementation with an
+// isolated execution environment."
rust_binary {
name: "android.hardware.security.keymint-service.nonsecure",
relative_install_path: "hw",
diff --git a/security/keymint/aidl/default/main.rs b/security/keymint/aidl/default/main.rs
index 055c698..47143f4 100644
--- a/security/keymint/aidl/default/main.rs
+++ b/security/keymint/aidl/default/main.rs
@@ -17,11 +17,15 @@
//! Default implementation of the KeyMint HAL and related HALs.
//!
//! This implementation of the HAL is only intended to allow testing and policy compliance. A real
-//! implementation **must be implemented in a secure environment**.
+//! implementation **must implement the TA in a secure environment**, as per CDD 9.11 [C-1-1]:
+//! "MUST back up the keystore implementation with an isolated execution environment."
+//!
+//! The additional device-specific components that are required for a real implementation of KeyMint
+//! that is based on the Rust reference implementation are described in system/keymint/README.md.
use kmr_hal::SerializedChannel;
use kmr_hal_nonsecure::{attestation_id_info, get_boot_info};
-use log::{debug, error, info};
+use log::{debug, error, info, warn};
use std::ops::DerefMut;
use std::sync::{mpsc, Arc, Mutex};
@@ -62,7 +66,7 @@
error!("{}", panic_info);
}));
- info!("Insecure KeyMint HAL service is starting.");
+ warn!("Insecure KeyMint HAL service is starting.");
info!("Starting thread pool now.");
binder::ProcessState::start_thread_pool();
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index b65218f..65a4645 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -22,6 +22,7 @@
#include <algorithm>
#include <iostream>
#include <map>
+#include <set>
#include <openssl/curve25519.h>
#include <openssl/ec.h>
@@ -3588,6 +3589,42 @@
}
/*
+ * SigningOperationsTest.HmacMessageDigestUnique
+ *
+ * Verifies that HMAC with different keys gives different results.
+ */
+TEST_P(SigningOperationsTest, HmacMessageDigestUnique) {
+ for (int key_len : {64, 128, 192, 256, 512}) {
+ for (int msg_len = 0; msg_len <= 30; msg_len += 10) {
+ string message = string(msg_len, 'x');
+ for (auto digest : ValidDigests(false /* withNone */, false /* withMD5 */)) {
+ SCOPED_TRACE(testing::Message() << "Digest::" << digest << "::MsgLen::" << msg_len);
+
+ int count = 10;
+ std::set<string> results;
+ for (int ii = 0; ii < count; ii++) {
+ ASSERT_EQ(ErrorCode::OK,
+ GenerateKey(AuthorizationSetBuilder()
+ .Authorization(TAG_NO_AUTH_REQUIRED)
+ .HmacKey(key_len)
+ .Digest(digest)
+ .Authorization(TAG_MIN_MAC_LENGTH, 160)))
+ << "Failed to create HMAC key with digest " << digest;
+ string signature = MacMessage(message, digest, 160);
+ EXPECT_EQ(160U / 8U, signature.size())
+ << "Failed to sign with HMAC key with digest " << digest;
+ CheckedDeleteKey();
+ results.insert(signature);
+ }
+ EXPECT_EQ(results.size(), count)
+ << "HMAC of a message '" << message << "' with " << count
+ << " fresh keys only gave " << results.size() << " distinct results";
+ }
+ }
+ }
+}
+
+/*
* SigningOperationsTest.HmacSha256TooLargeMacLength
*
* Verifies that HMAC fails in the correct way when asked to generate a MAC larger than the