Merge "Ignores vim temporary files from git" into main
diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING
index 2b6207e..b5fcd86 100644
--- a/audio/aidl/TEST_MAPPING
+++ b/audio/aidl/TEST_MAPPING
@@ -55,6 +55,29 @@
"postsubmit": [
{
"name": "VtsHalSpatializerTargetTest"
+ },
+ {
+ "name": "audiorecord_tests"
+ },
+ {
+ "name": "audioeffect_tests"
+ },
+ {
+ "name": "audiorouting_tests"
+ },
+ {
+ "name": "trackplayerbase_tests"
+ },
+ {
+ "name": "audiosystem_tests"
+ },
+ {
+ "name": "CtsVirtualDevicesTestCases",
+ "options" : [
+ {
+ "include-filter": "android.virtualdevice.cts.VirtualAudioTest"
+ }
+ ]
}
]
}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
index 8c196e7..a1b00be 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/IEffect.aidl
@@ -41,6 +41,7 @@
android.hardware.audio.effect.State getState();
void setParameter(in android.hardware.audio.effect.Parameter param);
android.hardware.audio.effect.Parameter getParameter(in android.hardware.audio.effect.Parameter.Id paramId);
+ android.hardware.audio.effect.IEffect.OpenEffectReturn reopen();
@FixedSize @VintfStability
parcelable Status {
int status;
diff --git a/audio/aidl/android/hardware/audio/effect/IEffect.aidl b/audio/aidl/android/hardware/audio/effect/IEffect.aidl
index 6097f34..266adec 100644
--- a/audio/aidl/android/hardware/audio/effect/IEffect.aidl
+++ b/audio/aidl/android/hardware/audio/effect/IEffect.aidl
@@ -54,7 +54,16 @@
}
/**
- * Return data structure of IEffect.open() interface.
+ * Return data structure of the IEffect.open() and IEffect.reopen() method.
+ *
+ * Contains Fast Message Queues (FMQs) for effect processing status and input/output data.
+ * The status FMQ remains valid and unchanged after opening, while input/output data FMQs can be
+ * modified with changes in input/output AudioConfig. If reallocation of data FMQ is necessary,
+ * the effect instance must release the existing data FMQs to signal the need to the audio
+ * framework.
+ * When the audio framework encounters a valid status FMQ and invalid input/output data FMQs,
+ * it must invoke the IEffect.reopen() method to request the effect instance to reallocate
+ * the FMQ and return to the audio framework.
*/
@VintfStability
parcelable OpenEffectReturn {
@@ -97,7 +106,7 @@
* client responsibility to make sure all parameter/buffer is correct if client wants to reopen
* a closed instance.
*
- * Effect instance close interface should always succeed unless:
+ * Effect instance close method should always succeed unless:
* 1. The effect instance is not in a proper state to be closed, for example it's still in
* State::PROCESSING state.
* 2. There is system/hardware related failure when close.
@@ -154,8 +163,8 @@
/**
* Get a parameter from the effect instance with parameter ID.
*
- * This interface must return the current parameter of the effect instance, if no parameter
- * has been set by client yet, the default value must be returned.
+ * This method must return the current parameter of the effect instance, if no parameter has
+ * been set by client yet, the default value must be returned.
*
* Must be available for the effect instance after open().
*
@@ -165,4 +174,24 @@
* @throws EX_ILLEGAL_ARGUMENT if the effect instance receive unsupported parameter tag.
*/
Parameter getParameter(in Parameter.Id paramId);
+
+ /**
+ * Reopen the effect instance, keeping all previous parameters unchanged, and reallocate only
+ * the Fast Message Queues (FMQs) allocated during the open time as needed.
+ *
+ * When the audio framework encounters a valid status FMQ and invalid data FMQ(s), it calls
+ * this method to reopen the effect and request the latest data FMQ.
+ * Upon receiving this call, if the effect instance's data FMQ(s) is invalid, it must reallocate
+ * the necessary data FMQ(s) and return them to the audio framework. All previous parameters and
+ * states keep unchanged.
+ * Once the audio framework successfully completes the call, it must validate the returned FMQs,
+ * deprecate all old FMQs, and exclusively use the FMQs returned from this method.
+ *
+ * @return The reallocated data FMQ and the original status FMQ.
+ *
+ * @throws EX_ILLEGAL_STATE if the effect instance is not in a proper state to reallocate FMQ.
+ * This may occur if the effect instance has already been closed or if there is no need to
+ * update any data FMQ.
+ */
+ OpenEffectReturn reopen();
}
diff --git a/audio/aidl/android/hardware/audio/effect/state.gv b/audio/aidl/android/hardware/audio/effect/state.gv
index ce369ba..22c70c8 100644
--- a/audio/aidl/android/hardware/audio/effect/state.gv
+++ b/audio/aidl/android/hardware/audio/effect/state.gv
@@ -31,6 +31,8 @@
IDLE -> INIT[label = "IEffect.close()"];
INIT -> INIT[label = "IEffect.getState\nIEffect.getDescriptor"];
- IDLE -> IDLE[label = "IEffect.getParameter\nIEffect.setParameter\nIEffect.getDescriptor\nIEffect.command(RESET)"];
- PROCESSING -> PROCESSING[label = "IEffect.getParameter\nIEffect.setParameter\nIEffect.getDescriptor"];
+ IDLE -> IDLE[label = "IEffect.getParameter\nIEffect.setParameter\nIEffect.getDescriptor\nIEffect.command(RESET)\nIEffect.reopen"];
+ PROCESSING
+ -> PROCESSING
+ [label = "IEffect.getParameter\nIEffect.setParameter\nIEffect.getDescriptor\nIEffect.reopen"];
}
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index 6d0b95e..20682d6 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -226,6 +226,7 @@
filegroup {
name: "effectCommonFile",
srcs: [
+ "EffectContext.cpp",
"EffectThread.cpp",
"EffectImpl.cpp",
],
diff --git a/audio/aidl/default/EffectContext.cpp b/audio/aidl/default/EffectContext.cpp
new file mode 100644
index 0000000..2e12918
--- /dev/null
+++ b/audio/aidl/default/EffectContext.cpp
@@ -0,0 +1,227 @@
+/*
+ * 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.
+ */
+
+#include <memory>
+#define LOG_TAG "AHAL_EffectContext"
+#include "effect-impl/EffectContext.h"
+#include "include/effect-impl/EffectTypes.h"
+
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::effect::IEffect;
+using aidl::android::media::audio::common::PcmType;
+using ::android::hardware::EventFlag;
+
+namespace aidl::android::hardware::audio::effect {
+
+EffectContext::EffectContext(size_t statusDepth, const Parameter::Common& common) {
+ LOG_ALWAYS_FATAL_IF(RetCode::SUCCESS != setCommon(common), "illegalCommonParameter");
+
+ // in/outBuffer size in float (FMQ data format defined for DataMQ)
+ size_t inBufferSizeInFloat = common.input.frameCount * mInputFrameSize / sizeof(float);
+ size_t outBufferSizeInFloat = common.output.frameCount * mOutputFrameSize / sizeof(float);
+
+ // only status FMQ use the EventFlag
+ mStatusMQ = std::make_shared<StatusMQ>(statusDepth, true /*configureEventFlagWord*/);
+ mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
+ mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
+
+ if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) {
+ LOG(ERROR) << __func__ << " created invalid FMQ";
+ }
+
+ ::android::status_t status =
+ EventFlag::createEventFlag(mStatusMQ->getEventFlagWord(), &mEfGroup);
+ LOG_ALWAYS_FATAL_IF(status != ::android::OK || !mEfGroup, " create EventFlagGroup failed ");
+ mWorkBuffer.reserve(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
+}
+
+// reset buffer status by abandon input data in FMQ
+void EffectContext::resetBuffer() {
+ auto buffer = static_cast<float*>(mWorkBuffer.data());
+ std::vector<IEffect::Status> status(mStatusMQ->availableToRead());
+ if (mInputMQ) {
+ mInputMQ->read(buffer, mInputMQ->availableToRead());
+ }
+}
+
+void EffectContext::dupeFmqWithReopen(IEffect::OpenEffectReturn* effectRet) {
+ if (!mInputMQ) {
+ mInputMQ = std::make_shared<DataMQ>(mCommon.input.frameCount * mInputFrameSize /
+ sizeof(float));
+ }
+ if (!mOutputMQ) {
+ mOutputMQ = std::make_shared<DataMQ>(mCommon.output.frameCount * mOutputFrameSize /
+ sizeof(float));
+ }
+ dupeFmq(effectRet);
+}
+
+void EffectContext::dupeFmq(IEffect::OpenEffectReturn* effectRet) {
+ if (effectRet) {
+ effectRet->statusMQ = mStatusMQ->dupeDesc();
+ effectRet->inputDataMQ = mInputMQ->dupeDesc();
+ effectRet->outputDataMQ = mOutputMQ->dupeDesc();
+ }
+}
+
+float* EffectContext::getWorkBuffer() {
+ return static_cast<float*>(mWorkBuffer.data());
+}
+
+std::shared_ptr<EffectContext::StatusMQ> EffectContext::getStatusFmq() const {
+ return mStatusMQ;
+}
+
+std::shared_ptr<EffectContext::DataMQ> EffectContext::getInputDataFmq() const {
+ return mInputMQ;
+}
+
+std::shared_ptr<EffectContext::DataMQ> EffectContext::getOutputDataFmq() const {
+ return mOutputMQ;
+}
+
+size_t EffectContext::getInputFrameSize() const {
+ return mInputFrameSize;
+}
+
+size_t EffectContext::getOutputFrameSize() const {
+ return mOutputFrameSize;
+}
+
+int EffectContext::getSessionId() const {
+ return mCommon.session;
+}
+
+int EffectContext::getIoHandle() const {
+ return mCommon.ioHandle;
+}
+
+RetCode EffectContext::setOutputDevice(
+ const std::vector<aidl::android::media::audio::common::AudioDeviceDescription>& device) {
+ mOutputDevice = device;
+ return RetCode::SUCCESS;
+}
+
+std::vector<aidl::android::media::audio::common::AudioDeviceDescription>
+EffectContext::getOutputDevice() {
+ return mOutputDevice;
+}
+
+RetCode EffectContext::setAudioMode(const aidl::android::media::audio::common::AudioMode& mode) {
+ mMode = mode;
+ return RetCode::SUCCESS;
+}
+aidl::android::media::audio::common::AudioMode EffectContext::getAudioMode() {
+ return mMode;
+}
+
+RetCode EffectContext::setAudioSource(
+ const aidl::android::media::audio::common::AudioSource& source) {
+ mSource = source;
+ return RetCode::SUCCESS;
+}
+
+aidl::android::media::audio::common::AudioSource EffectContext::getAudioSource() {
+ return mSource;
+}
+
+RetCode EffectContext::setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) {
+ mVolumeStereo = volumeStereo;
+ return RetCode::SUCCESS;
+}
+
+Parameter::VolumeStereo EffectContext::getVolumeStereo() {
+ return mVolumeStereo;
+}
+
+RetCode EffectContext::setCommon(const Parameter::Common& common) {
+ LOG(VERBOSE) << __func__ << common.toString();
+ auto& input = common.input;
+ auto& output = common.output;
+
+ if (input.base.format.pcm != aidl::android::media::audio::common::PcmType::FLOAT_32_BIT ||
+ output.base.format.pcm != aidl::android::media::audio::common::PcmType::FLOAT_32_BIT) {
+ LOG(ERROR) << __func__ << " illegal IO, input "
+ << ::android::internal::ToString(input.base.format) << ", output "
+ << ::android::internal::ToString(output.base.format);
+ return RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+
+ if (auto ret = updateIOFrameSize(common); ret != RetCode::SUCCESS) {
+ return ret;
+ }
+
+ mInputChannelCount = getChannelCount(input.base.channelMask);
+ mOutputChannelCount = getChannelCount(output.base.channelMask);
+ if (mInputChannelCount == 0 || mOutputChannelCount == 0) {
+ LOG(ERROR) << __func__ << " illegal channel count input " << mInputChannelCount
+ << ", output " << mOutputChannelCount;
+ return RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+
+ mCommon = common;
+ return RetCode::SUCCESS;
+}
+
+Parameter::Common EffectContext::getCommon() {
+ LOG(VERBOSE) << __func__ << mCommon.toString();
+ return mCommon;
+}
+
+EventFlag* EffectContext::getStatusEventFlag() {
+ return mEfGroup;
+}
+
+RetCode EffectContext::updateIOFrameSize(const Parameter::Common& common) {
+ const auto iFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
+ common.input.base.format, common.input.base.channelMask);
+ const auto oFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
+ common.output.base.format, common.output.base.channelMask);
+
+ bool needUpdateMq = false;
+ if (mInputMQ &&
+ (mInputFrameSize != iFrameSize || mCommon.input.frameCount != common.input.frameCount)) {
+ mInputMQ.reset();
+ needUpdateMq = true;
+ }
+ if (mOutputMQ &&
+ (mOutputFrameSize != oFrameSize || mCommon.output.frameCount != common.output.frameCount)) {
+ mOutputMQ.reset();
+ needUpdateMq = true;
+ }
+ mInputFrameSize = iFrameSize;
+ mOutputFrameSize = oFrameSize;
+ if (needUpdateMq) {
+ return notifyDataMqUpdate();
+ }
+ return RetCode::SUCCESS;
+}
+
+RetCode EffectContext::notifyDataMqUpdate() {
+ if (!mEfGroup) {
+ LOG(ERROR) << __func__ << ": invalid EventFlag group";
+ return RetCode::ERROR_EVENT_FLAG_ERROR;
+ }
+
+ if (const auto ret = mEfGroup->wake(kEventFlagDataMqUpdate); ret != ::android::OK) {
+ LOG(ERROR) << __func__ << ": wake failure with ret " << ret;
+ return RetCode::ERROR_EVENT_FLAG_ERROR;
+ }
+ LOG(DEBUG) << __func__ << " : signal client for reopen";
+ return RetCode::SUCCESS;
+}
+} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/EffectImpl.cpp b/audio/aidl/default/EffectImpl.cpp
index c81c731..b76269a 100644
--- a/audio/aidl/default/EffectImpl.cpp
+++ b/audio/aidl/default/EffectImpl.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <memory>
#define LOG_TAG "AHAL_EffectImpl"
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectTypes.h"
@@ -22,6 +23,7 @@
using aidl::android::hardware::audio::effect::IEffect;
using aidl::android::hardware::audio::effect::State;
using aidl::android::media::audio::common::PcmType;
+using ::android::hardware::EventFlag;
extern "C" binder_exception_t destroyEffect(const std::shared_ptr<IEffect>& instanceSp) {
State state;
@@ -45,40 +47,62 @@
RETURN_IF(common.input.base.format.pcm != common.output.base.format.pcm ||
common.input.base.format.pcm != PcmType::FLOAT_32_BIT,
EX_ILLEGAL_ARGUMENT, "dataMustBe32BitsFloat");
+ std::lock_guard lg(mImplMutex);
RETURN_OK_IF(mState != State::INIT);
- auto context = createContext(common);
- RETURN_IF(!context, EX_NULL_POINTER, "createContextFailed");
+ mImplContext = createContext(common);
+ RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
+ mEventFlag = mImplContext->getStatusEventFlag();
if (specific.has_value()) {
RETURN_IF_ASTATUS_NOT_OK(setParameterSpecific(specific.value()), "setSpecParamErr");
}
mState = State::IDLE;
- context->dupeFmq(ret);
- RETURN_IF(createThread(context, getEffectName()) != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
+ mImplContext->dupeFmq(ret);
+ RETURN_IF(createThread(getEffectName()) != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
"FailedToCreateWorker");
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus EffectImpl::close() {
- RETURN_OK_IF(mState == State::INIT);
- RETURN_IF(mState == State::PROCESSING, EX_ILLEGAL_STATE, "closeAtProcessing");
+ndk::ScopedAStatus EffectImpl::reopen(OpenEffectReturn* ret) {
+ std::lock_guard lg(mImplMutex);
+ RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "alreadyClosed");
+ // TODO: b/302036943 add reopen implementation
+ RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
+ mImplContext->dupeFmqWithReopen(ret);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus EffectImpl::close() {
+ {
+ std::lock_guard lg(mImplMutex);
+ RETURN_OK_IF(mState == State::INIT);
+ RETURN_IF(mState == State::PROCESSING, EX_ILLEGAL_STATE, "closeAtProcessing");
+ mState = State::INIT;
+ }
+
+ RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ "notifyEventFlagFailed");
// stop the worker thread, ignore the return code
RETURN_IF(destroyThread() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
"FailedToDestroyWorker");
- mState = State::INIT;
- RETURN_IF(releaseContext() != RetCode::SUCCESS, EX_UNSUPPORTED_OPERATION,
- "FailedToCreateWorker");
+
+ {
+ std::lock_guard lg(mImplMutex);
+ releaseContext();
+ mImplContext.reset();
+ }
LOG(DEBUG) << getEffectName() << __func__;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus EffectImpl::setParameter(const Parameter& param) {
+ std::lock_guard lg(mImplMutex);
LOG(VERBOSE) << getEffectName() << __func__ << " with: " << param.toString();
- const auto tag = param.getTag();
+ const auto& tag = param.getTag();
switch (tag) {
case Parameter::common:
case Parameter::deviceDescription:
@@ -100,8 +124,8 @@
}
ndk::ScopedAStatus EffectImpl::getParameter(const Parameter::Id& id, Parameter* param) {
- auto tag = id.getTag();
- switch (tag) {
+ std::lock_guard lg(mImplMutex);
+ switch (id.getTag()) {
case Parameter::Id::commonTag: {
RETURN_IF_ASTATUS_NOT_OK(getParameterCommon(id.get<Parameter::Id::commonTag>(), param),
"CommonParamNotSupported");
@@ -121,30 +145,30 @@
}
ndk::ScopedAStatus EffectImpl::setParameterCommon(const Parameter& param) {
- auto context = getContext();
- RETURN_IF(!context, EX_NULL_POINTER, "nullContext");
+ RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
- auto tag = param.getTag();
+ const auto& tag = param.getTag();
switch (tag) {
case Parameter::common:
- RETURN_IF(context->setCommon(param.get<Parameter::common>()) != RetCode::SUCCESS,
+ RETURN_IF(mImplContext->setCommon(param.get<Parameter::common>()) != RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setCommFailed");
break;
case Parameter::deviceDescription:
- RETURN_IF(context->setOutputDevice(param.get<Parameter::deviceDescription>()) !=
+ RETURN_IF(mImplContext->setOutputDevice(param.get<Parameter::deviceDescription>()) !=
RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setDeviceFailed");
break;
case Parameter::mode:
- RETURN_IF(context->setAudioMode(param.get<Parameter::mode>()) != RetCode::SUCCESS,
+ RETURN_IF(mImplContext->setAudioMode(param.get<Parameter::mode>()) != RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setModeFailed");
break;
case Parameter::source:
- RETURN_IF(context->setAudioSource(param.get<Parameter::source>()) != RetCode::SUCCESS,
+ RETURN_IF(mImplContext->setAudioSource(param.get<Parameter::source>()) !=
+ RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setSourceFailed");
break;
case Parameter::volumeStereo:
- RETURN_IF(context->setVolumeStereo(param.get<Parameter::volumeStereo>()) !=
+ RETURN_IF(mImplContext->setVolumeStereo(param.get<Parameter::volumeStereo>()) !=
RetCode::SUCCESS,
EX_ILLEGAL_ARGUMENT, "setVolumeStereoFailed");
break;
@@ -159,28 +183,27 @@
}
ndk::ScopedAStatus EffectImpl::getParameterCommon(const Parameter::Tag& tag, Parameter* param) {
- auto context = getContext();
- RETURN_IF(!context, EX_NULL_POINTER, "nullContext");
+ RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
switch (tag) {
case Parameter::common: {
- param->set<Parameter::common>(context->getCommon());
+ param->set<Parameter::common>(mImplContext->getCommon());
break;
}
case Parameter::deviceDescription: {
- param->set<Parameter::deviceDescription>(context->getOutputDevice());
+ param->set<Parameter::deviceDescription>(mImplContext->getOutputDevice());
break;
}
case Parameter::mode: {
- param->set<Parameter::mode>(context->getAudioMode());
+ param->set<Parameter::mode>(mImplContext->getAudioMode());
break;
}
case Parameter::source: {
- param->set<Parameter::source>(context->getAudioSource());
+ param->set<Parameter::source>(mImplContext->getAudioSource());
break;
}
case Parameter::volumeStereo: {
- param->set<Parameter::volumeStereo>(context->getVolumeStereo());
+ param->set<Parameter::volumeStereo>(mImplContext->getVolumeStereo());
break;
}
default: {
@@ -192,30 +215,34 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus EffectImpl::getState(State* state) {
+ndk::ScopedAStatus EffectImpl::getState(State* state) NO_THREAD_SAFETY_ANALYSIS {
*state = mState;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus EffectImpl::command(CommandId command) {
- RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "CommandStateError");
+ std::lock_guard lg(mImplMutex);
+ RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen");
LOG(DEBUG) << getEffectName() << __func__ << ": receive command: " << toString(command)
<< " at state " << toString(mState);
switch (command) {
case CommandId::START:
- RETURN_IF(mState == State::INIT, EX_ILLEGAL_STATE, "instanceNotOpen");
RETURN_OK_IF(mState == State::PROCESSING);
RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
- startThread();
mState = State::PROCESSING;
+ RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ "notifyEventFlagFailed");
+ startThread();
break;
case CommandId::STOP:
case CommandId::RESET:
RETURN_OK_IF(mState == State::IDLE);
+ mState = State::IDLE;
+ RETURN_IF(notifyEventFlag(kEventFlagNotEmpty) != RetCode::SUCCESS, EX_ILLEGAL_STATE,
+ "notifyEventFlagFailed");
stopThread();
RETURN_IF_ASTATUS_NOT_OK(commandImpl(command), "commandImplFailed");
- mState = State::IDLE;
break;
default:
LOG(ERROR) << getEffectName() << __func__ << " instance still processing";
@@ -227,19 +254,41 @@
}
ndk::ScopedAStatus EffectImpl::commandImpl(CommandId command) {
- auto context = getContext();
- RETURN_IF(!context, EX_NULL_POINTER, "nullContext");
+ RETURN_IF(!mImplContext, EX_NULL_POINTER, "nullContext");
if (command == CommandId::RESET) {
- context->resetBuffer();
+ mImplContext->resetBuffer();
}
return ndk::ScopedAStatus::ok();
}
+std::shared_ptr<EffectContext> EffectImpl::createContext(const Parameter::Common& common) {
+ return std::make_shared<EffectContext>(1 /* statusMqDepth */, common);
+}
+
+RetCode EffectImpl::releaseContext() {
+ if (mImplContext) {
+ mImplContext.reset();
+ }
+ return RetCode::SUCCESS;
+}
+
void EffectImpl::cleanUp() {
command(CommandId::STOP);
close();
}
+RetCode EffectImpl::notifyEventFlag(uint32_t flag) {
+ if (!mEventFlag) {
+ LOG(ERROR) << getEffectName() << __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;
+ return RetCode::ERROR_EVENT_FLAG_ERROR;
+ }
+ return RetCode::SUCCESS;
+}
+
IEffect::Status EffectImpl::status(binder_status_t status, size_t consumed, size_t produced) {
IEffect::Status ret;
ret.status = status;
@@ -248,6 +297,48 @@
return ret;
}
+void EffectImpl::process() {
+ /**
+ * 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 */,
+ true /* retry */) ||
+ !(efState & kEventFlagNotEmpty)) {
+ LOG(ERROR) << getEffectName() << __func__ << ": StatusEventFlag - " << mEventFlag
+ << " efState - " << std::hex << efState;
+ return;
+ }
+
+ {
+ std::lock_guard lg(mImplMutex);
+ if (mState != State::PROCESSING) {
+ LOG(DEBUG) << getEffectName() << " skip process in state: " << toString(mState);
+ return;
+ }
+ RETURN_VALUE_IF(!mImplContext, void(), "nullContext");
+ auto statusMQ = mImplContext->getStatusFmq();
+ auto inputMQ = mImplContext->getInputDataFmq();
+ auto outputMQ = mImplContext->getOutputDataFmq();
+ auto buffer = mImplContext->getWorkBuffer();
+ if (!inputMQ || !outputMQ) {
+ return;
+ }
+
+ auto processSamples = inputMQ->availableToRead();
+ if (processSamples) {
+ inputMQ->read(buffer, processSamples);
+ IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples);
+ outputMQ->write(buffer, status.fmqProduced);
+ statusMQ->writeBlocking(&status, 1);
+ LOG(VERBOSE) << getEffectName() << __func__ << ": done processing, effect consumed "
+ << status.fmqConsumed << " produced " << status.fmqProduced;
+ }
+ }
+}
+
// A placeholder processing implementation to copy samples from input to output
IEffect::Status EffectImpl::effectProcessImpl(float* in, float* out, int samples) {
for (int i = 0; i < samples; i++) {
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index 47ba9f4..fdd4803 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -25,8 +25,6 @@
#include "effect-impl/EffectThread.h"
#include "effect-impl/EffectTypes.h"
-using ::android::hardware::EventFlag;
-
namespace aidl::android::hardware::audio::effect {
EffectThread::EffectThread() {
@@ -38,31 +36,18 @@
LOG(DEBUG) << __func__ << " done";
}
-RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- int priority) {
+RetCode EffectThread::createThread(const std::string& name, int priority) {
if (mThread.joinable()) {
LOG(WARNING) << mName << __func__ << " thread already created, no-op";
return RetCode::SUCCESS;
}
+
mName = name;
mPriority = priority;
{
std::lock_guard lg(mThreadMutex);
mStop = true;
mExit = false;
- mThreadContext = std::move(context);
- auto statusMQ = mThreadContext->getStatusFmq();
- EventFlag* efGroup = nullptr;
- ::android::status_t status =
- EventFlag::createEventFlag(statusMQ->getEventFlagWord(), &efGroup);
- if (status != ::android::OK || !efGroup) {
- LOG(ERROR) << mName << __func__ << " create EventFlagGroup failed " << status
- << " efGroup " << efGroup;
- return RetCode::ERROR_THREAD;
- }
- mEfGroup.reset(efGroup);
- // kickoff and wait for commands (CommandId::START/STOP) or IEffect.close from client
- mEfGroup->wake(kEventFlagNotEmpty);
}
mThread = std::thread(&EffectThread::threadLoop, this);
@@ -75,16 +60,12 @@
std::lock_guard lg(mThreadMutex);
mStop = mExit = true;
}
- mCv.notify_one();
+ mCv.notify_one();
if (mThread.joinable()) {
mThread.join();
}
- {
- std::lock_guard lg(mThreadMutex);
- mThreadContext.reset();
- }
LOG(DEBUG) << mName << __func__;
return RetCode::SUCCESS;
}
@@ -96,7 +77,6 @@
mCv.notify_one();
}
- mEfGroup->wake(kEventFlagNotEmpty);
LOG(DEBUG) << mName << __func__;
return RetCode::SUCCESS;
}
@@ -108,7 +88,6 @@
mCv.notify_one();
}
- mEfGroup->wake(kEventFlagNotEmpty);
LOG(DEBUG) << mName << __func__;
return RetCode::SUCCESS;
}
@@ -117,13 +96,6 @@
pthread_setname_np(pthread_self(), mName.substr(0, kMaxTaskNameLen - 1).c_str());
setpriority(PRIO_PROCESS, 0, mPriority);
while (true) {
- /**
- * 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;
- mEfGroup->wait(kEventFlagNotEmpty, &efState);
-
{
std::unique_lock l(mThreadMutex);
::android::base::ScopedLockAssertion lock_assertion(mThreadMutex);
@@ -132,27 +104,8 @@
LOG(INFO) << __func__ << " EXIT!";
return;
}
- process_l();
}
- }
-}
-
-void EffectThread::process_l() {
- RETURN_VALUE_IF(!mThreadContext, void(), "nullContext");
-
- auto statusMQ = mThreadContext->getStatusFmq();
- auto inputMQ = mThreadContext->getInputDataFmq();
- auto outputMQ = mThreadContext->getOutputDataFmq();
- auto buffer = mThreadContext->getWorkBuffer();
-
- auto processSamples = inputMQ->availableToRead();
- if (processSamples) {
- inputMQ->read(buffer, processSamples);
- IEffect::Status status = effectProcessImpl(buffer, buffer, processSamples);
- outputMQ->write(buffer, status.fmqProduced);
- statusMQ->writeBlocking(&status, 1);
- LOG(VERBOSE) << mName << __func__ << ": done processing, effect consumed "
- << status.fmqConsumed << " produced " << status.fmqProduced;
+ process();
}
}
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index a805b87..cf0870e 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -180,17 +180,20 @@
StreamDescriptor::Reply reply{};
reply.status = STATUS_BAD_VALUE;
switch (command.getTag()) {
- case Tag::halReservedExit:
- if (const int32_t cookie = command.get<Tag::halReservedExit>();
- cookie == (mContext->getInternalCommandCookie() ^ getTid())) {
+ case Tag::halReservedExit: {
+ const int32_t cookie = command.get<Tag::halReservedExit>();
+ if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) {
mDriver->shutdown();
setClosed();
- // This is an internal command, no need to reply.
- return Status::EXIT;
} else {
LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie;
}
- break;
+ if (cookie != 0) { // This is an internal command, no need to reply.
+ return Status::EXIT;
+ } else {
+ break;
+ }
+ }
case Tag::getStatus:
populateReply(&reply, mIsConnected);
break;
@@ -400,17 +403,20 @@
reply.status = STATUS_BAD_VALUE;
using Tag = StreamDescriptor::Command::Tag;
switch (command.getTag()) {
- case Tag::halReservedExit:
- if (const int32_t cookie = command.get<Tag::halReservedExit>();
- cookie == (mContext->getInternalCommandCookie() ^ getTid())) {
+ case Tag::halReservedExit: {
+ const int32_t cookie = command.get<Tag::halReservedExit>();
+ if (cookie == (mContext->getInternalCommandCookie() ^ getTid())) {
mDriver->shutdown();
setClosed();
- // This is an internal command, no need to reply.
- return Status::EXIT;
} else {
LOG(WARNING) << __func__ << ": EXIT command has a bad cookie: " << cookie;
}
- break;
+ if (cookie != 0) { // This is an internal command, no need to reply.
+ return Status::EXIT;
+ } else {
+ break;
+ }
+ }
case Tag::getStatus:
populateReply(&reply, mIsConnected);
break;
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
index 5e18f1b..be0927c 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
@@ -168,10 +168,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> AcousticEchoCancelerSw::getContext() {
- return mContext;
-}
-
RetCode AcousticEchoCancelerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
index 73cf42b..95738f8 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.h
@@ -52,21 +52,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
private:
static const std::vector<Range::AcousticEchoCancelerRange> kRanges;
- std::shared_ptr<AcousticEchoCancelerSwContext> mContext;
+ std::shared_ptr<AcousticEchoCancelerSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterAcousticEchoCanceler(const AcousticEchoCanceler::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
index ce10ae1..d865b7e 100644
--- a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.cpp
@@ -177,10 +177,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> AutomaticGainControlV1Sw::getContext() {
- return mContext;
-}
-
RetCode AutomaticGainControlV1Sw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
index 7d2a69f..76b91ae 100644
--- a/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
+++ b/audio/aidl/default/automaticGainControlV1/AutomaticGainControlV1Sw.h
@@ -53,21 +53,24 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
static const std::vector<Range::AutomaticGainControlV1Range> kRanges;
- std::shared_ptr<AutomaticGainControlV1SwContext> mContext;
+ std::shared_ptr<AutomaticGainControlV1SwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterAutomaticGainControlV1(const AutomaticGainControlV1::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
index 1e336ac..3ff6e38 100644
--- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
@@ -180,10 +180,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> AutomaticGainControlV2Sw::getContext() {
- return mContext;
-}
-
RetCode AutomaticGainControlV2Sw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
index 9aa60ea..863d470 100644
--- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.h
@@ -59,21 +59,24 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
static const std::vector<Range::AutomaticGainControlV2Range> kRanges;
- std::shared_ptr<AutomaticGainControlV2SwContext> mContext;
+ std::shared_ptr<AutomaticGainControlV2SwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterAutomaticGainControlV2(const AutomaticGainControlV2::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp
index 6072d89..60adc30 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.cpp
+++ b/audio/aidl/default/bassboost/BassBoostSw.cpp
@@ -151,10 +151,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> BassBoostSw::getContext() {
- return mContext;
-}
-
RetCode BassBoostSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/bassboost/BassBoostSw.h b/audio/aidl/default/bassboost/BassBoostSw.h
index 1132472..901e455 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.h
+++ b/audio/aidl/default/bassboost/BassBoostSw.h
@@ -51,21 +51,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
static const std::vector<Range::BassBoostRange> kRanges;
- std::shared_ptr<BassBoostSwContext> mContext;
+ std::shared_ptr<BassBoostSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterBassBoost(const BassBoost::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/downmix/DownmixSw.cpp b/audio/aidl/default/downmix/DownmixSw.cpp
index ce5fe20..19ab2e8 100644
--- a/audio/aidl/default/downmix/DownmixSw.cpp
+++ b/audio/aidl/default/downmix/DownmixSw.cpp
@@ -144,10 +144,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> DownmixSw::getContext() {
- return mContext;
-}
-
RetCode DownmixSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/downmix/DownmixSw.h b/audio/aidl/default/downmix/DownmixSw.h
index 3f8a09b..1a9f0f0 100644
--- a/audio/aidl/default/downmix/DownmixSw.h
+++ b/audio/aidl/default/downmix/DownmixSw.h
@@ -55,20 +55,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int sample) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int sample)
+ REQUIRES(mImplMutex) override;
private:
- std::shared_ptr<DownmixSwContext> mContext;
+ std::shared_ptr<DownmixSwContext> mContext GUARDED_BY(mImplMutex);
- ndk::ScopedAStatus getParameterDownmix(const Downmix::Tag& tag, Parameter::Specific* specific);
+ ndk::ScopedAStatus getParameterDownmix(const Downmix::Tag& tag, Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
index e8f90b2..36face1 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
@@ -260,10 +260,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> DynamicsProcessingSw::getContext() {
- return mContext;
-}
-
RetCode DynamicsProcessingSw::releaseContext() {
if (mContext) {
mContext.reset();
@@ -282,6 +278,9 @@
}
RetCode DynamicsProcessingSwContext::setCommon(const Parameter::Common& common) {
+ if (auto ret = updateIOFrameSize(common); ret != RetCode::SUCCESS) {
+ return ret;
+ }
mCommon = common;
mChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
common.input.base.channelMask);
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
index 641cf71..98edca0 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
@@ -113,15 +113,17 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
private:
@@ -130,9 +132,10 @@
static const Range::DynamicsProcessingRange kPreEqBandRange;
static const Range::DynamicsProcessingRange kPostEqBandRange;
static const std::vector<Range::DynamicsProcessingRange> kRanges;
- std::shared_ptr<DynamicsProcessingSwContext> mContext;
+ std::shared_ptr<DynamicsProcessingSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
}; // DynamicsProcessingSw
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.cpp b/audio/aidl/default/envReverb/EnvReverbSw.cpp
index 73975c6..7937a6a 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.cpp
+++ b/audio/aidl/default/envReverb/EnvReverbSw.cpp
@@ -267,10 +267,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> EnvReverbSw::getContext() {
- return mContext;
-}
-
RetCode EnvReverbSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.h b/audio/aidl/default/envReverb/EnvReverbSw.h
index 5e31e2f..367462b 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.h
+++ b/audio/aidl/default/envReverb/EnvReverbSw.h
@@ -100,21 +100,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
std::string getEffectName() override { return kEffectName; }
private:
static const std::vector<Range::EnvironmentalReverbRange> kRanges;
- std::shared_ptr<EnvReverbSwContext> mContext;
+ std::shared_ptr<EnvReverbSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterEnvironmentalReverb(const EnvironmentalReverb::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp
index b2add31..640b3ba 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.cpp
+++ b/audio/aidl/default/equalizer/EqualizerSw.cpp
@@ -198,10 +198,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> EqualizerSw::getContext() {
- return mContext;
-}
-
RetCode EqualizerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/equalizer/EqualizerSw.h b/audio/aidl/default/equalizer/EqualizerSw.h
index 56af3b5..caaa129 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.h
+++ b/audio/aidl/default/equalizer/EqualizerSw.h
@@ -97,15 +97,17 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
@@ -113,7 +115,7 @@
static const std::vector<Equalizer::Preset> kPresets;
static const std::vector<Range::EqualizerRange> kRanges;
ndk::ScopedAStatus getParameterEqualizer(const Equalizer::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
std::shared_ptr<EqualizerSwContext> mContext;
};
diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp
index 4a4d71b6..11916c8 100644
--- a/audio/aidl/default/extension/ExtensionEffect.cpp
+++ b/audio/aidl/default/extension/ExtensionEffect.cpp
@@ -123,10 +123,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> ExtensionEffect::getContext() {
- return mContext;
-}
-
RetCode ExtensionEffect::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/extension/ExtensionEffect.h b/audio/aidl/default/extension/ExtensionEffect.h
index e7a068b..b560860 100644
--- a/audio/aidl/default/extension/ExtensionEffect.h
+++ b/audio/aidl/default/extension/ExtensionEffect.h
@@ -54,18 +54,20 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
- std::shared_ptr<ExtensionEffectContext> mContext;
+ std::shared_ptr<ExtensionEffectContext> mContext GUARDED_BY(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
index 27cdac8..7469ab9 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
@@ -158,10 +158,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> HapticGeneratorSw::getContext() {
- return mContext;
-}
-
RetCode HapticGeneratorSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
index 3bbe41a..47f3848 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.h
@@ -67,21 +67,24 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
- std::shared_ptr<HapticGeneratorSwContext> mContext;
+ std::shared_ptr<HapticGeneratorSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterHapticGenerator(const HapticGenerator::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/core-impl/ModuleRemoteSubmix.h b/audio/aidl/default/include/core-impl/ModuleRemoteSubmix.h
index 613ac62..9d8c027 100644
--- a/audio/aidl/default/include/core-impl/ModuleRemoteSubmix.h
+++ b/audio/aidl/default/include/core-impl/ModuleRemoteSubmix.h
@@ -57,7 +57,7 @@
ndk::ScopedAStatus onMasterVolumeChanged(float volume) override;
int32_t getNominalLatencyMs(
const ::aidl::android::media::audio::common::AudioPortConfig& portConfig) override;
- // TODO(b/307586684): Report proper minimum stream buffer size by overriding 'setAudioPatch'.
+ binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index aa9fb19..21e63f9 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -90,7 +90,7 @@
std::weak_ptr<sounddose::StreamDataProcessorInterface> streamDataProcessor,
DebugParameters debugParameters)
: mCommandMQ(std::move(commandMQ)),
- mInternalCommandCookie(std::rand()),
+ mInternalCommandCookie(std::rand() | 1 /* make sure it's not 0 */),
mReplyMQ(std::move(replyMQ)),
mFormat(format),
mChannelLayout(channelLayout),
diff --git a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
index 477c30e..b2cdc28 100644
--- a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
+++ b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
@@ -67,6 +67,7 @@
int64_t mStartTimeNs = 0;
long mFramesSinceStart = 0;
int mReadErrorCount = 0;
+ int mReadFailureCount = 0;
};
class StreamInRemoteSubmix final : public StreamIn, public StreamSwitcher {
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index 89d0c7c..24f3b5d 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -21,6 +21,7 @@
#include <Utils.h>
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
+#include <fmq/EventFlag.h>
#include <aidl/android/hardware/audio/effect/BnEffect.h>
#include "EffectTypes.h"
@@ -36,127 +37,73 @@
float, ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
DataMQ;
- EffectContext(size_t statusDepth, const Parameter::Common& common) {
- auto& input = common.input;
- auto& output = common.output;
-
- LOG_ALWAYS_FATAL_IF(
- input.base.format.pcm != aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
- "inputFormatNotFloat");
- LOG_ALWAYS_FATAL_IF(output.base.format.pcm !=
- aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
- "outputFormatNotFloat");
-
- size_t inputChannelCount =
- ::aidl::android::hardware::audio::common::getChannelCount(input.base.channelMask);
- LOG_ALWAYS_FATAL_IF(inputChannelCount == 0, "inputChannelCountNotValid");
- size_t outputChannelCount =
- ::aidl::android::hardware::audio::common::getChannelCount(output.base.channelMask);
- LOG_ALWAYS_FATAL_IF(outputChannelCount == 0, "outputChannelCountNotValid");
-
- mInputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
- input.base.format, input.base.channelMask);
- mOutputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
- output.base.format, output.base.channelMask);
- // in/outBuffer size in float (FMQ data format defined for DataMQ)
- size_t inBufferSizeInFloat = input.frameCount * mInputFrameSize / sizeof(float);
- size_t outBufferSizeInFloat = output.frameCount * mOutputFrameSize / sizeof(float);
-
- // only status FMQ use the EventFlag
- mStatusMQ = std::make_shared<StatusMQ>(statusDepth, true /*configureEventFlagWord*/);
- mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
- mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
-
- if (!mStatusMQ->isValid() || !mInputMQ->isValid() || !mOutputMQ->isValid()) {
- LOG(ERROR) << __func__ << " created invalid FMQ";
+ EffectContext(size_t statusDepth, const Parameter::Common& common);
+ virtual ~EffectContext() {
+ if (mEfGroup) {
+ ::android::hardware::EventFlag::deleteEventFlag(&mEfGroup);
}
- mWorkBuffer.reserve(std::max(inBufferSizeInFloat, outBufferSizeInFloat));
- mCommon = common;
}
- virtual ~EffectContext() {}
- std::shared_ptr<StatusMQ> getStatusFmq() { return mStatusMQ; }
- std::shared_ptr<DataMQ> getInputDataFmq() { return mInputMQ; }
- std::shared_ptr<DataMQ> getOutputDataFmq() { return mOutputMQ; }
+ std::shared_ptr<StatusMQ> getStatusFmq() const;
+ std::shared_ptr<DataMQ> getInputDataFmq() const;
+ std::shared_ptr<DataMQ> getOutputDataFmq() const;
- float* getWorkBuffer() { return static_cast<float*>(mWorkBuffer.data()); }
+ float* getWorkBuffer();
// reset buffer status by abandon input data in FMQ
- void resetBuffer() {
- auto buffer = static_cast<float*>(mWorkBuffer.data());
- std::vector<IEffect::Status> status(mStatusMQ->availableToRead());
- mInputMQ->read(buffer, mInputMQ->availableToRead());
- }
+ void resetBuffer();
+ void dupeFmq(IEffect::OpenEffectReturn* effectRet);
+ size_t getInputFrameSize() const;
+ size_t getOutputFrameSize() const;
+ int getSessionId() const;
+ int getIoHandle() const;
- void dupeFmq(IEffect::OpenEffectReturn* effectRet) {
- if (effectRet) {
- effectRet->statusMQ = mStatusMQ->dupeDesc();
- effectRet->inputDataMQ = mInputMQ->dupeDesc();
- effectRet->outputDataMQ = mOutputMQ->dupeDesc();
- }
- }
- size_t getInputFrameSize() { return mInputFrameSize; }
- size_t getOutputFrameSize() { return mOutputFrameSize; }
- int getSessionId() { return mCommon.session; }
- int getIoHandle() { return mCommon.ioHandle; }
+ virtual void dupeFmqWithReopen(IEffect::OpenEffectReturn* effectRet);
virtual RetCode setOutputDevice(
- const std::vector<aidl::android::media::audio::common::AudioDeviceDescription>&
- device) {
- mOutputDevice = device;
- return RetCode::SUCCESS;
- }
+ const std::vector<aidl::android::media::audio::common::AudioDeviceDescription>& device);
virtual std::vector<aidl::android::media::audio::common::AudioDeviceDescription>
- getOutputDevice() {
- return mOutputDevice;
- }
+ getOutputDevice();
- virtual RetCode setAudioMode(const aidl::android::media::audio::common::AudioMode& mode) {
- mMode = mode;
- return RetCode::SUCCESS;
- }
- virtual aidl::android::media::audio::common::AudioMode getAudioMode() { return mMode; }
+ virtual RetCode setAudioMode(const aidl::android::media::audio::common::AudioMode& mode);
+ virtual aidl::android::media::audio::common::AudioMode getAudioMode();
- virtual RetCode setAudioSource(const aidl::android::media::audio::common::AudioSource& source) {
- mSource = source;
- return RetCode::SUCCESS;
- }
- virtual aidl::android::media::audio::common::AudioSource getAudioSource() { return mSource; }
+ virtual RetCode setAudioSource(const aidl::android::media::audio::common::AudioSource& source);
+ virtual aidl::android::media::audio::common::AudioSource getAudioSource();
- virtual RetCode setVolumeStereo(const Parameter::VolumeStereo& volumeStereo) {
- mVolumeStereo = volumeStereo;
- return RetCode::SUCCESS;
- }
- virtual Parameter::VolumeStereo getVolumeStereo() { return mVolumeStereo; }
+ virtual RetCode setVolumeStereo(const Parameter::VolumeStereo& volumeStereo);
+ virtual Parameter::VolumeStereo getVolumeStereo();
- virtual RetCode setCommon(const Parameter::Common& common) {
- mCommon = common;
- LOG(VERBOSE) << __func__ << mCommon.toString();
- return RetCode::SUCCESS;
- }
- virtual Parameter::Common getCommon() {
- LOG(VERBOSE) << __func__ << mCommon.toString();
- return mCommon;
- }
+ virtual RetCode setCommon(const Parameter::Common& common);
+ virtual Parameter::Common getCommon();
+
+ virtual ::android::hardware::EventFlag* getStatusEventFlag();
protected:
- // common parameters
size_t mInputFrameSize;
size_t mOutputFrameSize;
- Parameter::Common mCommon;
- std::vector<aidl::android::media::audio::common::AudioDeviceDescription> mOutputDevice;
- aidl::android::media::audio::common::AudioMode mMode;
- aidl::android::media::audio::common::AudioSource mSource;
- Parameter::VolumeStereo mVolumeStereo;
+ size_t mInputChannelCount;
+ size_t mOutputChannelCount;
+ Parameter::Common mCommon = {};
+ std::vector<aidl::android::media::audio::common::AudioDeviceDescription> mOutputDevice = {};
+ aidl::android::media::audio::common::AudioMode mMode =
+ aidl::android::media::audio::common::AudioMode::SYS_RESERVED_INVALID;
+ aidl::android::media::audio::common::AudioSource mSource =
+ aidl::android::media::audio::common::AudioSource::SYS_RESERVED_INVALID;
+ Parameter::VolumeStereo mVolumeStereo = {};
+ RetCode updateIOFrameSize(const Parameter::Common& common);
+ RetCode notifyDataMqUpdate();
private:
// fmq and buffers
std::shared_ptr<StatusMQ> mStatusMQ;
std::shared_ptr<DataMQ> mInputMQ;
std::shared_ptr<DataMQ> mOutputMQ;
- // TODO handle effect process input and output
+ // std::shared_ptr<IEffect::OpenEffectReturn> mRet;
// work buffer set by effect instances, the access and update are in same thread
std::vector<float> mWorkBuffer;
+
+ ::android::hardware::EventFlag* mEfGroup;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectImpl.h b/audio/aidl/default/include/effect-impl/EffectImpl.h
index e7d081f..21f6502 100644
--- a/audio/aidl/default/include/effect-impl/EffectImpl.h
+++ b/audio/aidl/default/include/effect-impl/EffectImpl.h
@@ -43,38 +43,60 @@
OpenEffectReturn* ret) override;
virtual ndk::ScopedAStatus close() override;
virtual ndk::ScopedAStatus command(CommandId id) override;
+ virtual ndk::ScopedAStatus reopen(OpenEffectReturn* ret) override;
virtual ndk::ScopedAStatus getState(State* state) override;
virtual ndk::ScopedAStatus setParameter(const Parameter& param) override;
virtual ndk::ScopedAStatus getParameter(const Parameter::Id& id, Parameter* param) override;
- virtual ndk::ScopedAStatus setParameterCommon(const Parameter& param);
- virtual ndk::ScopedAStatus getParameterCommon(const Parameter::Tag& tag, Parameter* param);
+ virtual ndk::ScopedAStatus setParameterCommon(const Parameter& param) REQUIRES(mImplMutex);
+ virtual ndk::ScopedAStatus getParameterCommon(const Parameter::Tag& tag, Parameter* param)
+ REQUIRES(mImplMutex);
/* Methods MUST be implemented by each effect instances */
virtual ndk::ScopedAStatus getDescriptor(Descriptor* desc) = 0;
- virtual ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) = 0;
+ virtual ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) = 0;
virtual ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) = 0;
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex) = 0;
virtual std::string getEffectName() = 0;
- virtual IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ virtual std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex);
+ virtual RetCode releaseContext() REQUIRES(mImplMutex) = 0;
/**
- * Effect context methods must be implemented by each effect.
- * Each effect can derive from EffectContext and define its own context, but must upcast to
- * EffectContext for EffectImpl to use.
+ * @brief effectProcessImpl is running in worker thread which created in EffectThread.
+ *
+ * EffectThread will make sure effectProcessImpl only be called after startThread() successful
+ * and before stopThread() successful.
+ *
+ * effectProcessImpl implementation must not call any EffectThread interface, otherwise it will
+ * cause deadlock.
+ *
+ * @param in address of input float buffer.
+ * @param out address of output float buffer.
+ * @param samples number of samples to process.
+ * @return IEffect::Status
*/
- virtual std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) = 0;
- virtual std::shared_ptr<EffectContext> getContext() = 0;
- virtual RetCode releaseContext() = 0;
+ virtual IEffect::Status effectProcessImpl(float* in, float* out, int samples) = 0;
+
+ /**
+ * process() get data from data MQs, and call effectProcessImpl() for effect data processing.
+ * Its important for the implementation to use mImplMutex for context synchronization.
+ */
+ void process() override;
protected:
- State mState = State::INIT;
+ State mState GUARDED_BY(mImplMutex) = State::INIT;
IEffect::Status status(binder_status_t status, size_t consumed, size_t produced);
void cleanUp();
+ std::mutex mImplMutex;
+ std::shared_ptr<EffectContext> mImplContext GUARDED_BY(mImplMutex);
+
/**
* Optional CommandId handling methods for effects to override.
* For CommandId::START, EffectImpl call commandImpl before starting the EffectThread
@@ -82,6 +104,9 @@
* For CommandId::STOP and CommandId::RESET, EffectImpl call commandImpl after stop the
* EffectThread processing.
*/
- virtual ndk::ScopedAStatus commandImpl(CommandId id);
+ virtual ndk::ScopedAStatus commandImpl(CommandId id) REQUIRES(mImplMutex);
+
+ RetCode notifyEventFlag(uint32_t flag);
+ ::android::hardware::EventFlag* mEventFlag;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h
index ae51ef7..3dbb0e6 100644
--- a/audio/aidl/default/include/effect-impl/EffectThread.h
+++ b/audio/aidl/default/include/effect-impl/EffectThread.h
@@ -36,8 +36,7 @@
virtual ~EffectThread();
// called by effect implementation.
- RetCode createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- int priority = ANDROID_PRIORITY_URGENT_AUDIO);
+ RetCode createThread(const std::string& name, int priority = ANDROID_PRIORITY_URGENT_AUDIO);
RetCode destroyThread();
RetCode startThread();
RetCode stopThread();
@@ -46,32 +45,11 @@
void threadLoop();
/**
- * @brief effectProcessImpl is running in worker thread which created in EffectThread.
- *
- * Effect implementation should think about concurrency in the implementation if necessary.
- * Parameter setting usually implemented in context (derived from EffectContext), and some
- * parameter maybe used in the processing, then effect implementation should consider using a
- * mutex to protect these parameter.
- *
- * EffectThread will make sure effectProcessImpl only be called after startThread() successful
- * and before stopThread() successful.
- *
- * effectProcessImpl implementation must not call any EffectThread interface, otherwise it will
- * cause deadlock.
- *
- * @param in address of input float buffer.
- * @param out address of output float buffer.
- * @param samples number of samples to process.
- * @return IEffect::Status
- */
- virtual IEffect::Status effectProcessImpl(float* in, float* out, int samples) = 0;
-
- /**
* process() call effectProcessImpl() for effect data processing, it is necessary for the
* processing to be called under Effect thread mutex mThreadMutex, to avoid the effect state
* change before/during data processing, and keep the thread and effect state consistent.
*/
- virtual void process_l() REQUIRES(mThreadMutex);
+ virtual void process() = 0;
private:
static constexpr int kMaxTaskNameLen = 15;
@@ -80,16 +58,7 @@
std::condition_variable mCv;
bool mStop GUARDED_BY(mThreadMutex) = true;
bool mExit GUARDED_BY(mThreadMutex) = false;
- std::shared_ptr<EffectContext> mThreadContext GUARDED_BY(mThreadMutex);
- struct EventFlagDeleter {
- void operator()(::android::hardware::EventFlag* flag) const {
- if (flag) {
- ::android::hardware::EventFlag::deleteEventFlag(&flag);
- }
- }
- };
- std::unique_ptr<::android::hardware::EventFlag, EventFlagDeleter> mEfGroup;
std::thread mThread;
int mPriority;
std::string mName;
diff --git a/audio/aidl/default/include/effect-impl/EffectTypes.h b/audio/aidl/default/include/effect-impl/EffectTypes.h
index 4bda7be..9740d6e 100644
--- a/audio/aidl/default/include/effect-impl/EffectTypes.h
+++ b/audio/aidl/default/include/effect-impl/EffectTypes.h
@@ -46,7 +46,8 @@
ERROR_NULL_POINTER, /* NULL pointer */
ERROR_ALIGNMENT_ERROR, /* Memory alignment error */
ERROR_BLOCK_SIZE_EXCEED, /* Maximum block size exceeded */
- ERROR_EFFECT_LIB_ERROR
+ ERROR_EFFECT_LIB_ERROR, /* Effect implementation library error */
+ ERROR_EVENT_FLAG_ERROR /* Error with effect event flags */
};
static const int INVALID_AUDIO_SESSION_ID = -1;
@@ -67,6 +68,8 @@
return out << "ERROR_BLOCK_SIZE_EXCEED";
case RetCode::ERROR_EFFECT_LIB_ERROR:
return out << "ERROR_EFFECT_LIB_ERROR";
+ case RetCode::ERROR_EVENT_FLAG_ERROR:
+ return out << "ERROR_EVENT_FLAG_ERROR";
}
return out << "EnumError: " << code;
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
index 7954316..1e70716 100644
--- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
@@ -147,10 +147,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> LoudnessEnhancerSw::getContext() {
- return mContext;
-}
-
RetCode LoudnessEnhancerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
index 25824f2..cf71a5f 100644
--- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.h
@@ -54,20 +54,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
- std::shared_ptr<LoudnessEnhancerSwContext> mContext;
+ std::shared_ptr<LoudnessEnhancerSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterLoudnessEnhancer(const LoudnessEnhancer::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
index a3208df..d304416 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
@@ -155,10 +155,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> NoiseSuppressionSw::getContext() {
- return mContext;
-}
-
RetCode NoiseSuppressionSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
index fc1e028..acef8ee 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.h
@@ -55,20 +55,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
- std::shared_ptr<NoiseSuppressionSwContext> mContext;
+ std::shared_ptr<NoiseSuppressionSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterNoiseSuppression(const NoiseSuppression::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.cpp b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
index 3f02eb7..2ac2010 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.cpp
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
@@ -161,10 +161,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> PresetReverbSw::getContext() {
- return mContext;
-}
-
RetCode PresetReverbSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.h b/audio/aidl/default/presetReverb/PresetReverbSw.h
index 9ceee7c..61fc88c 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.h
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.h
@@ -56,21 +56,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
- std::shared_ptr<PresetReverbSwContext> mContext;
+ std::shared_ptr<PresetReverbSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterPresetReverb(const PresetReverb::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp b/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp
index 7bc783c..b44f37b 100644
--- a/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp
+++ b/audio/aidl/default/r_submix/ModuleRemoteSubmix.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "AHAL_ModuleRemoteSubmix"
+#include <stdio.h>
#include <vector>
#include <android-base/logging.h>
@@ -174,4 +175,9 @@
return kMinLatencyMs;
}
+binder_status_t ModuleRemoteSubmix::dump(int fd, const char** /*args*/, uint32_t /*numArgs*/) {
+ dprintf(fd, "\nSubmixRoutes:\n%s\n", r_submix::SubmixRoute::dumpRoutes().c_str());
+ return STATUS_OK;
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
index 3ee354b..fa4135d 100644
--- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
+++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
@@ -267,6 +267,7 @@
}
return ::android::OK;
}
+ mReadErrorCount = 0;
LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount
<< " frames";
@@ -294,7 +295,12 @@
}
}
if (actuallyRead < frameCount) {
- LOG(WARNING) << __func__ << ": read " << actuallyRead << " vs. requested " << frameCount;
+ if (++mReadFailureCount < kMaxReadFailureAttempts) {
+ LOG(WARNING) << __func__ << ": read " << actuallyRead << " vs. requested " << frameCount
+ << " (not all errors will be logged)";
+ }
+ } else {
+ mReadFailureCount = 0;
}
mCurrentRoute->updateReadCounterFrames(*actualFrameCount);
return ::android::OK;
diff --git a/audio/aidl/default/r_submix/SubmixRoute.cpp b/audio/aidl/default/r_submix/SubmixRoute.cpp
index 7d706c2..325a012 100644
--- a/audio/aidl/default/r_submix/SubmixRoute.cpp
+++ b/audio/aidl/default/r_submix/SubmixRoute.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <mutex>
+
#define LOG_TAG "AHAL_SubmixRoute"
#include <android-base/logging.h>
#include <media/AidlConversionCppNdk.h>
@@ -28,10 +30,11 @@
namespace aidl::android::hardware::audio::core::r_submix {
// static
-SubmixRoute::RoutesMonitor SubmixRoute::getRoutes() {
+SubmixRoute::RoutesMonitor SubmixRoute::getRoutes(bool tryLock) {
static std::mutex submixRoutesLock;
static RoutesMap submixRoutes;
- return RoutesMonitor(submixRoutesLock, submixRoutes);
+ return !tryLock ? RoutesMonitor(submixRoutesLock, submixRoutes)
+ : RoutesMonitor(submixRoutesLock, submixRoutes, tryLock);
}
// static
@@ -66,6 +69,21 @@
getRoutes()->erase(deviceAddress);
}
+// static
+std::string SubmixRoute::dumpRoutes() {
+ auto routes = getRoutes(true /*tryLock*/);
+ std::string result;
+ if (routes->empty()) result.append(" <Empty>");
+ for (const auto& r : *(routes.operator->())) {
+ result.append(" - ")
+ .append(r.first.toString())
+ .append(": ")
+ .append(r.second->dump())
+ .append("\n");
+ }
+ return result;
+}
+
// Verify a submix input or output stream can be opened.
bool SubmixRoute::isStreamConfigValid(bool isInput, const AudioConfig& streamConfig) {
// If the stream is already open, don't open it again.
@@ -258,4 +276,23 @@
}
}
+std::string SubmixRoute::dump() NO_THREAD_SAFETY_ANALYSIS {
+ const bool isLocked = mLock.try_lock();
+ std::string result = std::string(isLocked ? "" : "! ")
+ .append("Input ")
+ .append(mStreamInOpen ? "open" : "closed")
+ .append(mStreamInStandby ? ", standby" : ", active")
+ .append(", refcount: ")
+ .append(std::to_string(mInputRefCount))
+ .append(", framesRead: ")
+ .append(mSource ? std::to_string(mSource->framesRead()) : "<null>")
+ .append("; Output ")
+ .append(mStreamOutOpen ? "open" : "closed")
+ .append(mStreamOutStandby ? ", standby" : ", active")
+ .append(", framesWritten: ")
+ .append(mSink ? std::to_string(mSink->framesWritten()) : "<null>");
+ if (isLocked) mLock.unlock();
+ return result;
+}
+
} // namespace aidl::android::hardware::audio::core::r_submix
diff --git a/audio/aidl/default/r_submix/SubmixRoute.h b/audio/aidl/default/r_submix/SubmixRoute.h
index 160df41..5425f12 100644
--- a/audio/aidl/default/r_submix/SubmixRoute.h
+++ b/audio/aidl/default/r_submix/SubmixRoute.h
@@ -17,6 +17,7 @@
#pragma once
#include <mutex>
+#include <string>
#include <android-base/thread_annotations.h>
#include <audio_utils/clock.h>
@@ -68,6 +69,7 @@
const ::aidl::android::media::audio::common::AudioDeviceAddress& deviceAddress);
static void removeRoute(
const ::aidl::android::media::audio::common::AudioDeviceAddress& deviceAddress);
+ static std::string dumpRoutes();
bool isStreamInOpen() {
std::lock_guard guard(mLock);
@@ -115,20 +117,24 @@
void standby(bool isInput);
long updateReadCounterFrames(size_t frameCount);
+ std::string dump();
+
private:
using RoutesMap = std::map<::aidl::android::media::audio::common::AudioDeviceAddress,
std::shared_ptr<r_submix::SubmixRoute>>;
class RoutesMonitor {
public:
RoutesMonitor(std::mutex& mutex, RoutesMap& routes) : mLock(mutex), mRoutes(routes) {}
+ RoutesMonitor(std::mutex& mutex, RoutesMap& routes, bool /*tryLock*/)
+ : mLock(mutex, std::try_to_lock), mRoutes(routes) {}
RoutesMap* operator->() { return &mRoutes; }
private:
- std::lock_guard<std::mutex> mLock;
+ std::unique_lock<std::mutex> mLock;
RoutesMap& mRoutes;
};
- static RoutesMonitor getRoutes();
+ static RoutesMonitor getRoutes(bool tryLock = false);
bool isStreamConfigCompatible(const AudioConfig& streamConfig);
diff --git a/audio/aidl/default/spatializer/SpatializerSw.cpp b/audio/aidl/default/spatializer/SpatializerSw.cpp
index 434ed5a..6d3c4bd 100644
--- a/audio/aidl/default/spatializer/SpatializerSw.cpp
+++ b/audio/aidl/default/spatializer/SpatializerSw.cpp
@@ -141,10 +141,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> SpatializerSw::getContext() {
- return mContext;
-}
-
RetCode SpatializerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/spatializer/SpatializerSw.h b/audio/aidl/default/spatializer/SpatializerSw.h
index b205704..b321e83 100644
--- a/audio/aidl/default/spatializer/SpatializerSw.h
+++ b/audio/aidl/default/spatializer/SpatializerSw.h
@@ -50,19 +50,21 @@
~SpatializerSw();
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; };
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
private:
static const std::vector<Range::SpatializerRange> kRanges;
- std::shared_ptr<SpatializerSwContext> mContext = nullptr;
+ std::shared_ptr<SpatializerSwContext> mContext GUARDED_BY(mImplMutex) = nullptr;
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
index 0e8435e..091b0b7 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
@@ -203,10 +203,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> VirtualizerSw::getContext() {
- return mContext;
-}
-
RetCode VirtualizerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.h b/audio/aidl/default/virtualizer/VirtualizerSw.h
index 5e114d9..9287838 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.h
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.h
@@ -59,24 +59,25 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
std::string getEffectName() override { return kEffectName; }
private:
static const std::vector<Range::VirtualizerRange> kRanges;
- std::shared_ptr<VirtualizerSwContext> mContext;
+ std::shared_ptr<VirtualizerSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterVirtualizer(const Virtualizer::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
ndk::ScopedAStatus getSpeakerAngles(const Virtualizer::SpeakerAnglesPayload payload,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/visualizer/VisualizerSw.cpp b/audio/aidl/default/visualizer/VisualizerSw.cpp
index 285c102..54f7f1c 100644
--- a/audio/aidl/default/visualizer/VisualizerSw.cpp
+++ b/audio/aidl/default/visualizer/VisualizerSw.cpp
@@ -190,10 +190,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> VisualizerSw::getContext() {
- return mContext;
-}
-
RetCode VisualizerSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/visualizer/VisualizerSw.h b/audio/aidl/default/visualizer/VisualizerSw.h
index 995774e..4b87b04 100644
--- a/audio/aidl/default/visualizer/VisualizerSw.h
+++ b/audio/aidl/default/visualizer/VisualizerSw.h
@@ -72,21 +72,23 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
static const std::vector<Range::VisualizerRange> kRanges;
- std::shared_ptr<VisualizerSwContext> mContext;
+ std::shared_ptr<VisualizerSwContext> mContext GUARDED_BY(mImplMutex);
ndk::ScopedAStatus getParameterVisualizer(const Visualizer::Tag& tag,
- Parameter::Specific* specific);
+ Parameter::Specific* specific) REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp
index 8902584..dd019f6 100644
--- a/audio/aidl/default/volume/VolumeSw.cpp
+++ b/audio/aidl/default/volume/VolumeSw.cpp
@@ -160,10 +160,6 @@
return mContext;
}
-std::shared_ptr<EffectContext> VolumeSw::getContext() {
- return mContext;
-}
-
RetCode VolumeSw::releaseContext() {
if (mContext) {
mContext.reset();
diff --git a/audio/aidl/default/volume/VolumeSw.h b/audio/aidl/default/volume/VolumeSw.h
index 1432b2b..3fc0d97 100644
--- a/audio/aidl/default/volume/VolumeSw.h
+++ b/audio/aidl/default/volume/VolumeSw.h
@@ -57,21 +57,24 @@
}
ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
- ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
- ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
- Parameter::Specific* specific) override;
+ ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
+ REQUIRES(mImplMutex) override;
+ ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
+ REQUIRES(mImplMutex) override;
- std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
- std::shared_ptr<EffectContext> getContext() override;
- RetCode releaseContext() override;
+ std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
+ REQUIRES(mImplMutex) override;
+ RetCode releaseContext() REQUIRES(mImplMutex) override;
- IEffect::Status effectProcessImpl(float* in, float* out, int samples) override;
+ IEffect::Status effectProcessImpl(float* in, float* out, int samples)
+ REQUIRES(mImplMutex) override;
std::string getEffectName() override { return kEffectName; }
private:
static const std::vector<Range::VolumeRange> kRanges;
- std::shared_ptr<VolumeSwContext> mContext;
+ std::shared_ptr<VolumeSwContext> mContext GUARDED_BY(mImplMutex);
- ndk::ScopedAStatus getParameterVolume(const Volume::Tag& tag, Parameter::Specific* specific);
+ ndk::ScopedAStatus getParameterVolume(const Volume::Tag& tag, Parameter::Specific* specific)
+ REQUIRES(mImplMutex);
};
} // namespace aidl::android::hardware::audio::effect
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 4a5c537..9fa7f9f 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -43,6 +43,7 @@
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::kEventFlagDataMqUpdate;
using aidl::android::hardware::audio::effect::kEventFlagNotEmpty;
using aidl::android::hardware::audio::effect::Parameter;
using aidl::android::hardware::audio::effect::Range;
@@ -191,6 +192,16 @@
ASSERT_TRUE(dataMq->read(buffer.data(), expectFloats));
}
}
+ static void expectDataMqUpdateEventFlag(std::unique_ptr<StatusMQ>& statusMq) {
+ EventFlag* efGroup;
+ ASSERT_EQ(::android::OK,
+ EventFlag::createEventFlag(statusMq->getEventFlagWord(), &efGroup));
+ ASSERT_NE(nullptr, efGroup);
+ uint32_t efState = 0;
+ EXPECT_EQ(::android::OK, efGroup->wait(kEventFlagDataMqUpdate, &efState, 1'000'000 /*1ms*/,
+ true /* retry */));
+ EXPECT_TRUE(efState & kEventFlagDataMqUpdate);
+ }
static Parameter::Common createParamCommon(
int session = 0, int ioHandle = -1, int iSampleRate = 48000, int oSampleRate = 48000,
long iFrameCount = 0x100, long oFrameCount = 0x100,
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index f91795b..7373073 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -4583,8 +4583,7 @@
static std::vector<std::string> getRemoteSubmixModuleInstance() {
auto instances = android::getAidlHalInstanceNames(IModule::descriptor);
for (auto instance : instances) {
- if (instance.find("r_submix") != std::string::npos)
- return (std::vector<std::string>{instance});
+ if (instance.ends_with("/r_submix")) return (std::vector<std::string>{instance});
}
return {};
}
@@ -4672,6 +4671,9 @@
// Turn off "debug" which enables connections simulation. Since devices of the remote
// submix module are virtual, there is no need for simulation.
ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam(), false /*setUpDebug*/));
+ if (int32_t version; module->getInterfaceVersion(&version).isOk() && version < 2) {
+ GTEST_SKIP() << "V1 uses a deprecated remote submix device type encoding";
+ }
ASSERT_NO_FATAL_FAILURE(SetUpModuleConfig());
}
};
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 418fedb..01cdd81 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -609,6 +609,49 @@
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
}
+// Verify Parameters kept after reset.
+TEST_P(AudioEffectTest, SetCommonParameterAndReopen) {
+ ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+
+ Parameter::Common common = EffectHelper::createParamCommon(
+ 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
+ kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
+ IEffect::OpenEffectReturn ret;
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, std::nullopt /* specific */, &ret, EX_NONE));
+ auto statusMQ = std::make_unique<EffectHelper::StatusMQ>(ret.statusMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ auto inputMQ = std::make_unique<EffectHelper::DataMQ>(ret.inputDataMQ);
+ ASSERT_TRUE(inputMQ->isValid());
+ auto outputMQ = std::make_unique<EffectHelper::DataMQ>(ret.outputDataMQ);
+ ASSERT_TRUE(outputMQ->isValid());
+
+ Parameter::Id id = Parameter::Id::make<Parameter::Id::commonTag>(Parameter::common);
+ common.input.frameCount++;
+ ASSERT_NO_FATAL_FAILURE(setAndGetParameter(id, Parameter::make<Parameter::common>(common)));
+ ASSERT_TRUE(statusMQ->isValid());
+ expectDataMqUpdateEventFlag(statusMQ);
+ EXPECT_IS_OK(mEffect->reopen(&ret));
+ inputMQ = std::make_unique<EffectHelper::DataMQ>(ret.inputDataMQ);
+ outputMQ = std::make_unique<EffectHelper::DataMQ>(ret.outputDataMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ ASSERT_TRUE(inputMQ->isValid());
+ ASSERT_TRUE(outputMQ->isValid());
+
+ common.output.frameCount++;
+ ASSERT_NO_FATAL_FAILURE(setAndGetParameter(id, Parameter::make<Parameter::common>(common)));
+ ASSERT_TRUE(statusMQ->isValid());
+ expectDataMqUpdateEventFlag(statusMQ);
+ EXPECT_IS_OK(mEffect->reopen(&ret));
+ inputMQ = std::make_unique<EffectHelper::DataMQ>(ret.inputDataMQ);
+ outputMQ = std::make_unique<EffectHelper::DataMQ>(ret.outputDataMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ ASSERT_TRUE(inputMQ->isValid());
+ ASSERT_TRUE(outputMQ->isValid());
+
+ ASSERT_NO_FATAL_FAILURE(close(mEffect));
+ ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+}
+
/// Data processing test
// Send data to effects and expect it to be consumed by checking statusMQ.
// Effects exposing bypass flags or operating in offload mode will be skipped.
@@ -684,6 +727,59 @@
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
}
+// Send data to effects and expect it to be consumed after effect reopen (IO AudioConfig change).
+// Effects exposing bypass flags or operating in offload mode will be skipped.
+TEST_P(AudioEffectDataPathTest, ConsumeDataAfterReopen) {
+ ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
+
+ Parameter::Common common = EffectHelper::createParamCommon(
+ 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
+ kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
+ IEffect::OpenEffectReturn ret;
+ ASSERT_NO_FATAL_FAILURE(open(mEffect, common, std::nullopt /* specific */, &ret, EX_NONE));
+ auto statusMQ = std::make_unique<EffectHelper::StatusMQ>(ret.statusMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ auto inputMQ = std::make_unique<EffectHelper::DataMQ>(ret.inputDataMQ);
+ ASSERT_TRUE(inputMQ->isValid());
+ auto outputMQ = std::make_unique<EffectHelper::DataMQ>(ret.outputDataMQ);
+ ASSERT_TRUE(outputMQ->isValid());
+
+ std::vector<float> buffer;
+ 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::readFromFmq(statusMQ, 1, outputMQ, buffer.size(), buffer));
+
+ // set a new common parameter with different IO frameCount, reopen
+ Parameter::Id id = Parameter::Id::make<Parameter::Id::commonTag>(Parameter::common);
+ common.input.frameCount += 4;
+ common.output.frameCount += 4;
+ ASSERT_NO_FATAL_FAILURE(setAndGetParameter(id, Parameter::make<Parameter::common>(common)));
+ ASSERT_TRUE(statusMQ->isValid());
+ expectDataMqUpdateEventFlag(statusMQ);
+ EXPECT_IS_OK(mEffect->reopen(&ret));
+ inputMQ = std::make_unique<EffectHelper::DataMQ>(ret.inputDataMQ);
+ outputMQ = std::make_unique<EffectHelper::DataMQ>(ret.outputDataMQ);
+ ASSERT_TRUE(statusMQ->isValid());
+ ASSERT_TRUE(inputMQ->isValid());
+ ASSERT_TRUE(outputMQ->isValid());
+
+ // 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::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::readFromFmq(statusMQ, 0, outputMQ, 0, buffer));
+
+ ASSERT_NO_FATAL_FAILURE(close(mEffect));
+ ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+}
+
// Send data to IDLE effects and expect it to be consumed after effect start.
// Effects exposing bypass flags or operating in offload mode will be skipped.
TEST_P(AudioEffectDataPathTest, SendDataAtIdleAndConsumeDataInProcessing) {
diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
index b82bde1..360bf26 100644
--- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
@@ -138,7 +138,6 @@
void setDataTestParams(int32_t layoutType) {
mInputBuffer.resize(kBufferSize);
- mOutputBuffer.resize(kBufferSize);
// Get the number of channels used
mInputChannelCount = getChannelCount(
@@ -146,6 +145,7 @@
// In case of downmix, output is always configured to stereo layout.
mOutputBufferSize = (mInputBuffer.size() / mInputChannelCount) * kOutputChannelCount;
+ mOutputBuffer.resize(mOutputBufferSize);
}
// Generate mInputBuffer values between -kMaxDownmixSample to kMaxDownmixSample
@@ -262,13 +262,13 @@
for (size_t i = 0, j = position; i < mOutputBufferSize;
i += kOutputChannelCount, j += mInputChannelCount) {
// Validate Left channel has no audio
- ASSERT_EQ(mOutputBuffer[i], 0);
+ ASSERT_EQ(mOutputBuffer[i], 0) << " at " << i;
// Validate Right channel has audio
if (mInputBuffer[j] != 0) {
- ASSERT_NE(mOutputBuffer[i + 1], 0);
+ ASSERT_NE(mOutputBuffer[i + 1], 0) << " at " << i;
} else {
// No change in output when input is 0
- ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]);
+ ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]) << " at " << i;
}
}
}
@@ -402,9 +402,6 @@
ASSERT_EQ(mOutputBuffer[j], mInputBuffer[i]);
ASSERT_EQ(mOutputBuffer[j + 1], mInputBuffer[i + 1]);
}
- for (size_t i = mOutputBufferSize; i < kBufferSize; i++) {
- ASSERT_EQ(mOutputBuffer[i], mInputBuffer[i]);
- }
}
int32_t mInputChannelLayout;
diff --git a/automotive/vehicle/aidl/Android.bp b/automotive/vehicle/aidl/Android.bp
index 3b93bca..7405d4c 100644
--- a/automotive/vehicle/aidl/Android.bp
+++ b/automotive/vehicle/aidl/Android.bp
@@ -41,6 +41,9 @@
"com.android.car.framework",
],
},
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
diff --git a/automotive/vehicle/aidl_property/Android.bp b/automotive/vehicle/aidl_property/Android.bp
index 19fa4a3..580be68 100644
--- a/automotive/vehicle/aidl_property/Android.bp
+++ b/automotive/vehicle/aidl_property/Android.bp
@@ -42,6 +42,9 @@
"com.android.car.framework",
],
},
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
index be49a74..85bc48a 100644
--- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
+++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
@@ -120,6 +120,16 @@
ChannelMode::UNKNOWN, ChannelMode::MONO, ChannelMode::STEREO};
static std::vector<LatencyMode> latency_modes = {LatencyMode::FREE};
+enum class BluetoothAudioHalVersion : int32_t {
+ VERSION_UNAVAILABLE = 0,
+ VERSION_2_0,
+ VERSION_2_1,
+ VERSION_AIDL_V1,
+ VERSION_AIDL_V2,
+ VERSION_AIDL_V3,
+ VERSION_AIDL_V4,
+};
+
// Some valid configs for HFP PCM configuration (software sessions)
static constexpr int32_t hfp_sample_rates_[] = {8000, 16000, 32000};
static constexpr int8_t hfp_bits_per_samples_[] = {16};
@@ -221,7 +231,6 @@
temp_provider_info_ = std::nullopt;
auto aidl_reval =
provider_factory_->getProviderInfo(session_type, &temp_provider_info_);
- ASSERT_TRUE(aidl_reval.isOk());
}
void GetProviderCapabilitiesHelper(const SessionType& session_type) {
@@ -623,9 +632,38 @@
SessionType::LE_AUDIO_BROADCAST_HARDWARE_OFFLOAD_ENCODING_DATAPATH,
SessionType::A2DP_SOFTWARE_DECODING_DATAPATH,
SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH,
+ };
+
+ static constexpr SessionType kAndroidVSessionType[] = {
SessionType::HFP_SOFTWARE_ENCODING_DATAPATH,
SessionType::HFP_SOFTWARE_DECODING_DATAPATH,
};
+
+ BluetoothAudioHalVersion GetProviderFactoryInterfaceVersion() {
+ int32_t aidl_version = 0;
+ if (provider_factory_ == nullptr) {
+ return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
+ }
+
+ auto aidl_retval = provider_factory_->getInterfaceVersion(&aidl_version);
+ if (!aidl_retval.isOk()) {
+ return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
+ }
+ switch (aidl_version) {
+ case 1:
+ return BluetoothAudioHalVersion::VERSION_AIDL_V1;
+ case 2:
+ return BluetoothAudioHalVersion::VERSION_AIDL_V2;
+ case 3:
+ return BluetoothAudioHalVersion::VERSION_AIDL_V3;
+ case 4:
+ return BluetoothAudioHalVersion::VERSION_AIDL_V4;
+ default:
+ return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
+ }
+
+ return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
+ }
};
/**
@@ -647,6 +685,15 @@
EXPECT_TRUE(temp_provider_capabilities_.empty() ||
audio_provider_ != nullptr);
}
+ if (GetProviderFactoryInterfaceVersion() >=
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ for (auto session_type : kAndroidVSessionType) {
+ GetProviderCapabilitiesHelper(session_type);
+ OpenProviderHelper(session_type);
+ EXPECT_TRUE(temp_provider_capabilities_.empty() ||
+ audio_provider_ != nullptr);
+ }
+ }
}
/**
@@ -736,8 +783,7 @@
ASSERT_NE(codec_info.id.getTag(), CodecId::a2dp);
// The codec info must contain the information
// for le audio transport.
- // ASSERT_EQ(codec_info.transport.getTag(),
- // CodecInfo::Transport::le_audio);
+ ASSERT_EQ(codec_info.transport.getTag(), CodecInfo::Transport::leAudio);
}
}
}
@@ -1465,8 +1511,8 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH can be started and stopped with
- * different PCM config
+ * SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH can be started and stopped
+ * with different PCM config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingSoftwareAidl,
StartAndEndA2dpEncodingSoftwareSessionWithPossiblePcmConfig) {
@@ -1503,6 +1549,10 @@
public:
virtual void SetUp() override {
BluetoothAudioProviderFactoryAidl::SetUp();
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
GetProviderCapabilitiesHelper(SessionType::HFP_SOFTWARE_ENCODING_DATAPATH);
OpenProviderHelper(SessionType::HFP_SOFTWARE_ENCODING_DATAPATH);
ASSERT_NE(audio_provider_, nullptr);
@@ -1570,6 +1620,10 @@
public:
virtual void SetUp() override {
BluetoothAudioProviderFactoryAidl::SetUp();
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
GetProviderCapabilitiesHelper(SessionType::HFP_SOFTWARE_DECODING_DATAPATH);
OpenProviderHelper(SessionType::HFP_SOFTWARE_DECODING_DATAPATH);
ASSERT_NE(audio_provider_, nullptr);
@@ -1658,13 +1712,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * SBC hardware encoding config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with SBC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpSbcEncodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -1688,13 +1742,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * AAC hardware encoding config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with AAC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpAacEncodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -1718,13 +1772,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * LDAC hardware encoding config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with LDAC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpLdacEncodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -1748,13 +1802,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * Opus hardware encoding config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with Opus hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpOpusEncodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -1778,13 +1832,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * AptX hardware encoding config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with AptX hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpAptxEncodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) {
@@ -1814,13 +1868,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped with
- * an invalid codec config
+ * SessionType::A2DP_HARDWARE_ENCODING_DATAPATH can be started and stopped
+ * with an invalid codec config
*/
TEST_P(BluetoothAudioProviderA2dpEncodingHardwareAidl,
StartAndEndA2dpEncodingHardwareSessionInvalidCodecConfig) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
ASSERT_NE(audio_provider_, nullptr);
@@ -1886,6 +1940,10 @@
public:
virtual void SetUp() override {
BluetoothAudioProviderFactoryAidl::SetUp();
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
OpenProviderHelper(SessionType::HFP_HARDWARE_OFFLOAD_DATAPATH);
// Can open or empty capability
ASSERT_TRUE(temp_provider_capabilities_.empty() ||
@@ -2419,8 +2477,12 @@
TEST_P(
BluetoothAudioProviderLeAudioOutputHardwareAidl,
StartAndEndLeAudioOutputSessionWithPossibleUnicastConfigFromProviderInfo) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
if (!IsOffloadOutputProviderInfoSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs = GetUnicastLc3SupportedListFromProviderInfo();
@@ -2444,6 +2506,10 @@
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
GetEmptyAseConfigurationEmptyCapability) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
std::vector<std::optional<LeAudioDeviceCapabilities>> empty_capability;
std::vector<LeAudioConfigurationRequirement> empty_requirement;
std::vector<LeAudioAseConfigurationSetting> configurations;
@@ -2465,6 +2531,10 @@
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
GetEmptyAseConfigurationMismatchedRequirement) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
std::vector<std::optional<LeAudioDeviceCapabilities>> capabilities = {
GetDefaultRemoteCapability()};
@@ -2489,6 +2559,10 @@
}
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl, GetQoSConfiguration) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
IBluetoothAudioProvider::LeAudioAseQosConfigurationRequirement requirement;
std::vector<IBluetoothAudioProvider::LeAudioAseQosConfiguration>
QoSConfigurations;
@@ -2548,7 +2622,7 @@
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
StartAndEndLeAudioOutputSessionWithPossibleUnicastConfig) {
if (!IsOffloadOutputSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs =
@@ -2581,7 +2655,7 @@
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
DISABLED_StartAndEndLeAudioOutputSessionWithInvalidAudioConfiguration) {
if (!IsOffloadOutputSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs =
@@ -2619,7 +2693,7 @@
TEST_P(BluetoothAudioProviderLeAudioOutputHardwareAidl,
StartAndEndLeAudioOutputSessionWithAptxAdaptiveLeUnicastConfig) {
if (!IsOffloadOutputSupported()) {
- return;
+ GTEST_SKIP();
}
for (auto codec_type :
{CodecType::APTX_ADAPTIVE_LE, CodecType::APTX_ADAPTIVE_LEX}) {
@@ -2656,7 +2730,7 @@
BluetoothAudioProviderLeAudioOutputHardwareAidl,
BluetoothAudioProviderLeAudioOutputHardwareAidl_StartAndEndLeAudioOutputSessionWithInvalidAptxAdaptiveLeAudioConfiguration) {
if (!IsOffloadOutputSupported()) {
- return;
+ GTEST_SKIP();
}
for (auto codec_type :
@@ -2742,7 +2816,7 @@
BluetoothAudioProviderLeAudioInputHardwareAidl,
StartAndEndLeAudioInputSessionWithPossibleUnicastConfigFromProviderInfo) {
if (!IsOffloadOutputProviderInfoSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs = GetUnicastLc3SupportedListFromProviderInfo();
@@ -2772,7 +2846,7 @@
TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl,
StartAndEndLeAudioInputSessionWithPossibleUnicastConfig) {
if (!IsOffloadInputSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs =
@@ -2805,7 +2879,7 @@
TEST_P(BluetoothAudioProviderLeAudioInputHardwareAidl,
DISABLED_StartAndEndLeAudioInputSessionWithInvalidAudioConfiguration) {
if (!IsOffloadInputSupported()) {
- return;
+ GTEST_SKIP();
}
auto lc3_codec_configs =
@@ -2863,16 +2937,16 @@
/**
* Test whether each provider of type
- * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started and
- * stopped
+ * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started
+ * and stopped
*/
TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
OpenLeAudioOutputSoftwareProvider) {}
/**
* Test whether each provider of type
- * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started and
- * stopped with different PCM config
+ * SessionType::LE_AUDIO_BROADCAST_SOFTWARE_ENCODING_DATAPATH can be started
+ * and stopped with different PCM config
*/
TEST_P(BluetoothAudioProviderLeAudioBroadcastSoftwareAidl,
StartAndEndLeAudioOutputSessionWithPossiblePcmConfig) {
@@ -3046,6 +3120,10 @@
TEST_P(
BluetoothAudioProviderLeAudioBroadcastHardwareAidl,
StartAndEndLeAudioBroadcastSessionWithPossibleUnicastConfigFromProviderInfo) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
if (!IsBroadcastOffloadProviderInfoSupported()) {
return;
}
@@ -3077,6 +3155,10 @@
TEST_P(BluetoothAudioProviderLeAudioBroadcastHardwareAidl,
GetEmptyBroadcastConfigurationEmptyCapability) {
+ if (GetProviderFactoryInterfaceVersion() <
+ BluetoothAudioHalVersion::VERSION_AIDL_V4) {
+ GTEST_SKIP();
+ }
std::vector<std::optional<LeAudioDeviceCapabilities>> empty_capability;
IBluetoothAudioProvider::LeAudioBroadcastConfigurationRequirement
empty_requirement;
@@ -3191,8 +3273,8 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_SOFTWARE_DECODING_DATAPATH can be started and stopped with
- * different PCM config
+ * SessionType::A2DP_SOFTWARE_DECODING_DATAPATH can be started and stopped
+ * with different PCM config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingSoftwareAidl,
StartAndEndA2dpDecodingSoftwareSessionWithPossiblePcmConfig) {
@@ -3253,13 +3335,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * SBC hardware encoding config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with SBC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpSbcDecodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -3283,13 +3365,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * AAC hardware encoding config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with AAC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpAacDecodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -3313,13 +3395,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * LDAC hardware encoding config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with LDAC hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpLdacDecodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -3343,13 +3425,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * Opus hardware encoding config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with Opus hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpOpusDecodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
CodecConfiguration codec_config = {
@@ -3373,13 +3455,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * AptX hardware encoding config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with AptX hardware encoding config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpAptxDecodingHardwareSession) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
for (auto codec_type : {CodecType::APTX, CodecType::APTX_HD}) {
@@ -3409,13 +3491,13 @@
/**
* Test whether each provider of type
- * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped with
- * an invalid codec config
+ * SessionType::A2DP_HARDWARE_DECODING_DATAPATH can be started and stopped
+ * with an invalid codec config
*/
TEST_P(BluetoothAudioProviderA2dpDecodingHardwareAidl,
StartAndEndA2dpDecodingHardwareSessionInvalidCodecConfig) {
if (!IsOffloadSupported()) {
- return;
+ GTEST_SKIP();
}
ASSERT_NE(audio_provider_, nullptr);
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
index 216e169..d37825a 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioCodecs.cpp
@@ -428,7 +428,7 @@
if (kDefaultOffloadLeAudioCodecInfoMap.empty()) {
auto le_audio_offload_setting =
BluetoothLeAudioCodecsProvider::ParseFromLeAudioOffloadSettingFile();
- auto kDefaultOffloadLeAudioCodecInfoMap =
+ kDefaultOffloadLeAudioCodecInfoMap =
BluetoothLeAudioCodecsProvider::GetLeAudioCodecInfo(
le_audio_offload_setting);
}
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp
index b6df67e..473777c 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothLeAudioCodecsProvider.cpp
@@ -43,9 +43,6 @@
std::optional<setting::LeAudioOffloadSetting>
BluetoothLeAudioCodecsProvider::ParseFromLeAudioOffloadSettingFile() {
- if (!leAudioCodecCapabilities.empty() || isInvalidFileContent) {
- return std::nullopt;
- }
auto le_audio_offload_setting =
setting::readLeAudioOffloadSetting(kLeAudioCodecCapabilitiesFile);
if (!le_audio_offload_setting.has_value()) {
@@ -77,8 +74,6 @@
for (auto& p : configuration_map_) {
// Initialize new CodecInfo for the config
auto config_name = p.first;
- if (config_codec_info_map_.count(config_name) == 0)
- config_codec_info_map_[config_name] = CodecInfo();
// Getting informations from codecConfig and strategyConfig
const auto codec_config_name = p.second.getCodecConfiguration();
@@ -92,6 +87,9 @@
if (strategy_configuration_map_iter == strategy_configuration_map_.end())
continue;
+ if (config_codec_info_map_.count(config_name) == 0)
+ config_codec_info_map_[config_name] = CodecInfo();
+
const auto& codec_config = codec_configuration_map_iter->second;
const auto codec = codec_config.getCodec();
const auto& strategy_config = strategy_configuration_map_iter->second;
@@ -137,12 +135,19 @@
}
}
- // Goes through every scenario, deduplicate configuration
+ // Goes through every scenario, deduplicate configuration, skip the invalid
+ // config references (e.g. the "invalid" entries in the xml file).
std::set<std::string> encoding_config, decoding_config, broadcast_config;
for (auto& s : supported_scenarios_) {
- if (s.hasEncode()) encoding_config.insert(s.getEncode());
- if (s.hasDecode()) decoding_config.insert(s.getDecode());
- if (s.hasBroadcast()) broadcast_config.insert(s.getBroadcast());
+ if (s.hasEncode() && config_codec_info_map_.count(s.getEncode())) {
+ encoding_config.insert(s.getEncode());
+ }
+ if (s.hasDecode() && config_codec_info_map_.count(s.getDecode())) {
+ decoding_config.insert(s.getDecode());
+ }
+ if (s.hasBroadcast() && config_codec_info_map_.count(s.getBroadcast())) {
+ broadcast_config.insert(s.getBroadcast());
+ }
}
// Split by session types and add results
diff --git a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
index ddaba72..172ac5e 100644
--- a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
+++ b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
@@ -34,13 +34,13 @@
package android.hardware.bluetooth.ranging;
@VintfStability
parcelable ChannelSoundingSingleSideData {
- @nullable List<android.hardware.bluetooth.ranging.StepTonePct> stepTonePcts;
+ @nullable android.hardware.bluetooth.ranging.StepTonePct[] stepTonePcts;
@nullable byte[] packetQuality;
@nullable byte[] packetRssiDbm;
@nullable android.hardware.bluetooth.ranging.Nadm[] packetNadm;
@nullable int[] measuredFreqOffset;
- @nullable List<android.hardware.bluetooth.ranging.ComplexNumber> packetPct1;
- @nullable List<android.hardware.bluetooth.ranging.ComplexNumber> packetPct2;
+ @nullable android.hardware.bluetooth.ranging.ComplexNumber[] packetPct1;
+ @nullable android.hardware.bluetooth.ranging.ComplexNumber[] packetPct2;
byte referencePowerDbm;
@nullable byte[] vendorSpecificCsSingleSidedata;
}
diff --git a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ModeType.aidl b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ModeType.aidl
index 75cdabc..1e8ae91 100644
--- a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ModeType.aidl
+++ b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/ModeType.aidl
@@ -32,7 +32,7 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.ranging;
-@Backing(type="int") @VintfStability
+@Backing(type="byte") @VintfStability
enum ModeType {
ZERO = 0x00,
ONE = 0x01,
diff --git a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/SubModeType.aidl b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/SubModeType.aidl
index f660c91..b72a97d 100644
--- a/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/SubModeType.aidl
+++ b/bluetooth/ranging/aidl/aidl_api/android.hardware.bluetooth.ranging/current/android/hardware/bluetooth/ranging/SubModeType.aidl
@@ -32,10 +32,10 @@
// later when a module using the interface is updated, e.g., Mainline modules.
package android.hardware.bluetooth.ranging;
-@Backing(type="int") @VintfStability
+@Backing(type="byte") @VintfStability
enum SubModeType {
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
- UNUSED = 0xff,
+ UNUSED = 0xffu8,
}
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/AddressType.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/AddressType.aidl
index bd03213..499d42f 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/AddressType.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/AddressType.aidl
@@ -16,9 +16,13 @@
package android.hardware.bluetooth.ranging;
+/**
+ * Same as the BLE address type, except anonymous isn't supported for ranging.
+ */
@VintfStability
@Backing(type="int")
enum AddressType {
PUBLIC = 0x00,
+ /* Still may be fixed on the device and is not randomized on boot */
RANDOM = 0x01,
}
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoudingRawData.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoudingRawData.aidl
index 0106865..78ce4f4 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoudingRawData.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoudingRawData.aidl
@@ -21,6 +21,9 @@
/**
* Raw ranging data of Channel Sounding.
+ * See Channel Sounding CR_PR 3.1.10 and Channel Sounding HCI Updates CR_PR 3.1.23 for details.
+ *
+ * Specification: https://www.bluetooth.com/specifications/specs/channel-sounding-cr-pr/
*/
@VintfStability
parcelable ChannelSoudingRawData {
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
index 942fc0d..9c4b472 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ChannelSoundingSingleSideData.aidl
@@ -21,14 +21,17 @@
import android.hardware.bluetooth.ranging.StepTonePct;
/**
- * Raw ranging data of Channel Sounding from either Initator or Reflector
+ * Raw ranging data of Channel Sounding from either Initator or Reflector.
+ * See Channel Sounding CR_PR 3.1.10 and Channel Sounding HCI Updates CR_PR 3.1.23 for details.
+ *
+ * Specification: https://www.bluetooth.com/specifications/specs/channel-sounding-cr-pr/
*/
@VintfStability
parcelable ChannelSoundingSingleSideData {
/**
* PCT (complex value) measured from mode-2 or mode-3 steps in a CS procedure (in time order).
*/
- @nullable List<StepTonePct> stepTonePcts;
+ @nullable StepTonePct[] stepTonePcts;
/**
* Packet Quality from mode-1 or mode-3 steps in a CS procedures (in time order).
*/
@@ -49,8 +52,8 @@
* Packet_PCT1 or packet_PCT2 of mode-1 or mode-3, if sounding sequence is used and sounding
* phase-based ranging is supported.
*/
- @nullable List<ComplexNumber> packetPct1;
- @nullable List<ComplexNumber> packetPct2;
+ @nullable ComplexNumber[] packetPct1;
+ @nullable ComplexNumber[] packetPct2;
/**
* Reference power level (-127 to 20) of the signal in the procedure, in dBm.
*/
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ModeType.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ModeType.aidl
index 2058ae8..3a727aa 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ModeType.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/ModeType.aidl
@@ -17,7 +17,7 @@
package android.hardware.bluetooth.ranging;
@VintfStability
-@Backing(type="int")
+@Backing(type="byte")
enum ModeType {
ZERO = 0x00,
ONE = 0x01,
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/Nadm.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/Nadm.aidl
index 3cfb22f..74cf731 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/Nadm.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/Nadm.aidl
@@ -16,6 +16,12 @@
package android.hardware.bluetooth.ranging;
+/**
+ * Normalized Attack Detector Metric.
+ * See Channel Sounding CR_PR, 3.13.24 for details.
+ *
+ * Specification: https://www.bluetooth.com/specifications/specs/channel-sounding-cr-pr/
+ */
@VintfStability
@Backing(type="byte")
enum Nadm {
@@ -26,5 +32,7 @@
ATTACK_IS_LIKELY = 0x04,
ATTACK_IS_VERY_LIKELY = 0x05,
ATTACK_IS_EXTREMELY_LIKELY = 0x06,
+ /* If a device is unable to determine a NADM value, then it shall report a NADM value of Unknown
+ */
UNKNOWN = 0xFFu8,
}
diff --git a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/SubModeType.aidl b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/SubModeType.aidl
index ca9bfcb..b775002 100644
--- a/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/SubModeType.aidl
+++ b/bluetooth/ranging/aidl/android/hardware/bluetooth/ranging/SubModeType.aidl
@@ -17,10 +17,10 @@
package android.hardware.bluetooth.ranging;
@VintfStability
-@Backing(type="int")
+@Backing(type="byte")
enum SubModeType {
ONE = 0x01,
TWO = 0x02,
THREE = 0x03,
- UNUSED = 0xff,
+ UNUSED = 0xffu8,
}
diff --git a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
index cac3dd0..dec1f17 100644
--- a/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
+++ b/broadcastradio/1.0/vts/functional/VtsHalBroadcastradioV1_0TargetTest.cpp
@@ -52,10 +52,9 @@
using ::android::hardware::broadcastradio::V1_0::Result;
using ::android::hardware::broadcastradio::V1_0::vts::RadioClassFromString;
-#define RETURN_IF_SKIPPED \
- if (skipped) { \
- std::cout << "[ SKIPPED ] This device class is not supported. " << std::endl; \
- return; \
+#define RETURN_IF_SKIPPED \
+ if (skipped) { \
+ GTEST_SKIP() << "This device class is not supported."; \
}
// The main test class for Broadcast Radio HIDL HAL.
@@ -734,4 +733,4 @@
testing::Combine(testing::ValuesIn(android::hardware::getAllHalInstanceNames(
IBroadcastRadioFactory::descriptor)),
::testing::Values("AM_FM", "SAT", "DT")),
- android::hardware::PrintInstanceTupleNameToString<>);
\ No newline at end of file
+ android::hardware::PrintInstanceTupleNameToString<>);
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index caf6cbd..b54e9d8 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -73,10 +73,6 @@
ProgramType::AM, ProgramType::FM, ProgramType::AM_HD, ProgramType::FM_HD,
ProgramType::DAB, ProgramType::DRMO, ProgramType::SXM};
-static void printSkipped(std::string msg) {
- std::cout << "[ SKIPPED ] " << msg << std::endl;
-}
-
struct TunerCallbackMock : public ITunerCallback {
TunerCallbackMock() { EXPECT_CALL(*this, hardwareFailure()).Times(0); }
@@ -106,7 +102,6 @@
bool getProgramList(std::function<void(const hidl_vec<ProgramInfo>& list)> cb);
Class radioClass;
- bool skipped = false;
sp<IBroadcastRadio> mRadioModule;
sp<ITuner> mTuner;
@@ -137,9 +132,7 @@
ASSERT_TRUE(onConnect.waitForCall(kConnectModuleTimeout));
if (connectResult == Result::INVALID_ARGUMENTS) {
- printSkipped("This device class is not supported.");
- skipped = true;
- return;
+ GTEST_SKIP() << "This device class is not supported.";
}
ASSERT_EQ(connectResult, Result::OK);
ASSERT_NE(nullptr, mRadioModule.get());
@@ -285,8 +278,6 @@
* might fail.
*/
TEST_P(BroadcastRadioHalTest, OpenTunerTwice) {
- if (skipped) return;
-
ASSERT_TRUE(openTuner());
auto secondTuner = mTuner;
@@ -306,7 +297,6 @@
* - getProgramInformation_1_1 returns the same selector as returned in tuneComplete_1_1 call.
*/
TEST_P(BroadcastRadioHalTest, TuneFromProgramList) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
ProgramInfo firstProgram;
@@ -320,8 +310,7 @@
} while (nextBand());
if (HasFailure()) return;
if (!foundAny) {
- printSkipped("Program list is empty.");
- return;
+ GTEST_SKIP() << "Program list is empty.";
}
ProgramInfo infoCb;
@@ -356,7 +345,6 @@
* identifier for program types other than VENDORn.
*/
TEST_P(BroadcastRadioHalTest, TuneFailsForPrimaryVendor) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
for (auto ptype : kStandardProgramTypes) {
@@ -377,7 +365,6 @@
* - tuneByProgramSelector fails with INVALID_ARGUMENT when unknown program type is passed.
*/
TEST_P(BroadcastRadioHalTest, TuneFailsForUnknownProgram) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
// Program type is 1-based, so 0 will be always invalid.
@@ -393,7 +380,6 @@
* - cancelAnnouncement succeeds either when there is an announcement or there is none.
*/
TEST_P(BroadcastRadioHalTest, CancelAnnouncement) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
auto hidlResult = mTuner->cancelAnnouncement();
@@ -407,8 +393,6 @@
* - getImage call handles argument 0 gracefully.
*/
TEST_P(BroadcastRadioHalTest, GetNoImage) {
- if (skipped) return;
-
size_t len = 0;
auto hidlResult =
mRadioModule->getImage(0, [&](hidl_vec<uint8_t> rawImage) { len = rawImage.size(); });
@@ -425,7 +409,6 @@
* - images are available for getImage call.
*/
TEST_P(BroadcastRadioHalTest, OobImagesOnly) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
std::vector<int> imageIds;
@@ -446,8 +429,7 @@
} while (nextBand());
if (imageIds.size() == 0) {
- printSkipped("No images found");
- return;
+ GTEST_SKIP() << "No images found";
}
for (auto id : imageIds) {
@@ -469,7 +451,6 @@
* - setAnalogForced results either with INVALID_STATE, or isAnalogForced replying the same.
*/
TEST_P(BroadcastRadioHalTest, AnalogForcedSwitch) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
bool forced;
@@ -584,7 +565,6 @@
* - values of ProgramIdentifier match their definitions at IdentifierType.
*/
TEST_P(BroadcastRadioHalTest, VerifyIdentifiersFormat) {
- if (skipped) return;
ASSERT_TRUE(openTuner());
do {
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index 9bee3b9..eefca39 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -84,10 +84,10 @@
}
vintf_compatibility_matrix {
- name: "framework_compatibility_matrix.9.xml",
- stem: "compatibility_matrix.9.xml",
+ name: "framework_compatibility_matrix.202404.xml",
+ stem: "compatibility_matrix.202404.xml",
srcs: [
- "compatibility_matrix.9.xml",
+ "compatibility_matrix.202404.xml",
],
kernel_configs: [
"kernel_config_v_6.1",
diff --git a/compatibility_matrices/Android.mk b/compatibility_matrices/Android.mk
index c2ffb84..72ead58 100644
--- a/compatibility_matrices/Android.mk
+++ b/compatibility_matrices/Android.mk
@@ -112,7 +112,7 @@
# interfaces (in the `next` release configuration).
ifeq ($(RELEASE_AIDL_USE_UNFROZEN),true)
my_system_matrix_deps += \
- framework_compatibility_matrix.9.xml
+ framework_compatibility_matrix.202404.xml
endif
my_framework_matrix_deps += \
diff --git a/compatibility_matrices/compatibility_matrix.9.xml b/compatibility_matrices/compatibility_matrix.202404.xml
similarity index 99%
rename from compatibility_matrices/compatibility_matrix.9.xml
rename to compatibility_matrices/compatibility_matrix.202404.xml
index a7f0845..4498f90 100644
--- a/compatibility_matrices/compatibility_matrix.9.xml
+++ b/compatibility_matrices/compatibility_matrix.202404.xml
@@ -1,4 +1,4 @@
-<compatibility-matrix version="1.0" type="framework" level="9">
+<compatibility-matrix version="1.0" type="framework" level="202404">
<hal format="aidl" optional="true">
<name>android.hardware.audio.core</name>
<version>1-2</version>
diff --git a/compatibility_matrices/compatibility_matrix.4.xml b/compatibility_matrices/compatibility_matrix.4.xml
index bb7637a..952f53d 100644
--- a/compatibility_matrices/compatibility_matrix.4.xml
+++ b/compatibility_matrices/compatibility_matrix.4.xml
@@ -1,5 +1,5 @@
<compatibility-matrix version="1.0" type="framework" level="4">
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.atrace</name>
<version>1.0</version>
<interface>
@@ -7,7 +7,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio</name>
<version>5.0</version>
<interface>
@@ -15,7 +15,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<version>5.0</version>
<interface>
@@ -23,7 +23,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.authsecret</name>
<version>1.0</version>
<interface>
@@ -31,7 +31,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.audiocontrol</name>
<version>1.0</version>
<interface>
@@ -39,7 +39,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.evs</name>
<version>1.0</version>
<interface>
@@ -47,7 +47,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.vehicle</name>
<version>2.0</version>
<interface>
@@ -55,7 +55,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.face</name>
<version>1.0</version>
<interface>
@@ -63,7 +63,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2.1</version>
<interface>
@@ -71,7 +71,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth</name>
<version>1.0</version>
<interface>
@@ -79,7 +79,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth.audio</name>
<version>2.0</version>
<interface>
@@ -87,7 +87,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.boot</name>
<version>1.0</version>
<interface>
@@ -95,7 +95,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>1.0-1</version>
<interface>
@@ -103,7 +103,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>2.0</version>
<interface>
@@ -111,7 +111,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.camera.provider</name>
<version>2.4-5</version>
<interface>
@@ -119,7 +119,7 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.cas</name>
<version>1.1</version>
<interface>
@@ -127,7 +127,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.configstore</name>
<version>1.1</version>
<interface>
@@ -135,7 +135,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.confirmationui</name>
<version>1.0</version>
<interface>
@@ -143,7 +143,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.contexthub</name>
<version>1.0</version>
<interface>
@@ -151,7 +151,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.drm</name>
<version>1.0-2</version>
<interface>
@@ -163,7 +163,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.dumpstate</name>
<version>1.0</version>
<interface>
@@ -171,7 +171,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
@@ -179,7 +179,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gnss</name>
<version>2.0</version>
<interface>
@@ -190,7 +190,7 @@
<!-- Either the AIDL or the HIDL allocator HAL must exist on the device.
If the HIDL composer HAL exists, it must be at least version 2.0.
See DeviceManifestTest.GrallocHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<version>2.0</version>
<version>3.0</version>
@@ -199,7 +199,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.composer</name>
<version>2.1-3</version>
<interface>
@@ -207,7 +207,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<version>2.1</version>
<version>3.0</version>
@@ -219,7 +219,7 @@
<!-- Either the AIDL or the HIDL health HAL must exist on the device.
If the HIDL health HAL exists, it must be at least version 2.0.
See DeviceManifestTest.HealthHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.health</name>
<version>2.0</version>
<interface>
@@ -227,7 +227,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.health.storage</name>
<version>1.0</version>
<interface>
@@ -235,7 +235,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.ir</name>
<version>1.0</version>
<interface>
@@ -243,7 +243,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.input.classifier</name>
<version>1.0</version>
<interface>
@@ -251,7 +251,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>3.0</version>
<version>4.0</version>
@@ -260,7 +260,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>4.0</version>
<interface>
@@ -268,7 +268,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.light</name>
<version>2.0</version>
<interface>
@@ -276,7 +276,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0</version>
<interface>
@@ -291,7 +291,7 @@
<instance>software</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.omx</name>
<version>1.0</version>
<interface>
@@ -303,7 +303,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.memtrack</name>
<version>1.0</version>
<interface>
@@ -311,7 +311,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.neuralnetworks</name>
<version>1.0-2</version>
<interface>
@@ -319,7 +319,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.nfc</name>
<version>1.2</version>
<interface>
@@ -327,7 +327,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.oemlock</name>
<version>1.0</version>
<interface>
@@ -335,7 +335,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.power</name>
<version>1.0-3</version>
<interface>
@@ -343,7 +343,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.power.stats</name>
<version>1.0</version>
<interface>
@@ -351,7 +351,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.4</version>
<interface>
@@ -361,7 +361,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.2</version>
<interface>
@@ -370,7 +370,7 @@
<instance>slot2</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio.config</name>
<!--
Note: Devices launching with target-level 4, if implementing the
@@ -384,7 +384,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.renderscript</name>
<version>1.0</version>
<interface>
@@ -392,7 +392,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.secure_element</name>
<version>1.0</version>
<interface>
@@ -401,7 +401,7 @@
<regex-instance>SIM[1-9][0-9]*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.sensors</name>
<version>1.0</version>
<version>2.0</version>
@@ -410,7 +410,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.soundtrigger</name>
<version>2.0-2</version>
<interface>
@@ -418,7 +418,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<version>1.0</version>
<interface>
@@ -426,7 +426,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<version>1.0</version>
<interface>
@@ -434,7 +434,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.thermal</name>
<version>2.0</version>
<interface>
@@ -442,7 +442,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.cec</name>
<version>1.0</version>
<interface>
@@ -450,7 +450,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.input</name>
<version>1.0</version>
<interface>
@@ -458,7 +458,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb</name>
<version>1.0-2</version>
<interface>
@@ -466,7 +466,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb.gadget</name>
<version>1.0</version>
<interface>
@@ -474,7 +474,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.vibrator</name>
<version>1.0-3</version>
<interface>
@@ -482,7 +482,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.vr</name>
<version>1.0</version>
<interface>
@@ -490,7 +490,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.weaver</name>
<version>1.0</version>
<interface>
@@ -498,7 +498,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi</name>
<version>1.0-3</version>
<interface>
@@ -506,7 +506,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.hostapd</name>
<version>1.0-1</version>
<interface>
@@ -514,7 +514,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.supplicant</name>
<version>1.0-2</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.5.xml b/compatibility_matrices/compatibility_matrix.5.xml
index dad1558..1cf98b0 100644
--- a/compatibility_matrices/compatibility_matrix.5.xml
+++ b/compatibility_matrices/compatibility_matrix.5.xml
@@ -1,5 +1,5 @@
<compatibility-matrix version="1.0" type="framework" level="5">
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.atrace</name>
<version>1.0</version>
<interface>
@@ -7,7 +7,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio</name>
<version>6.0</version>
<interface>
@@ -15,7 +15,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<version>6.0</version>
<interface>
@@ -23,7 +23,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.authsecret</name>
<version>1.0</version>
<interface>
@@ -31,7 +31,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.audiocontrol</name>
<version>1.0</version>
<version>2.0</version>
@@ -40,7 +40,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.can</name>
<version>1.0</version>
<interface>
@@ -52,7 +52,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.evs</name>
<version>1.0-1</version>
<interface>
@@ -61,14 +61,14 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.occupant_awareness</name>
<interface>
<name>IOccupantAwareness</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.sv</name>
<version>1.0</version>
<interface>
@@ -76,7 +76,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.vehicle</name>
<version>2.0</version>
<interface>
@@ -84,7 +84,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.face</name>
<version>1.0</version>
<interface>
@@ -92,7 +92,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2.1-2</version>
<interface>
@@ -100,7 +100,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth</name>
<version>1.0-1</version>
<interface>
@@ -108,7 +108,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth.audio</name>
<version>2.0</version>
<interface>
@@ -116,7 +116,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.boot</name>
<version>1.1</version>
<interface>
@@ -124,7 +124,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>1.0-1</version>
<interface>
@@ -132,7 +132,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>2.0</version>
<interface>
@@ -140,7 +140,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.camera.provider</name>
<version>2.4-6</version>
<interface>
@@ -148,7 +148,7 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.cas</name>
<version>1.1-2</version>
<interface>
@@ -156,7 +156,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.confirmationui</name>
<version>1.0</version>
<interface>
@@ -164,7 +164,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.contexthub</name>
<version>1.0-1</version>
<interface>
@@ -172,7 +172,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.drm</name>
<version>1.3</version>
<interface>
@@ -184,7 +184,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.dumpstate</name>
<version>1.1</version>
<interface>
@@ -192,7 +192,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
@@ -200,7 +200,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gnss</name>
<version>2.0-1</version>
<interface>
@@ -211,7 +211,7 @@
<!-- Either the AIDL or the HIDL allocator HAL must exist on the device.
If the HIDL composer HAL exists, it must be at least version 2.0.
See DeviceManifestTest.GrallocHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.0</version>
@@ -222,7 +222,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.composer</name>
<version>2.1-4</version>
<interface>
@@ -230,7 +230,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.1</version>
@@ -244,7 +244,7 @@
<!-- Either the AIDL or the HIDL health HAL must exist on the device.
If the HIDL health HAL exists, it must be at least version 2.1.
See DeviceManifestTest.HealthHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.health</name>
<version>2.1</version>
<interface>
@@ -252,7 +252,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.health.storage</name>
<version>1.0</version>
<interface>
@@ -260,7 +260,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.identity</name>
<!--
b/178458001: identity V2 is introduced in R, but Android R VINTF does not support AIDL
@@ -274,7 +274,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.ir</name>
<version>1.0</version>
<interface>
@@ -282,7 +282,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.input.classifier</name>
<version>1.0</version>
<interface>
@@ -290,7 +290,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>3.0</version>
<version>4.0-1</version>
@@ -299,7 +299,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>4.0-1</version>
<interface>
@@ -307,14 +307,14 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.light</name>
<interface>
<name>ILights</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0-1</version>
<interface>
@@ -324,7 +324,7 @@
<regex-instance>vendor[0-9]*_software</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0</version>
<interface>
@@ -333,7 +333,7 @@
<instance>software</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.omx</name>
<version>1.0</version>
<interface>
@@ -345,7 +345,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.memtrack</name>
<version>1.0</version>
<interface>
@@ -353,7 +353,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.neuralnetworks</name>
<version>1.0-3</version>
<interface>
@@ -361,7 +361,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.nfc</name>
<version>1.2</version>
<interface>
@@ -369,7 +369,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.oemlock</name>
<version>1.0</version>
<interface>
@@ -377,14 +377,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power</name>
<interface>
<name>IPower</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.power.stats</name>
<version>1.0</version>
<interface>
@@ -392,7 +392,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.4</version>
<version>1.5</version>
@@ -403,7 +403,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.2</version>
<interface>
@@ -412,7 +412,7 @@
<instance>slot2</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio.config</name>
<!--
See compatibility_matrix.4.xml on versioning of radio config HAL.
@@ -423,7 +423,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.renderscript</name>
<version>1.0</version>
<interface>
@@ -431,14 +431,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.rebootescrow</name>
<interface>
<name>IRebootEscrow</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.secure_element</name>
<version>1.0-2</version>
<interface>
@@ -447,7 +447,7 @@
<regex-instance>SIM[1-9][0-9]*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.sensors</name>
<version>1.0</version>
<version>2.0-1</version>
@@ -456,7 +456,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.soundtrigger</name>
<version>2.0-3</version>
<interface>
@@ -464,7 +464,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<version>1.0</version>
<interface>
@@ -472,7 +472,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<version>1.0</version>
<interface>
@@ -480,7 +480,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.thermal</name>
<version>2.0</version>
<interface>
@@ -488,7 +488,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.cec</name>
<version>1.0</version>
<interface>
@@ -496,7 +496,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.input</name>
<version>1.0</version>
<interface>
@@ -504,7 +504,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.tuner</name>
<version>1.0</version>
<interface>
@@ -512,7 +512,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb</name>
<version>1.0-2</version>
<interface>
@@ -520,7 +520,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb.gadget</name>
<version>1.0-1</version>
<interface>
@@ -528,14 +528,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<interface>
<name>IVibrator</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.vr</name>
<version>1.0</version>
<interface>
@@ -543,7 +543,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.weaver</name>
<version>1.0</version>
<interface>
@@ -551,7 +551,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi</name>
<version>1.0-4</version>
<interface>
@@ -559,7 +559,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.hostapd</name>
<version>1.0-2</version>
<interface>
@@ -567,7 +567,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.supplicant</name>
<version>1.0-3</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.6.xml b/compatibility_matrices/compatibility_matrix.6.xml
index 23f634d..fdd7952 100644
--- a/compatibility_matrices/compatibility_matrix.6.xml
+++ b/compatibility_matrices/compatibility_matrix.6.xml
@@ -1,5 +1,5 @@
<compatibility-matrix version="1.0" type="framework" level="6">
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.atrace</name>
<version>1.0</version>
<interface>
@@ -7,7 +7,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio</name>
<version>6.0</version>
<version>7.0</version>
@@ -16,7 +16,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<version>6.0</version>
<version>7.0</version>
@@ -25,7 +25,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.authsecret</name>
<version>1</version>
<interface>
@@ -33,7 +33,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.authsecret</name>
<version>1.0</version>
<interface>
@@ -41,14 +41,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.audiocontrol</name>
<interface>
<name>IAudioControl</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.can</name>
<version>1.0</version>
<interface>
@@ -60,7 +60,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.evs</name>
<version>1.0-1</version>
<interface>
@@ -69,7 +69,7 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.occupant_awareness</name>
<version>1</version>
<interface>
@@ -77,7 +77,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.sv</name>
<version>1.0</version>
<interface>
@@ -85,7 +85,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.vehicle</name>
<version>2.0</version>
<interface>
@@ -93,7 +93,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.face</name>
<version>1.0</version>
<interface>
@@ -101,14 +101,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.biometrics.face</name>
<interface>
<name>IFace</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2.1-3</version>
<interface>
@@ -116,14 +116,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<interface>
<name>IFingerprint</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth</name>
<version>1.0-1</version>
<interface>
@@ -131,7 +131,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth.audio</name>
<version>2.0-1</version>
<interface>
@@ -139,7 +139,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.boot</name>
<version>1.2</version>
<interface>
@@ -147,7 +147,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>1.0-1</version>
<interface>
@@ -155,7 +155,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>2.0</version>
<interface>
@@ -163,7 +163,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.camera.provider</name>
<version>2.4-7</version>
<interface>
@@ -171,7 +171,7 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.cas</name>
<version>1.1-2</version>
<interface>
@@ -179,7 +179,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.confirmationui</name>
<version>1.0</version>
<interface>
@@ -187,7 +187,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.contexthub</name>
<version>1.2</version>
<interface>
@@ -195,7 +195,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.drm</name>
<version>1.3-4</version>
<interface>
@@ -207,7 +207,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.dumpstate</name>
<version>1.1</version>
<interface>
@@ -215,7 +215,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
@@ -223,7 +223,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gnss</name>
<version>2.0-1</version>
<interface>
@@ -231,7 +231,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.gnss</name>
<interface>
<name>IGnss</name>
@@ -241,7 +241,7 @@
<!-- Either the AIDL or the HIDL allocator HAL must exist on the device.
If the HIDL composer HAL exists, it must be at least version 2.0.
See DeviceManifestTest.GrallocHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.0</version>
@@ -252,7 +252,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.composer</name>
<version>2.1-4</version>
<interface>
@@ -260,7 +260,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.1</version>
@@ -274,7 +274,7 @@
<!-- Either the AIDL or the HIDL health HAL must exist on the device.
If the HIDL health HAL exists, it must be at least version 2.1.
See DeviceManifestTest.HealthHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.health</name>
<version>2.1</version>
<interface>
@@ -282,7 +282,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.health.storage</name>
<version>1</version>
<interface>
@@ -290,7 +290,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.identity</name>
<version>1-3</version>
<interface>
@@ -298,7 +298,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.oemlock</name>
<version>1</version>
<interface>
@@ -306,7 +306,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.ir</name>
<version>1.0</version>
<interface>
@@ -314,7 +314,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.input.classifier</name>
<version>1.0</version>
<interface>
@@ -322,7 +322,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>3.0</version>
<version>4.0-1</version>
@@ -331,7 +331,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>4.0-1</version>
<interface>
@@ -339,7 +339,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.keymint</name>
<version>1</version>
<interface>
@@ -348,14 +348,14 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.keymint</name>
<interface>
<name>IRemotelyProvisionedComponent</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.light</name>
<version>1</version>
<interface>
@@ -363,7 +363,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0-2</version>
<interface>
@@ -373,7 +373,7 @@
<regex-instance>vendor[0-9]*_software</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0</version>
<interface>
@@ -382,7 +382,7 @@
<instance>software</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.omx</name>
<version>1.0</version>
<interface>
@@ -394,7 +394,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.memtrack</name>
<version>1</version>
<interface>
@@ -402,7 +402,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.neuralnetworks</name>
<version>1.0-3</version>
<interface>
@@ -410,14 +410,14 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.neuralnetworks</name>
<interface>
<name>IDevice</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.nfc</name>
<version>1.2</version>
<interface>
@@ -425,7 +425,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.oemlock</name>
<version>1.0</version>
<interface>
@@ -433,7 +433,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power</name>
<version>1-2</version>
<interface>
@@ -441,14 +441,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power.stats</name>
<interface>
<name>IPowerStats</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.6</version>
<interface>
@@ -458,7 +458,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.2</version>
<interface>
@@ -467,7 +467,7 @@
<instance>slot2</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio.config</name>
<!--
See compatibility_matrix.4.xml on versioning of radio config HAL.
@@ -478,7 +478,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio.config</name>
<version>1.3</version>
<interface>
@@ -486,7 +486,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.renderscript</name>
<version>1.0</version>
<interface>
@@ -494,7 +494,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.rebootescrow</name>
<version>1</version>
<interface>
@@ -502,7 +502,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.secure_element</name>
<version>1.0-2</version>
<interface>
@@ -511,7 +511,7 @@
<regex-instance>SIM[1-9][0-9]*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.secureclock</name>
<version>1</version>
<interface>
@@ -519,7 +519,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.sharedsecret</name>
<version>1</version>
<interface>
@@ -528,7 +528,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.sensors</name>
<version>1.0</version>
<version>2.0-1</version>
@@ -537,7 +537,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.soundtrigger</name>
<version>2.3</version>
<interface>
@@ -545,7 +545,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<version>1.0</version>
<interface>
@@ -553,7 +553,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<version>1.1</version>
<interface>
@@ -561,7 +561,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.thermal</name>
<version>2.0</version>
<interface>
@@ -569,7 +569,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.cec</name>
<version>1.0-1</version>
<interface>
@@ -577,7 +577,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.input</name>
<version>1.0</version>
<interface>
@@ -585,7 +585,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.tuner</name>
<version>1.0-1</version>
<interface>
@@ -593,7 +593,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb</name>
<version>1.0-3</version>
<interface>
@@ -601,7 +601,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb.gadget</name>
<version>1.0-2</version>
<interface>
@@ -609,7 +609,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -617,7 +617,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -625,7 +625,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.weaver</name>
<version>1.0</version>
<interface>
@@ -633,7 +633,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.weaver</name>
<version>1</version>
<interface>
@@ -641,7 +641,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi</name>
<version>1.3-5</version>
<interface>
@@ -649,7 +649,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.hostapd</name>
<version>1.0-3</version>
<interface>
@@ -657,7 +657,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi.supplicant</name>
<version>1.2-4</version>
<interface>
diff --git a/compatibility_matrices/compatibility_matrix.7.xml b/compatibility_matrices/compatibility_matrix.7.xml
index fe424bd..8dcc4ae 100644
--- a/compatibility_matrices/compatibility_matrix.7.xml
+++ b/compatibility_matrices/compatibility_matrix.7.xml
@@ -1,5 +1,5 @@
<compatibility-matrix version="1.0" type="framework" level="7">
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.atrace</name>
<version>1.0</version>
<interface>
@@ -7,7 +7,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio</name>
<version>6.0</version>
<version>7.0-1</version>
@@ -16,7 +16,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<version>6.0</version>
<version>7.0</version>
@@ -25,7 +25,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.authsecret</name>
<version>1</version>
<interface>
@@ -33,7 +33,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.authsecret</name>
<version>1.0</version>
<interface>
@@ -41,7 +41,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.audiocontrol</name>
<version>1-2</version>
<interface>
@@ -49,7 +49,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.can</name>
<version>1.0</version>
<interface>
@@ -61,7 +61,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.evs</name>
<interface>
<name>IEvsEnumerator</name>
@@ -69,7 +69,7 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.evs</name>
<version>1.0-1</version>
<interface>
@@ -78,7 +78,7 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.occupant_awareness</name>
<version>1</version>
<interface>
@@ -86,14 +86,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.vehicle</name>
<interface>
<name>IVehicle</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.automotive.vehicle</name>
<version>2.0</version>
<interface>
@@ -101,7 +101,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.face</name>
<version>1.0</version>
<interface>
@@ -109,7 +109,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.biometrics.face</name>
<version>2</version>
<interface>
@@ -117,7 +117,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2.1-3</version>
<interface>
@@ -125,7 +125,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>2</version>
<interface>
@@ -133,7 +133,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth</name>
<version>1.0-1</version>
<interface>
@@ -141,7 +141,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.bluetooth.audio</name>
<version>2</version>
<interface>
@@ -149,7 +149,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.boot</name>
<version>1.2</version>
<interface>
@@ -157,7 +157,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>1.0-1</version>
<interface>
@@ -165,7 +165,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.broadcastradio</name>
<version>2.0</version>
<interface>
@@ -173,7 +173,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.camera.provider</name>
<version>2.4-7</version>
<interface>
@@ -181,7 +181,7 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.camera.provider</name>
<version>1</version>
<interface>
@@ -189,7 +189,7 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.cas</name>
<version>1.1-2</version>
<interface>
@@ -197,7 +197,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.confirmationui</name>
<version>1.0</version>
<interface>
@@ -205,14 +205,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.contexthub</name>
<interface>
<name>IContextHub</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.drm</name>
<version>1</version>
<interface>
@@ -220,7 +220,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.drm</name>
<version>1.3-4</version>
<interface>
@@ -232,14 +232,14 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.dumpstate</name>
<interface>
<name>IDumpstateDevice</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gatekeeper</name>
<version>1.0</version>
<interface>
@@ -247,7 +247,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.gnss</name>
<version>2.0-1</version>
<interface>
@@ -255,7 +255,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.gnss</name>
<version>2</version>
<interface>
@@ -263,7 +263,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.allocator</name>
<!-- New, non-Go devices should use 4.0 or the AIDL hal. -->
<version>2.0</version>
@@ -274,7 +274,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.graphics.allocator</name>
<version>1</version>
<interface>
@@ -285,7 +285,7 @@
<!-- Either the AIDL or the HIDL composer HAL must exist on the device.
If the HIDL composer HAL exists, it must be at least version 2.1.
See DeviceManifestTest.ComposerHal -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.composer</name>
<version>2.1-4</version>
<interface>
@@ -293,7 +293,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.graphics.composer3</name>
<version>1</version>
<interface>
@@ -301,7 +301,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.1</version>
@@ -312,7 +312,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.health</name>
<version>1</version>
<interface>
@@ -320,7 +320,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.health.storage</name>
<version>1</version>
<interface>
@@ -328,7 +328,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.identity</name>
<version>1-4</version>
<interface>
@@ -336,14 +336,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.net.nlinterceptor</name>
<interface>
<name>IInterceptor</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.oemlock</name>
<version>1</version>
<interface>
@@ -351,7 +351,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.ir</name>
<version>1</version>
<interface>
@@ -359,7 +359,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.input.processor</name>
<version>1</version>
<interface>
@@ -367,7 +367,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>3.0</version>
<version>4.0-1</version>
@@ -376,7 +376,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.keymaster</name>
<version>4.0-1</version>
<interface>
@@ -384,7 +384,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.keymint</name>
<version>1-2</version>
<interface>
@@ -393,7 +393,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.keymint</name>
<version>1-2</version>
<interface>
@@ -402,7 +402,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.light</name>
<version>1-2</version>
<interface>
@@ -410,7 +410,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0-2</version>
<interface>
@@ -420,7 +420,7 @@
<regex-instance>vendor[0-9]*_software</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0</version>
<interface>
@@ -429,7 +429,7 @@
<instance>software</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.omx</name>
<version>1.0</version>
<interface>
@@ -441,7 +441,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.memtrack</name>
<version>1</version>
<interface>
@@ -449,7 +449,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.neuralnetworks</name>
<version>1.0-3</version>
<interface>
@@ -457,7 +457,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.neuralnetworks</name>
<version>1-4</version>
<interface>
@@ -465,7 +465,7 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.nfc</name>
<version>1.2</version>
<interface>
@@ -473,14 +473,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.nfc</name>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.oemlock</name>
<version>1.0</version>
<interface>
@@ -488,7 +488,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power</name>
<version>2-3</version>
<interface>
@@ -496,14 +496,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power.stats</name>
<interface>
<name>IPowerStats</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.config</name>
<version>1</version>
<interface>
@@ -511,7 +511,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.data</name>
<version>1</version>
<interface>
@@ -521,7 +521,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.messaging</name>
<version>1</version>
<interface>
@@ -531,7 +531,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.modem</name>
<version>1</version>
<interface>
@@ -541,7 +541,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.network</name>
<version>1</version>
<interface>
@@ -551,7 +551,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.sim</name>
<version>1</version>
<interface>
@@ -561,7 +561,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.voice</name>
<version>1</version>
<interface>
@@ -571,7 +571,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.radio</name>
<version>1.2</version>
<interface>
@@ -580,7 +580,7 @@
<instance>slot2</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.renderscript</name>
<version>1.0</version>
<interface>
@@ -588,7 +588,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.rebootescrow</name>
<version>1</version>
<interface>
@@ -596,7 +596,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.secure_element</name>
<version>1.0-2</version>
<interface>
@@ -605,7 +605,7 @@
<regex-instance>SIM[1-9][0-9]*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.secureclock</name>
<version>1</version>
<interface>
@@ -613,7 +613,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.security.sharedsecret</name>
<version>1</version>
<interface>
@@ -622,14 +622,14 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.sensors</name>
<interface>
<name>ISensors</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.sensors</name>
<version>1.0</version>
<version>2.0-1</version>
@@ -638,7 +638,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.soundtrigger</name>
<version>2.3</version>
<interface>
@@ -646,7 +646,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.soundtrigger3</name>
<version>1</version>
<interface>
@@ -654,7 +654,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<version>1.0</version>
<interface>
@@ -662,7 +662,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<version>1.1</version>
<interface>
@@ -670,7 +670,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.thermal</name>
<version>2.0</version>
<interface>
@@ -678,7 +678,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.cec</name>
<version>1.0-1</version>
<interface>
@@ -686,7 +686,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.input</name>
<version>1.0</version>
<interface>
@@ -694,7 +694,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tv.tuner</name>
<version>1.0-1</version>
<interface>
@@ -702,7 +702,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.tuner</name>
<version>1</version>
<interface>
@@ -710,7 +710,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb</name>
<version>1.0-3</version>
<interface>
@@ -718,14 +718,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.usb</name>
<interface>
<name>IUsb</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.usb.gadget</name>
<version>1.0-2</version>
<interface>
@@ -733,7 +733,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -741,7 +741,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -749,7 +749,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.weaver</name>
<version>1.0</version>
<interface>
@@ -757,7 +757,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.weaver</name>
<version>1</version>
<interface>
@@ -765,7 +765,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.wifi</name>
<version>1.3-6</version>
<interface>
@@ -773,7 +773,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.uwb</name>
<version>1</version>
<interface>
@@ -781,7 +781,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.wifi.hostapd</name>
<version>1</version>
<interface>
@@ -789,7 +789,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.wifi.supplicant</name>
<interface>
<name>ISupplicant</name>
diff --git a/compatibility_matrices/compatibility_matrix.8.xml b/compatibility_matrices/compatibility_matrix.8.xml
index 9057788..d8115e1 100644
--- a/compatibility_matrices/compatibility_matrix.8.xml
+++ b/compatibility_matrices/compatibility_matrix.8.xml
@@ -1,5 +1,5 @@
<compatibility-matrix version="1.0" type="framework" level="8">
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio</name>
<version>6.0</version>
<version>7.0-1</version>
@@ -8,7 +8,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.audio.effect</name>
<version>6.0</version>
<version>7.0</version>
@@ -17,7 +17,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.audio.core</name>
<version>1</version>
<interface>
@@ -36,7 +36,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.audio.effect</name>
<version>1</version>
<interface>
@@ -44,7 +44,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.audio.sounddose</name>
<version>1</version>
<interface>
@@ -52,7 +52,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.authsecret</name>
<version>1</version>
<interface>
@@ -60,7 +60,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.audiocontrol</name>
<version>2-3</version>
<interface>
@@ -68,7 +68,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.can</name>
<version>1</version>
<interface>
@@ -76,7 +76,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.evs</name>
<version>1-2</version>
<interface>
@@ -84,7 +84,7 @@
<regex-instance>[a-z]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.occupant_awareness</name>
<version>1</version>
<interface>
@@ -92,7 +92,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.vehicle</name>
<version>1-2</version>
<interface>
@@ -100,21 +100,21 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.remoteaccess</name>
<interface>
<name>IRemoteAccess</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.automotive.ivn</name>
<interface>
<name>IIvnAndroidDevice</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.biometrics.face</name>
<version>3</version>
<interface>
@@ -123,7 +123,7 @@
<instance>virtual</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.biometrics.fingerprint</name>
<version>3</version>
<interface>
@@ -132,7 +132,7 @@
<instance>virtual</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.bluetooth</name>
<version>1.0-1</version>
<interface>
@@ -140,14 +140,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.bluetooth</name>
<interface>
<name>IBluetoothHci</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.bluetooth.audio</name>
<version>3</version>
<interface>
@@ -155,21 +155,21 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.boot</name>
<interface>
<name>IBootControl</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.broadcastradio</name>
<interface>
<name>IBroadcastRadio</name>
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.camera.provider</name>
<version>1-2</version>
<interface>
@@ -177,14 +177,14 @@
<regex-instance>[^/]+/[0-9]+</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.cas</name>
<interface>
<name>IMediaCasService</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.confirmationui</name>
<version>1</version>
<interface>
@@ -192,7 +192,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.contexthub</name>
<version>2</version>
<interface>
@@ -200,7 +200,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.drm</name>
<version>1</version>
<interface>
@@ -208,14 +208,14 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.dumpstate</name>
<interface>
<name>IDumpstateDevice</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.gatekeeper</name>
<version>1</version>
<interface>
@@ -223,7 +223,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.gnss</name>
<version>2-3</version>
<interface>
@@ -231,7 +231,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.graphics.allocator</name>
<version>1-2</version>
<interface>
@@ -239,7 +239,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.graphics.composer3</name>
<version>2</version>
<interface>
@@ -248,7 +248,7 @@
</interface>
</hal>
<!-- Either the native or the HIDL mapper HAL must exist on the device -->
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.graphics.mapper</name>
<!-- New, non-Go devices should use 4.0, tested in vts_treble_vintf_vendor_test -->
<version>2.1</version>
@@ -259,7 +259,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.health</name>
<version>1-2</version>
<interface>
@@ -267,7 +267,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.health.storage</name>
<version>1</version>
<interface>
@@ -275,7 +275,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.identity</name>
<version>1-5</version>
<interface>
@@ -283,14 +283,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.net.nlinterceptor</name>
<interface>
<name>IInterceptor</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.oemlock</name>
<version>1</version>
<interface>
@@ -298,7 +298,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.ir</name>
<version>1</version>
<interface>
@@ -306,7 +306,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.input.processor</name>
<version>1</version>
<interface>
@@ -314,7 +314,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.security.keymint</name>
<version>1-3</version>
<interface>
@@ -323,7 +323,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.security.keymint</name>
<version>1-3</version>
<interface>
@@ -333,7 +333,7 @@
<instance>widevine</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.light</name>
<version>2</version>
<interface>
@@ -341,7 +341,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0-2</version>
<interface>
@@ -351,7 +351,7 @@
<regex-instance>vendor[0-9]*_software</regex-instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.c2</name>
<version>1.0</version>
<interface>
@@ -360,7 +360,7 @@
<instance>software</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.media.omx</name>
<version>1.0</version>
<interface>
@@ -372,7 +372,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.memtrack</name>
<version>1</version>
<interface>
@@ -380,7 +380,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.neuralnetworks</name>
<version>1-4</version>
<interface>
@@ -388,14 +388,14 @@
<regex-instance>.*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.nfc</name>
<interface>
<name>INfc</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power</name>
<version>4</version>
<interface>
@@ -403,7 +403,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.power.stats</name>
<version>2</version>
<interface>
@@ -411,7 +411,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.config</name>
<version>2</version>
<interface>
@@ -419,7 +419,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.data</name>
<version>2</version>
<interface>
@@ -429,7 +429,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.messaging</name>
<version>2</version>
<interface>
@@ -439,7 +439,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.modem</name>
<version>2</version>
<interface>
@@ -449,7 +449,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.network</name>
<version>2</version>
<interface>
@@ -459,7 +459,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.sim</name>
<version>2</version>
<interface>
@@ -469,7 +469,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.sap</name>
<version>1</version>
<interface>
@@ -479,7 +479,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.voice</name>
<version>2</version>
<interface>
@@ -489,7 +489,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.ims</name>
<version>1</version>
<interface>
@@ -499,7 +499,7 @@
<instance>slot3</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.radio.ims.media</name>
<version>1</version>
<interface>
@@ -507,7 +507,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.renderscript</name>
<version>1.0</version>
<interface>
@@ -515,7 +515,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.rebootescrow</name>
<version>1</version>
<interface>
@@ -523,7 +523,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.secure_element</name>
<version>1</version>
<interface>
@@ -532,7 +532,7 @@
<regex-instance>SIM[1-9][0-9]*</regex-instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.security.secureclock</name>
<version>1</version>
<interface>
@@ -540,7 +540,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.security.sharedsecret</name>
<version>1</version>
<interface>
@@ -549,7 +549,7 @@
<instance>strongbox</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.sensors</name>
<version>2</version>
<interface>
@@ -557,7 +557,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.soundtrigger</name>
<version>2.3</version>
<interface>
@@ -565,7 +565,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.soundtrigger3</name>
<version>1</version>
<interface>
@@ -573,7 +573,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.config</name>
<version>1.0</version>
<interface>
@@ -581,7 +581,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl" optional="true">
+ <hal format="hidl">
<name>android.hardware.tetheroffload.control</name>
<version>1.1</version>
<interface>
@@ -589,7 +589,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tetheroffload</name>
<version>1</version>
<interface>
@@ -597,7 +597,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.thermal</name>
<version>1</version>
<interface>
@@ -605,7 +605,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.hdmi.cec</name>
<version>1</version>
<interface>
@@ -613,7 +613,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.hdmi.earc</name>
<version>1</version>
<interface>
@@ -621,7 +621,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.hdmi.connection</name>
<version>1</version>
<interface>
@@ -629,7 +629,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.tuner</name>
<version>1-2</version>
<interface>
@@ -637,7 +637,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.tv.input</name>
<version>1</version>
<interface>
@@ -645,7 +645,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.usb</name>
<version>1-2</version>
<interface>
@@ -653,14 +653,14 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.usb.gadget</name>
<interface>
<name>IUsbGadget</name>
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -668,7 +668,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.vibrator</name>
<version>1-2</version>
<interface>
@@ -676,7 +676,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.weaver</name>
<version>2</version>
<interface>
@@ -684,7 +684,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.wifi</name>
<version>1</version>
<interface>
@@ -692,7 +692,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true" updatable-via-apex="true">
+ <hal format="aidl" updatable-via-apex="true">
<name>android.hardware.uwb</name>
<version>1</version>
<interface>
@@ -700,7 +700,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.wifi.hostapd</name>
<version>1</version>
<interface>
@@ -708,7 +708,7 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="aidl" optional="true">
+ <hal format="aidl">
<name>android.hardware.wifi.supplicant</name>
<version>2</version>
<interface>
@@ -717,7 +717,7 @@
</interface>
</hal>
<!-- Either the native or the HIDL mapper HAL must exist on the device -->
- <hal format="native" optional="true">
+ <hal format="native">
<name>mapper</name>
<version>5.0</version>
<interface>
diff --git a/media/bufferpool/aidl/Android.bp b/media/bufferpool/aidl/Android.bp
index 8e013e0..9dcc90e 100644
--- a/media/bufferpool/aidl/Android.bp
+++ b/media/bufferpool/aidl/Android.bp
@@ -26,6 +26,9 @@
vendor_available: true,
double_loadable: true,
srcs: ["android/hardware/media/bufferpool2/*.aidl"],
+ headers: [
+ "HardwareBuffer_aidl",
+ ],
imports: [
"android.hardware.common-V2",
"android.hardware.common.fmq-V1",
@@ -44,10 +47,13 @@
"//apex_available:platform",
"com.android.media.swcodec",
],
+ additional_shared_libraries: [
+ "libnativewindow",
+ ],
min_sdk_version: "29",
},
rust: {
- enabled: true,
+ enabled: false,
},
},
versions_with_info: [
@@ -59,6 +65,6 @@
],
},
],
- frozen: true,
+ frozen: false,
}
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl
index 4ea0bba..85a78ad 100644
--- a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/Buffer.aidl
@@ -35,5 +35,6 @@
@VintfStability
parcelable Buffer {
int id;
- android.hardware.common.NativeHandle buffer;
+ @nullable android.hardware.common.NativeHandle buffer;
+ @nullable android.hardware.HardwareBuffer hwbBuffer;
}
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl
index 976f674..79b3f23 100644
--- a/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/Buffer.aidl
@@ -17,6 +17,7 @@
package android.hardware.media.bufferpool2;
import android.hardware.common.NativeHandle;
+import android.hardware.HardwareBuffer;
/**
* Generic buffer for fast recycling for media/stagefright.
@@ -26,10 +27,14 @@
* by a buffer pool, and are recycled to the buffer pool when they are
* no longer referenced by the clients.
*
+ * Initially all buffers in media HAL should be NativeHandle(actually native_handle_t).
+ * HardwareBuffer(actually AHardwareBuffer) for GraphicBuffer is added from V2.
+ *
* E.g. ion or gralloc buffer
*/
@VintfStability
parcelable Buffer {
int id;
- NativeHandle buffer;
+ @nullable NativeHandle buffer;
+ @nullable HardwareBuffer hwbBuffer;
}
diff --git a/media/bufferpool/aidl/default/Android.bp b/media/bufferpool/aidl/default/Android.bp
index 11a6163..4d12d63 100644
--- a/media/bufferpool/aidl/default/Android.bp
+++ b/media/bufferpool/aidl/default/Android.bp
@@ -33,15 +33,16 @@
"libcutils",
"libfmq",
"liblog",
+ "libnativewindow",
"libutils",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
static_libs: [
"libaidlcommonsupport",
],
export_shared_lib_headers: [
"libfmq",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
double_loadable: true,
cflags: [
diff --git a/media/bufferpool/aidl/default/BufferPoolClient.cpp b/media/bufferpool/aidl/default/BufferPoolClient.cpp
index 0e249d5..ce4ad8e 100644
--- a/media/bufferpool/aidl/default/BufferPoolClient.cpp
+++ b/media/bufferpool/aidl/default/BufferPoolClient.cpp
@@ -757,7 +757,13 @@
return svcSpecific ? svcSpecific : ResultStatus::CRITICAL_ERROR;
}
if (results[0].getTag() == FetchResult::buffer) {
- *handle = ::android::dupFromAidl(results[0].get<FetchResult::buffer>().buffer);
+ if (results[0].get<FetchResult::buffer>().buffer.has_value()) {
+ *handle = ::android::dupFromAidl(results[0].get<FetchResult::buffer>().buffer.value());
+ } else {
+ // TODO: Support HardwareBuffer
+ ALOGW("handle nullptr");
+ *handle = nullptr;
+ }
return ResultStatus::OK;
}
return results[0].get<FetchResult::failure>();
diff --git a/media/bufferpool/aidl/default/tests/Android.bp b/media/bufferpool/aidl/default/tests/Android.bp
index 549af57..487ed4c 100644
--- a/media/bufferpool/aidl/default/tests/Android.bp
+++ b/media/bufferpool/aidl/default/tests/Android.bp
@@ -36,8 +36,9 @@
"libcutils",
"libfmq",
"liblog",
+ "libnativewindow",
"libutils",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
static_libs: [
"libaidlcommonsupport",
@@ -59,8 +60,9 @@
"libcutils",
"libfmq",
"liblog",
+ "libnativewindow",
"libutils",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
static_libs: [
"libaidlcommonsupport",
@@ -82,8 +84,9 @@
"libcutils",
"libfmq",
"liblog",
+ "libnativewindow",
"libutils",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
static_libs: [
"libaidlcommonsupport",
diff --git a/media/c2/aidl/Android.bp b/media/c2/aidl/Android.bp
index b511e45..2eaeb01 100644
--- a/media/c2/aidl/Android.bp
+++ b/media/c2/aidl/Android.bp
@@ -20,7 +20,7 @@
],
imports: [
"android.hardware.common-V2",
- "android.hardware.media.bufferpool2-V1",
+ "android.hardware.media.bufferpool2-V2",
],
include_dirs: [
"frameworks/native/aidl/gui",
diff --git a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
index b36735f..8210ff0 100644
--- a/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
+++ b/nfc/1.0/vts/functional/VtsHalNfcV1_0TargetTest.cpp
@@ -354,13 +354,6 @@
res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
EXPECT_TRUE(res.no_timeout);
EXPECT_EQ((int)NfcStatus::OK, res.args->last_data_[3]);
- if (nci_version == NCI_VERSION_2 && res.args->last_data_.size() > 13 &&
- res.args->last_data_[13] == 0x00) {
- // Wait for CORE_CONN_CREDITS_NTF
- res = nfc_cb_->WaitForCallback(kCallbackNameSendData);
- EXPECT_TRUE(res.no_timeout);
- }
-
cmd = CORE_CONN_CREATE_CMD;
data = cmd;
EXPECT_EQ(data.size(), nfc_->write(data));
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 6643c1e..a48abb8 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -1167,19 +1167,12 @@
EXPECT_EQ(RadioResponseType::SOLICITED, radioRsp_network->rspInfo.type);
EXPECT_EQ(serial, radioRsp_network->rspInfo.serial);
- if (cardStatus.cardState == CardStatus::STATE_ABSENT) {
- ASSERT_TRUE(CheckAnyOfErrors(
- radioRsp_network->rspInfo.error,
- {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_STATE, RadioError::RADIO_NOT_AVAILABLE, RadioError::NO_MEMORY,
- RadioError::INTERNAL_ERR, RadioError::SYSTEM_ERR, RadioError::CANCELLED}));
- } else if (cardStatus.cardState == CardStatus::STATE_PRESENT) {
- ASSERT_TRUE(CheckAnyOfErrors(
- radioRsp_network->rspInfo.error,
- {RadioError::NONE, RadioError::RADIO_NOT_AVAILABLE, RadioError::INVALID_ARGUMENTS,
- RadioError::INVALID_STATE, RadioError::NO_MEMORY, RadioError::INTERNAL_ERR,
- RadioError::SYSTEM_ERR, RadioError::CANCELLED}));
- }
+ ASSERT_TRUE(CheckAnyOfErrors(
+ radioRsp_network->rspInfo.error,
+ {RadioError::NONE, RadioError::ILLEGAL_SIM_OR_ME, RadioError::RADIO_NOT_AVAILABLE,
+ RadioError::INVALID_ARGUMENTS, RadioError::INVALID_STATE, RadioError::NO_MEMORY,
+ RadioError::INTERNAL_ERR, RadioError::SYSTEM_ERR, RadioError::CANCELLED,
+ RadioError::MODEM_ERR, RadioError::OPERATION_NOT_ALLOWED, RadioError::NO_RESOURCES}));
}
/*
diff --git a/security/authgraph/aidl/android/hardware/security/authgraph/ExplicitKeyDiceCertChain.cddl b/security/authgraph/aidl/android/hardware/security/authgraph/ExplicitKeyDiceCertChain.cddl
index 3de5617..2d6c696 100644
--- a/security/authgraph/aidl/android/hardware/security/authgraph/ExplicitKeyDiceCertChain.cddl
+++ b/security/authgraph/aidl/android/hardware/security/authgraph/ExplicitKeyDiceCertChain.cddl
@@ -19,11 +19,10 @@
* DiceChainEntry
]
-DiceCertChainInitialPayload = {
- -4670552 : bstr .cbor PubKeyEd25519 /
- bstr .cbor PubKeyECDSA256 /
- bstr .cbor PubKeyECDSA384 ; subjectPublicKey
-}
+; Encoded in accordance with Core Deterministic Encoding Requirements [RFC 8949 s4.2.1]
+DiceCertChainInitialPayload = bstr .cbor PubKeyEd25519
+ / bstr .cbor PubKeyECDSA256
+ / bstr .cbor PubKeyECDSA384 ; subjectPublicKey
; INCLUDE generateCertificateRequestV2.cddl for: PubKeyEd25519, PubKeyECDSA256, PubKeyECDSA384,
; DiceChainEntry
diff --git a/security/secretkeeper/aidl/vts/Android.bp b/security/secretkeeper/aidl/vts/Android.bp
index 1e01149..720b8a2 100644
--- a/security/secretkeeper/aidl/vts/Android.bp
+++ b/security/secretkeeper/aidl/vts/Android.bp
@@ -30,6 +30,8 @@
],
test_config: "AndroidTest.xml",
rustlibs: [
+ "libdiced_open_dice",
+ "libdice_policy",
"libsecretkeeper_client",
"libsecretkeeper_comm_nostd",
"libsecretkeeper_core_nostd",
@@ -39,6 +41,7 @@
"libcoset",
"libauthgraph_vts_test",
"libbinder_rs",
+ "libciborium",
"libcoset",
"liblog_rust",
],
diff --git a/security/secretkeeper/aidl/vts/dice_sample.rs b/security/secretkeeper/aidl/vts/dice_sample.rs
new file mode 100644
index 0000000..db532b1
--- /dev/null
+++ b/security/secretkeeper/aidl/vts/dice_sample.rs
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+//! This module provides a set of sample DICE chains for testing purpose only. Note that this
+//! module duplicates a large chunk of code in libdiced_sample_inputs. We avoid modifying the
+//! latter for testing purposes because it is installed on device.
+
+use ciborium::{de, ser, value::Value};
+use core::ffi::CStr;
+use coset::{iana, Algorithm, AsCborValue, CoseKey, KeyOperation, KeyType, Label};
+use diced_open_dice::{
+ derive_cdi_private_key_seed, keypair_from_seed, retry_bcc_format_config_descriptor,
+ retry_bcc_main_flow, retry_dice_main_flow, Config, DiceArtifacts, DiceConfigValues, DiceError,
+ DiceMode, InputValues, OwnedDiceArtifacts, CDI_SIZE, HASH_SIZE, HIDDEN_SIZE,
+};
+use log::error;
+use secretkeeper_client::dice::OwnedDiceArtifactsWithExplicitKey;
+
+/// Sample UDS used to perform the root DICE flow by `make_sample_bcc_and_cdis`.
+const UDS: &[u8; CDI_SIZE] = &[
+ 0x65, 0x4f, 0xab, 0xa9, 0xa5, 0xad, 0x0f, 0x5e, 0x15, 0xc3, 0x12, 0xf7, 0x77, 0x45, 0xfa, 0x55,
+ 0x18, 0x6a, 0xa6, 0x34, 0xb6, 0x7c, 0x82, 0x7b, 0x89, 0x4c, 0xc5, 0x52, 0xd3, 0x27, 0x35, 0x8e,
+];
+
+const CODE_HASH_ABL: [u8; HASH_SIZE] = [
+ 0x16, 0x48, 0xf2, 0x55, 0x53, 0x23, 0xdd, 0x15, 0x2e, 0x83, 0x38, 0xc3, 0x64, 0x38, 0x63, 0x26,
+ 0x0f, 0xcf, 0x5b, 0xd1, 0x3a, 0xd3, 0x40, 0x3e, 0x23, 0xf8, 0x34, 0x4c, 0x6d, 0xa2, 0xbe, 0x25,
+ 0x1c, 0xb0, 0x29, 0xe8, 0xc3, 0xfb, 0xb8, 0x80, 0xdc, 0xb1, 0xd2, 0xb3, 0x91, 0x4d, 0xd3, 0xfb,
+ 0x01, 0x0f, 0xe4, 0xe9, 0x46, 0xa2, 0xc0, 0x26, 0x57, 0x5a, 0xba, 0x30, 0xf7, 0x15, 0x98, 0x14,
+];
+const AUTHORITY_HASH_ABL: [u8; HASH_SIZE] = [
+ 0xf9, 0x00, 0x9d, 0xc2, 0x59, 0x09, 0xe0, 0xb6, 0x98, 0xbd, 0xe3, 0x97, 0x4a, 0xcb, 0x3c, 0xe7,
+ 0x6b, 0x24, 0xc3, 0xe4, 0x98, 0xdd, 0xa9, 0x6a, 0x41, 0x59, 0x15, 0xb1, 0x23, 0xe6, 0xc8, 0xdf,
+ 0xfb, 0x52, 0xb4, 0x52, 0xc1, 0xb9, 0x61, 0xdd, 0xbc, 0x5b, 0x37, 0x0e, 0x12, 0x12, 0xb2, 0xfd,
+ 0xc1, 0x09, 0xb0, 0xcf, 0x33, 0x81, 0x4c, 0xc6, 0x29, 0x1b, 0x99, 0xea, 0xae, 0xfd, 0xaa, 0x0d,
+];
+const HIDDEN_ABL: [u8; HIDDEN_SIZE] = [
+ 0xa2, 0x01, 0xd0, 0xc0, 0xaa, 0x75, 0x3c, 0x06, 0x43, 0x98, 0x6c, 0xc3, 0x5a, 0xb5, 0x5f, 0x1f,
+ 0x0f, 0x92, 0x44, 0x3b, 0x0e, 0xd4, 0x29, 0x75, 0xe3, 0xdb, 0x36, 0xda, 0xc8, 0x07, 0x97, 0x4d,
+ 0xff, 0xbc, 0x6a, 0xa4, 0x8a, 0xef, 0xc4, 0x7f, 0xf8, 0x61, 0x7d, 0x51, 0x4d, 0x2f, 0xdf, 0x7e,
+ 0x8c, 0x3d, 0xa3, 0xfc, 0x63, 0xd4, 0xd4, 0x74, 0x8a, 0xc4, 0x14, 0x45, 0x83, 0x6b, 0x12, 0x7e,
+];
+const CODE_HASH_AVB: [u8; HASH_SIZE] = [
+ 0xa4, 0x0c, 0xcb, 0xc1, 0xbf, 0xfa, 0xcc, 0xfd, 0xeb, 0xf4, 0xfc, 0x43, 0x83, 0x7f, 0x46, 0x8d,
+ 0xd8, 0xd8, 0x14, 0xc1, 0x96, 0x14, 0x1f, 0x6e, 0xb3, 0xa0, 0xd9, 0x56, 0xb3, 0xbf, 0x2f, 0xfa,
+ 0x88, 0x70, 0x11, 0x07, 0x39, 0xa4, 0xd2, 0xa9, 0x6b, 0x18, 0x28, 0xe8, 0x29, 0x20, 0x49, 0x0f,
+ 0xbb, 0x8d, 0x08, 0x8c, 0xc6, 0x54, 0xe9, 0x71, 0xd2, 0x7e, 0xa4, 0xfe, 0x58, 0x7f, 0xd3, 0xc7,
+];
+const AUTHORITY_HASH_AVB: [u8; HASH_SIZE] = [
+ 0xb2, 0x69, 0x05, 0x48, 0x56, 0xb5, 0xfa, 0x55, 0x6f, 0xac, 0x56, 0xd9, 0x02, 0x35, 0x2b, 0xaa,
+ 0x4c, 0xba, 0x28, 0xdd, 0x82, 0x3a, 0x86, 0xf5, 0xd4, 0xc2, 0xf1, 0xf9, 0x35, 0x7d, 0xe4, 0x43,
+ 0x13, 0xbf, 0xfe, 0xd3, 0x36, 0xd8, 0x1c, 0x12, 0x78, 0x5c, 0x9c, 0x3e, 0xf6, 0x66, 0xef, 0xab,
+ 0x3d, 0x0f, 0x89, 0xa4, 0x6f, 0xc9, 0x72, 0xee, 0x73, 0x43, 0x02, 0x8a, 0xef, 0xbc, 0x05, 0x98,
+];
+const HIDDEN_AVB: [u8; HIDDEN_SIZE] = [
+ 0x5b, 0x3f, 0xc9, 0x6b, 0xe3, 0x95, 0x59, 0x40, 0x5e, 0x64, 0xe5, 0x64, 0x3f, 0xfd, 0x21, 0x09,
+ 0x9d, 0xf3, 0xcd, 0xc7, 0xa4, 0x2a, 0xe2, 0x97, 0xdd, 0xe2, 0x4f, 0xb0, 0x7d, 0x7e, 0xf5, 0x8e,
+ 0xd6, 0x4d, 0x84, 0x25, 0x54, 0x41, 0x3f, 0x8f, 0x78, 0x64, 0x1a, 0x51, 0x27, 0x9d, 0x55, 0x8a,
+ 0xe9, 0x90, 0x35, 0xab, 0x39, 0x80, 0x4b, 0x94, 0x40, 0x84, 0xa2, 0xfd, 0x73, 0xeb, 0x35, 0x7a,
+];
+const AUTHORITY_HASH_ANDROID: [u8; HASH_SIZE] = [
+ 0x04, 0x25, 0x5d, 0x60, 0x5f, 0x5c, 0x45, 0x0d, 0xf2, 0x9a, 0x6e, 0x99, 0x30, 0x03, 0xb8, 0xd6,
+ 0xe1, 0x99, 0x71, 0x1b, 0xf8, 0x44, 0xfa, 0xb5, 0x31, 0x79, 0x1c, 0x37, 0x68, 0x4e, 0x1d, 0xc0,
+ 0x24, 0x74, 0x68, 0xf8, 0x80, 0x20, 0x3e, 0x44, 0xb1, 0x43, 0xd2, 0x9c, 0xfc, 0x12, 0x9e, 0x77,
+ 0x0a, 0xde, 0x29, 0x24, 0xff, 0x2e, 0xfa, 0xc7, 0x10, 0xd5, 0x73, 0xd4, 0xc6, 0xdf, 0x62, 0x9f,
+];
+
+/// Encode the public key to CBOR Value. The input (raw 32 bytes) is wrapped into CoseKey.
+fn ed25519_public_key_to_cbor_value(public_key: &[u8]) -> Value {
+ let key = CoseKey {
+ kty: KeyType::Assigned(iana::KeyType::OKP),
+ alg: Some(Algorithm::Assigned(iana::Algorithm::EdDSA)),
+ key_ops: vec![KeyOperation::Assigned(iana::KeyOperation::Verify)].into_iter().collect(),
+ params: vec![
+ (
+ Label::Int(iana::Ec2KeyParameter::Crv as i64),
+ Value::from(iana::EllipticCurve::Ed25519 as u64),
+ ),
+ (Label::Int(iana::Ec2KeyParameter::X as i64), Value::Bytes(public_key.to_vec())),
+ ],
+ ..Default::default()
+ };
+ key.to_cbor_value().unwrap()
+}
+
+/// Makes a DICE chain (BCC) from the sample input.
+///
+/// The DICE chain is of the following format:
+/// public key derived from UDS -> ABL certificate -> AVB certificate -> Android certificate
+/// The `security_version` is included in the Android certificate.
+pub fn make_explicit_owned_dice(security_version: u64) -> OwnedDiceArtifactsWithExplicitKey {
+ let dice = make_sample_bcc_and_cdis(security_version);
+ OwnedDiceArtifactsWithExplicitKey::from_owned_artifacts(dice).unwrap()
+}
+
+fn make_sample_bcc_and_cdis(security_version: u64) -> OwnedDiceArtifacts {
+ let private_key_seed = derive_cdi_private_key_seed(UDS).unwrap();
+
+ // Gets the root public key in DICE chain (BCC).
+ let (public_key, _) = keypair_from_seed(private_key_seed.as_array()).unwrap();
+ let ed25519_public_key_value = ed25519_public_key_to_cbor_value(&public_key);
+
+ // Gets the ABL certificate to as the root certificate of DICE chain.
+ let config_values = DiceConfigValues {
+ component_name: Some(CStr::from_bytes_with_nul(b"ABL\0").unwrap()),
+ component_version: Some(1),
+ resettable: true,
+ ..Default::default()
+ };
+ let config_descriptor = retry_bcc_format_config_descriptor(&config_values).unwrap();
+ let input_values = InputValues::new(
+ CODE_HASH_ABL,
+ Config::Descriptor(config_descriptor.as_slice()),
+ AUTHORITY_HASH_ABL,
+ DiceMode::kDiceModeNormal,
+ HIDDEN_ABL,
+ );
+ let (cdi_values, cert) = retry_dice_main_flow(UDS, UDS, &input_values).unwrap();
+ let bcc_value =
+ Value::Array(vec![ed25519_public_key_value, de::from_reader(&cert[..]).unwrap()]);
+ let mut bcc: Vec<u8> = vec![];
+ ser::into_writer(&bcc_value, &mut bcc).unwrap();
+
+ // Appends AVB certificate to DICE chain.
+ let config_values = DiceConfigValues {
+ component_name: Some(CStr::from_bytes_with_nul(b"AVB\0").unwrap()),
+ component_version: Some(1),
+ resettable: true,
+ ..Default::default()
+ };
+ let config_descriptor = retry_bcc_format_config_descriptor(&config_values).unwrap();
+ let input_values = InputValues::new(
+ CODE_HASH_AVB,
+ Config::Descriptor(config_descriptor.as_slice()),
+ AUTHORITY_HASH_AVB,
+ DiceMode::kDiceModeNormal,
+ HIDDEN_AVB,
+ );
+ let dice_artifacts =
+ retry_bcc_main_flow(&cdi_values.cdi_attest, &cdi_values.cdi_seal, &bcc, &input_values)
+ .unwrap();
+
+ // Appends Android certificate to DICE chain.
+ let config_values = DiceConfigValues {
+ component_name: Some(CStr::from_bytes_with_nul(b"Android\0").unwrap()),
+ component_version: Some(12),
+ security_version: Some(security_version),
+ resettable: true,
+ ..Default::default()
+ };
+ let config_descriptor = retry_bcc_format_config_descriptor(&config_values).unwrap();
+ let input_values = InputValues::new(
+ [0u8; HASH_SIZE], // code_hash
+ Config::Descriptor(config_descriptor.as_slice()),
+ AUTHORITY_HASH_ANDROID,
+ DiceMode::kDiceModeNormal,
+ [0u8; HIDDEN_SIZE], // hidden
+ );
+ retry_bcc_main_flow(
+ dice_artifacts.cdi_attest(),
+ dice_artifacts.cdi_seal(),
+ dice_artifacts
+ .bcc()
+ .ok_or_else(|| {
+ error!("bcc is none");
+ DiceError::InvalidInput
+ })
+ .unwrap(),
+ &input_values,
+ )
+ .unwrap()
+}
diff --git a/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs b/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
index eeef6fc..26fdb56 100644
--- a/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
+++ b/security/secretkeeper/aidl/vts/secretkeeper_test_client.rs
@@ -15,6 +15,9 @@
*/
#![cfg(test)]
+mod dice_sample;
+
+use crate::dice_sample::make_explicit_owned_dice;
use rdroidtest_macro::{ignore_if, rdroidtest};
use android_hardware_security_secretkeeper::aidl::android::hardware::security::secretkeeper::ISecretkeeper::ISecretkeeper;
@@ -23,6 +26,8 @@
use authgraph_boringssl as boring;
use authgraph_core::key;
use coset::{CborSerializable, CoseEncrypt0};
+use dice_policy::{ConstraintSpec, ConstraintType, DicePolicy, MissingAction};
+use secretkeeper_client::dice::OwnedDiceArtifactsWithExplicitKey;
use secretkeeper_client::SkSession;
use secretkeeper_core::cipher;
use secretkeeper_comm::data_types::error::SecretkeeperError;
@@ -37,15 +42,6 @@
const SECRETKEEPER_SERVICE: &str = "android.hardware.security.secretkeeper.ISecretkeeper";
const CURRENT_VERSION: u64 = 1;
-// TODO(b/291238565): This will change once libdice_policy switches to Explicit-key DiceCertChain
-// This is generated by patching libdice_policy such that it dumps an example dice chain &
-// a policy, such that the former matches the latter.
-const HYPOTHETICAL_DICE_POLICY: [u8; 43] = [
- 0x83, 0x01, 0x81, 0x83, 0x01, 0x80, 0xA1, 0x01, 0x00, 0x82, 0x83, 0x01, 0x81, 0x01, 0x73, 0x74,
- 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x5F, 0x64, 0x69, 0x63, 0x65, 0x5F, 0x70, 0x6F, 0x6C, 0x69,
- 0x63, 0x79, 0x83, 0x02, 0x82, 0x03, 0x18, 0x64, 0x19, 0xE9, 0x75,
-];
-
// Random bytes (of ID_SIZE/SECRET_SIZE) generated for tests.
const ID_EXAMPLE: Id = Id([
0xF1, 0xB2, 0xED, 0x3B, 0xD1, 0xBD, 0xF0, 0x7D, 0xE1, 0xF0, 0x01, 0xFC, 0x61, 0x71, 0xD3, 0x42,
@@ -88,6 +84,7 @@
struct SkClient {
sk: binder::Strong<dyn ISecretkeeper>,
session: SkSession,
+ dice_artifacts: OwnedDiceArtifactsWithExplicitKey,
}
impl Drop for SkClient {
@@ -98,15 +95,26 @@
}
impl SkClient {
+ /// Create an `SkClient` using the default `OwnedDiceArtifactsWithExplicitKey` for identity.
fn new(instance: &str) -> Self {
+ let default_dice = make_explicit_owned_dice(/*Security version in a node */ 5);
+ Self::with_identity(instance, default_dice)
+ }
+
+ /// Create an `SkClient` using the given `OwnedDiceArtifactsWithExplicitKey` for identity.
+ fn with_identity(instance: &str, dice_artifacts: OwnedDiceArtifactsWithExplicitKey) -> Self {
let sk = get_connection(instance);
- Self { sk: sk.clone(), session: SkSession::new(sk).unwrap() }
+ Self {
+ sk: sk.clone(),
+ session: SkSession::new(sk, &dice_artifacts).unwrap(),
+ dice_artifacts,
+ }
}
/// This method is wrapper that use `SkSession::secret_management_request` which handles
/// encryption and decryption.
- fn secret_management_request(&mut self, req_data: &[u8]) -> Vec<u8> {
- self.session.secret_management_request(req_data).unwrap()
+ fn secret_management_request(&mut self, req_data: &[u8]) -> Result<Vec<u8>, Error> {
+ Ok(self.session.secret_management_request(req_data)?)
}
/// Unlike the method [`secret_management_request`], this method directly uses
@@ -117,7 +125,7 @@
req_data: &[u8],
req_aad: &[u8],
expected_res_aad: &[u8],
- ) -> Vec<u8> {
+ ) -> Result<Vec<u8>, Error> {
let aes_gcm = boring::BoringAes;
let rng = boring::BoringRng;
let request_bytes = cipher::encrypt_message(
@@ -128,54 +136,54 @@
&req_data,
req_aad,
)
- .unwrap();
+ .map_err(|e| secretkeeper_client::Error::CipherError(e))?;
// Binder call!
- let response_bytes = self.sk.processSecretManagementRequest(&request_bytes).unwrap();
+ let response_bytes = self.sk.processSecretManagementRequest(&request_bytes)?;
- let response_encrypt0 = CoseEncrypt0::from_slice(&response_bytes).unwrap();
- cipher::decrypt_message(
+ let response_encrypt0 = CoseEncrypt0::from_slice(&response_bytes)?;
+ Ok(cipher::decrypt_message(
&aes_gcm,
self.session.decryption_key(),
&response_encrypt0,
expected_res_aad,
)
- .unwrap()
+ .map_err(|e| secretkeeper_client::Error::CipherError(e))?)
}
- /// Helper method to store a secret.
- fn store(&mut self, id: &Id, secret: &Secret) {
- let store_request = StoreSecretRequest {
- id: id.clone(),
- secret: secret.clone(),
- sealing_policy: HYPOTHETICAL_DICE_POLICY.to_vec(),
- };
- let store_request = store_request.serialize_to_packet().to_vec().unwrap();
+ /// Helper method to store a secret. This uses the default compatible sealing_policy on
+ /// dice_chain.
+ fn store(&mut self, id: &Id, secret: &Secret) -> Result<(), Error> {
+ let sealing_policy = sealing_policy(
+ self.dice_artifacts.explicit_key_dice_chain().ok_or(Error::UnexpectedError)?,
+ );
+ let store_request =
+ StoreSecretRequest { id: id.clone(), secret: secret.clone(), sealing_policy };
+ let store_request = store_request.serialize_to_packet().to_vec()?;
- let store_response = self.secret_management_request(&store_request);
- let store_response = ResponsePacket::from_slice(&store_response).unwrap();
+ let store_response = self.secret_management_request(&store_request)?;
+ let store_response = ResponsePacket::from_slice(&store_response)?;
- assert_eq!(store_response.response_type().unwrap(), ResponseType::Success);
+ assert_eq!(store_response.response_type()?, ResponseType::Success);
// Really just checking that the response is indeed StoreSecretResponse
- let _ = StoreSecretResponse::deserialize_from_packet(store_response).unwrap();
+ let _ = StoreSecretResponse::deserialize_from_packet(store_response)?;
+ Ok(())
}
/// Helper method to get a secret.
- fn get(&mut self, id: &Id) -> Option<Secret> {
+ fn get(&mut self, id: &Id) -> Result<Secret, Error> {
let get_request = GetSecretRequest { id: id.clone(), updated_sealing_policy: None };
- let get_request = get_request.serialize_to_packet().to_vec().unwrap();
+ let get_request = get_request.serialize_to_packet().to_vec()?;
- let get_response = self.secret_management_request(&get_request);
- let get_response = ResponsePacket::from_slice(&get_response).unwrap();
+ let get_response = self.secret_management_request(&get_request)?;
+ let get_response = ResponsePacket::from_slice(&get_response)?;
- if get_response.response_type().unwrap() == ResponseType::Success {
- let get_response = *GetSecretResponse::deserialize_from_packet(get_response).unwrap();
- Some(Secret(get_response.secret.0))
+ if get_response.response_type()? == ResponseType::Success {
+ let get_response = *GetSecretResponse::deserialize_from_packet(get_response)?;
+ Ok(Secret(get_response.secret.0))
} else {
- // Only expect a not-found failure.
- let err = *SecretkeeperError::deserialize_from_packet(get_response).unwrap();
- assert_eq!(err, SecretkeeperError::EntryNotFound);
- None
+ let err = *SecretkeeperError::deserialize_from_packet(get_response)?;
+ Err(Error::SecretkeeperError(err))
}
}
@@ -191,6 +199,74 @@
}
}
+#[derive(Debug)]
+enum Error {
+ // Errors from Secretkeeper API errors. These are thrown by core SecretManagement and
+ // not visible without decryption.
+ SecretkeeperError(SecretkeeperError),
+ InfraError(secretkeeper_client::Error),
+ UnexpectedError,
+}
+
+impl From<secretkeeper_client::Error> for Error {
+ fn from(e: secretkeeper_client::Error) -> Self {
+ Self::InfraError(e)
+ }
+}
+
+impl From<SecretkeeperError> for Error {
+ fn from(e: SecretkeeperError) -> Self {
+ Self::SecretkeeperError(e)
+ }
+}
+
+impl From<coset::CoseError> for Error {
+ fn from(e: coset::CoseError) -> Self {
+ Self::InfraError(secretkeeper_client::Error::from(e))
+ }
+}
+
+impl From<binder::Status> for Error {
+ fn from(s: binder::Status) -> Self {
+ Self::InfraError(secretkeeper_client::Error::from(s))
+ }
+}
+
+impl From<secretkeeper_comm::data_types::error::Error> for Error {
+ fn from(e: secretkeeper_comm::data_types::error::Error) -> Self {
+ Self::InfraError(secretkeeper_client::Error::from(e))
+ }
+}
+
+// Assert that the error is EntryNotFound
+fn assert_entry_not_found(res: Result<Secret, Error>) {
+ assert!(matches!(res.unwrap_err(), Error::SecretkeeperError(SecretkeeperError::EntryNotFound)))
+}
+
+/// Construct a sealing policy on the dice chain. This method uses the following set of
+/// constraints which are compatible with sample DICE chains used in VTS.
+/// 1. ExactMatch on AUTHORITY_HASH (non-optional).
+/// 2. ExactMatch on KEY_MODE (non-optional).
+/// 3. GreaterOrEqual on SECURITY_VERSION (optional).
+fn sealing_policy(dice: &[u8]) -> Vec<u8> {
+ let authority_hash: i64 = -4670549;
+ let key_mode: i64 = -4670551;
+ let config_desc: i64 = -4670548;
+ let security_version: i64 = -70005;
+
+ let constraint_spec = [
+ ConstraintSpec::new(ConstraintType::ExactMatch, vec![authority_hash], MissingAction::Fail),
+ ConstraintSpec::new(ConstraintType::ExactMatch, vec![key_mode], MissingAction::Fail),
+ ConstraintSpec::new(
+ ConstraintType::GreaterOrEqual,
+ vec![config_desc, security_version],
+ MissingAction::Ignore,
+ ),
+ ];
+
+ DicePolicy::from_dice_chain(dice, &constraint_spec).unwrap().to_vec().unwrap()
+}
+
/// Perform AuthGraph key exchange, returning the session keys and session ID.
fn authgraph_key_exchange(sk: binder::Strong<dyn ISecretkeeper>) -> ([key::AesKey; 2], Vec<u8>) {
let sink = sk.getAuthGraphKe().expect("failed to get AuthGraph");
@@ -237,7 +313,7 @@
let request_packet = request.serialize_to_packet();
let request_bytes = request_packet.to_vec().unwrap();
- let response_bytes = sk_client.secret_management_request(&request_bytes);
+ let response_bytes = sk_client.secret_management_request(&request_bytes).unwrap();
let response_packet = ResponsePacket::from_slice(&response_bytes).unwrap();
assert_eq!(response_packet.response_type().unwrap(), ResponseType::Success);
@@ -257,7 +333,7 @@
// Deform the request
request_bytes[0] = !request_bytes[0];
- let response_bytes = sk_client.secret_management_request(&request_bytes);
+ let response_bytes = sk_client.secret_management_request(&request_bytes).unwrap();
let response_packet = ResponsePacket::from_slice(&response_bytes).unwrap();
assert_eq!(response_packet.response_type().unwrap(), ResponseType::Error);
@@ -269,10 +345,10 @@
fn secret_management_store_get_secret_found(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
// Get the secret that was just stored
- assert_eq!(sk_client.get(&ID_EXAMPLE), Some(SECRET_EXAMPLE));
+ assert_eq!(sk_client.get(&ID_EXAMPLE).unwrap(), SECRET_EXAMPLE);
}
#[rdroidtest(get_instances())]
@@ -280,64 +356,63 @@
let mut sk_client = SkClient::new(&instance);
// Store a secret (corresponding to an id).
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
// Get the secret that was never stored
- assert_eq!(sk_client.get(&ID_NOT_STORED), None);
+ assert_entry_not_found(sk_client.get(&ID_NOT_STORED));
}
#[rdroidtest(get_instances())]
fn secretkeeper_store_delete_ids(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
- sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+ sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE).unwrap();
sk_client.delete(&[&ID_EXAMPLE]);
-
- assert_eq!(sk_client.get(&ID_EXAMPLE), None);
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), Some(SECRET_EXAMPLE));
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE));
+ assert_eq!(sk_client.get(&ID_EXAMPLE_2).unwrap(), SECRET_EXAMPLE);
sk_client.delete(&[&ID_EXAMPLE_2]);
- assert_eq!(sk_client.get(&ID_EXAMPLE), None);
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), None);
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE));
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE_2));
}
#[rdroidtest(get_instances())]
fn secretkeeper_store_delete_multiple_ids(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
- sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+ sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE).unwrap();
sk_client.delete(&[&ID_EXAMPLE, &ID_EXAMPLE_2]);
- assert_eq!(sk_client.get(&ID_EXAMPLE), None);
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), None);
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE));
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE_2));
}
#[rdroidtest(get_instances())]
fn secretkeeper_store_delete_duplicate_ids(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
- sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+ sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE).unwrap();
// Delete the same secret twice.
sk_client.delete(&[&ID_EXAMPLE, &ID_EXAMPLE]);
- assert_eq!(sk_client.get(&ID_EXAMPLE), None);
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), Some(SECRET_EXAMPLE));
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE));
+ assert_eq!(sk_client.get(&ID_EXAMPLE_2).unwrap(), SECRET_EXAMPLE);
}
#[rdroidtest(get_instances())]
fn secretkeeper_store_delete_nonexistent(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
- sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+ sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE).unwrap();
sk_client.delete(&[&ID_NOT_STORED]);
- assert_eq!(sk_client.get(&ID_EXAMPLE), Some(SECRET_EXAMPLE));
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), Some(SECRET_EXAMPLE));
- assert_eq!(sk_client.get(&ID_NOT_STORED), None);
+ assert_eq!(sk_client.get(&ID_EXAMPLE).unwrap(), SECRET_EXAMPLE);
+ assert_eq!(sk_client.get(&ID_EXAMPLE_2).unwrap(), SECRET_EXAMPLE);
+ assert_entry_not_found(sk_client.get(&ID_NOT_STORED));
}
// Don't run deleteAll() on a secure device, as it might affect real secrets.
@@ -346,22 +421,22 @@
fn secretkeeper_store_delete_all(instance: String) {
let mut sk_client = SkClient::new(&instance);
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
- sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+ sk_client.store(&ID_EXAMPLE_2, &SECRET_EXAMPLE).unwrap();
sk_client.delete_all();
- assert_eq!(sk_client.get(&ID_EXAMPLE), None);
- assert_eq!(sk_client.get(&ID_EXAMPLE_2), None);
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE));
+ assert_entry_not_found(sk_client.get(&ID_EXAMPLE_2));
// Store a new secret (corresponding to an id).
- sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
// Get the restored secret.
- assert_eq!(sk_client.get(&ID_EXAMPLE), Some(SECRET_EXAMPLE));
+ assert_eq!(sk_client.get(&ID_EXAMPLE).unwrap(), SECRET_EXAMPLE);
// (Try to) Get the secret that was never stored
- assert_eq!(sk_client.get(&ID_NOT_STORED), None);
+ assert_entry_not_found(sk_client.get(&ID_NOT_STORED));
}
// This test checks that Secretkeeper uses the expected [`RequestSeqNum`] as aad while
@@ -369,9 +444,11 @@
// first few messages.
#[rdroidtest(get_instances())]
fn secret_management_replay_protection_seq_num(instance: String) {
- let sk_client = SkClient::new(&instance);
+ let dice_chain = make_explicit_owned_dice(/*Security version in a node */ 5);
+ let sealing_policy = sealing_policy(dice_chain.explicit_key_dice_chain().unwrap());
+ let sk_client = SkClient::with_identity(&instance, dice_chain);
// Construct encoded request packets for the test
- let (req_1, req_2, req_3) = construct_secret_management_requests();
+ let (req_1, req_2, req_3) = construct_secret_management_requests(sealing_policy);
// Lets now construct the seq_numbers(in request & expected in response)
let mut seq_a = SeqNum::new();
@@ -379,21 +456,21 @@
// Check first request/response is successful
let res = ResponsePacket::from_slice(
- &sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0),
+ &sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0).unwrap(),
)
.unwrap();
assert_eq!(res.response_type().unwrap(), ResponseType::Success);
// Check 2nd request/response is successful
let res = ResponsePacket::from_slice(
- &sk_client.secret_management_request_custom_aad(&req_2, &seq_1, &seq_1),
+ &sk_client.secret_management_request_custom_aad(&req_2, &seq_1, &seq_1).unwrap(),
)
.unwrap();
assert_eq!(res.response_type().unwrap(), ResponseType::Success);
// Check 3rd request/response is successful
let res = ResponsePacket::from_slice(
- &sk_client.secret_management_request_custom_aad(&req_3, &seq_2, &seq_2),
+ &sk_client.secret_management_request_custom_aad(&req_3, &seq_2, &seq_2).unwrap(),
)
.unwrap();
assert_eq!(res.response_type().unwrap(), ResponseType::Success);
@@ -403,17 +480,19 @@
// for new sessions.
#[rdroidtest(get_instances())]
fn secret_management_replay_protection_seq_num_per_session(instance: String) {
- let sk_client = SkClient::new(&instance);
+ let dice_chain = make_explicit_owned_dice(/*Security version in a node */ 5);
+ let sealing_policy = sealing_policy(dice_chain.explicit_key_dice_chain().unwrap());
+ let sk_client = SkClient::with_identity(&instance, dice_chain);
// Construct encoded request packets for the test
- let (req_1, _, _) = construct_secret_management_requests();
+ let (req_1, _, _) = construct_secret_management_requests(sealing_policy);
// Lets now construct the seq_number (in request & expected in response)
let mut seq_a = SeqNum::new();
let seq_0 = seq_a.get_then_increment().unwrap();
// Check first request/response is successful
let res = ResponsePacket::from_slice(
- &sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0),
+ &sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0).unwrap(),
)
.unwrap();
assert_eq!(res.response_type().unwrap(), ResponseType::Success);
@@ -422,7 +501,7 @@
let sk_client_diff = SkClient::new(&instance);
// Check first request/response is with seq_0 is successful
let res = ResponsePacket::from_slice(
- &sk_client_diff.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0),
+ &sk_client_diff.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0).unwrap(),
)
.unwrap();
assert_eq!(res.response_type().unwrap(), ResponseType::Success);
@@ -431,33 +510,58 @@
// This test checks that Secretkeeper rejects requests with out of order [`RequestSeqNum`]
// TODO(b/317416663): This test fails, when HAL is not present in the device. Refactor to fix this.
#[rdroidtest(get_instances())]
-#[ignore]
fn secret_management_replay_protection_out_of_seq_req_not_accepted(instance: String) {
- let sk_client = SkClient::new(&instance);
+ let dice_chain = make_explicit_owned_dice(/*Security version in a node */ 5);
+ let sealing_policy = sealing_policy(dice_chain.explicit_key_dice_chain().unwrap());
+ let sk_client = SkClient::with_identity(&instance, dice_chain);
// Construct encoded request packets for the test
- let (req_1, req_2, _) = construct_secret_management_requests();
+ let (req_1, req_2, _) = construct_secret_management_requests(sealing_policy);
// Lets now construct the seq_numbers(in request & expected in response)
let mut seq_a = SeqNum::new();
let [seq_0, seq_1, seq_2] = std::array::from_fn(|_| seq_a.get_then_increment().unwrap());
// Assume First request/response is successful
- sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0);
+ sk_client.secret_management_request_custom_aad(&req_1, &seq_0, &seq_0).unwrap();
// Check 2nd request/response with skipped seq_num in request is a binder error
- // This should panic!
- sk_client.secret_management_request_custom_aad(&req_2, /*Skipping seq_1*/ &seq_2, &seq_1);
+ let res = sk_client
+ .secret_management_request_custom_aad(&req_2, /*Skipping seq_1*/ &seq_2, &seq_1);
+ let err = res.expect_err("Out of Seq messages accepted!");
+ // Incorrect sequence numbers lead to failed decryption. The resultant error should be
+ // thrown in clear text & wrapped in Binder errors.
+ assert!(matches!(err, Error::InfraError(secretkeeper_client::Error::BinderStatus(_e))));
}
-fn construct_secret_management_requests() -> (Vec<u8>, Vec<u8>, Vec<u8>) {
+// This test checks DICE policy based access control of Secretkeeper.
+#[rdroidtest(get_instances())]
+fn secret_management_policy_gate(instance: String) {
+ let dice_chain = make_explicit_owned_dice(/*Security version in a node */ 100);
+ let mut sk_client = SkClient::with_identity(&instance, dice_chain);
+ sk_client.store(&ID_EXAMPLE, &SECRET_EXAMPLE).unwrap();
+
+ // Start a session with higher security_version & get the stored secret.
+ let dice_chain_upgraded = make_explicit_owned_dice(/*Security version in a node */ 101);
+ let mut sk_client_upgraded = SkClient::with_identity(&instance, dice_chain_upgraded);
+ assert_eq!(sk_client_upgraded.get(&ID_EXAMPLE).unwrap(), SECRET_EXAMPLE);
+
+ // Start a session with lower security_version (This should be denied access to the secret).
+ let dice_chain_downgraded = make_explicit_owned_dice(/*Security version in a node */ 99);
+ let mut sk_client_downgraded = SkClient::with_identity(&instance, dice_chain_downgraded);
+ assert!(matches!(
+ sk_client_downgraded.get(&ID_EXAMPLE).unwrap_err(),
+ Error::SecretkeeperError(SecretkeeperError::DicePolicyError)
+ ));
+}
+
+// Helper method that constructs 3 SecretManagement requests. Callers would usually not care about
+// what each of the request concretely is.
+fn construct_secret_management_requests(sealing_policy: Vec<u8>) -> (Vec<u8>, Vec<u8>, Vec<u8>) {
let version_request = GetVersionRequest {};
let version_request = version_request.serialize_to_packet().to_vec().unwrap();
- let store_request = StoreSecretRequest {
- id: ID_EXAMPLE,
- secret: SECRET_EXAMPLE,
- sealing_policy: HYPOTHETICAL_DICE_POLICY.to_vec(),
- };
+ let store_request =
+ StoreSecretRequest { id: ID_EXAMPLE, secret: SECRET_EXAMPLE, sealing_policy };
let store_request = store_request.serialize_to_packet().to_vec().unwrap();
let get_request = GetSecretRequest { id: ID_EXAMPLE, updated_sealing_policy: None };
let get_request = get_request.serialize_to_packet().to_vec().unwrap();
diff --git a/security/secretkeeper/default/Android.bp b/security/secretkeeper/default/Android.bp
index 1d75c74..d8ccb63 100644
--- a/security/secretkeeper/default/Android.bp
+++ b/security/secretkeeper/default/Android.bp
@@ -34,6 +34,7 @@
"libauthgraph_core",
"libauthgraph_hal",
"libbinder_rs",
+ "libcoset",
"liblog_rust",
"libsecretkeeper_core_nostd",
"libsecretkeeper_comm_nostd",
diff --git a/security/secretkeeper/default/src/lib.rs b/security/secretkeeper/default/src/lib.rs
index 412ad45..eb7817c 100644
--- a/security/secretkeeper/default/src/lib.rs
+++ b/security/secretkeeper/default/src/lib.rs
@@ -53,8 +53,12 @@
let mut crypto_impls = boring::crypto_trait_impls();
let storage_impl = Box::new(store::InMemoryStore::default());
let sk_ta = Rc::new(RefCell::new(
- SecretkeeperTa::new(&mut crypto_impls, storage_impl)
- .expect("Failed to create local Secretkeeper TA"),
+ SecretkeeperTa::new(
+ &mut crypto_impls,
+ storage_impl,
+ coset::iana::EllipticCurve::Ed25519,
+ )
+ .expect("Failed to create local Secretkeeper TA"),
));
let mut ag_ta = AuthGraphTa::new(
AuthGraphParticipant::new(crypto_impls, sk_ta.clone(), MAX_OPENED_SESSIONS)
diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
index 1ea1237..f09a26b 100644
--- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
@@ -69,18 +69,9 @@
std::shared_ptr<IWifiStaIface> wifi_sta_iface_;
- // Checks if the MdnsOffloadManagerService is installed.
- bool isMdnsOffloadServicePresent() {
- int status =
- // --query-flags MATCH_SYSTEM_ONLY(1048576) will only return matched service
- // installed on system or system_ext partition. The MdnsOffloadManagerService should
- // be installed on system_ext partition.
- // NOLINTNEXTLINE(cert-env33-c)
- system("pm query-services --query-flags 1048576"
- " com.android.tv.mdnsoffloadmanager/"
- "com.android.tv.mdnsoffloadmanager.MdnsOffloadManagerService"
- " | egrep -q mdnsoffloadmanager");
- return status == 0;
+ // Checks if the mDNS Offload is supported by any NIC.
+ bool isMdnsOffloadPresentInNIC() {
+ return testing::deviceSupportsFeature("android.hardware.mdns_offload");
}
// Detected panel TV device by using ro.oem.key1 property.
@@ -146,7 +137,7 @@
TEST_P(WifiStaIfaceAidlTest, CheckApfIsSupported) {
// Flat panel TV devices that support MDNS offload do not have to implement APF if the WiFi
// chipset does not have sufficient RAM to do so.
- if (isPanelTvDevice() && isMdnsOffloadServicePresent()) {
+ if (isPanelTvDevice() && isMdnsOffloadPresentInNIC()) {
GTEST_SKIP() << "Panel TV supports mDNS offload. It is not required to support APF";
}
int vendor_api_level = property_get_int32("ro.vendor.api_level", 0);