Merge "Revert^2 "Support PER_DISPLAY_BRIGHTNESS."" into main
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index f548903..372e38a 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -75,6 +75,10 @@
}
decltype(mAlsaDeviceProxies) alsaDeviceProxies;
for (const auto& device : getDeviceProfiles()) {
+ if ((device.direction == PCM_OUT && mIsInput) ||
+ (device.direction == PCM_IN && !mIsInput)) {
+ continue;
+ }
alsa::DeviceProxy proxy;
if (device.isExternal) {
// Always ask alsa configure as required since the configuration should be supported
@@ -92,6 +96,9 @@
}
alsaDeviceProxies.push_back(std::move(proxy));
}
+ if (alsaDeviceProxies.empty()) {
+ return ::android::NO_INIT;
+ }
mAlsaDeviceProxies = std::move(alsaDeviceProxies);
return ::android::OK;
}
diff --git a/audio/aidl/default/include/core-impl/StreamPrimary.h b/audio/aidl/default/include/core-impl/StreamPrimary.h
index 8d5c57d..600c377 100644
--- a/audio/aidl/default/include/core-impl/StreamPrimary.h
+++ b/audio/aidl/default/include/core-impl/StreamPrimary.h
@@ -25,7 +25,8 @@
class StreamPrimary : public StreamAlsa {
public:
- StreamPrimary(StreamContext* context, const Metadata& metadata);
+ StreamPrimary(StreamContext* context, const Metadata& metadata,
+ const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices);
::android::status_t start() override;
::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
@@ -39,6 +40,11 @@
int64_t mStartTimeNs = 0;
long mFramesSinceStart = 0;
bool mSkipNextTransfer = false;
+
+ private:
+ static std::pair<int, int> getCardAndDeviceId(
+ const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices);
+ const std::pair<int, int> mCardAndDeviceId;
};
class StreamInPrimary final : public StreamIn, public StreamSwitcher, public StreamInHwGainHelper {
diff --git a/audio/aidl/default/primary/StreamPrimary.cpp b/audio/aidl/default/primary/StreamPrimary.cpp
index 498f029..801bbb8 100644
--- a/audio/aidl/default/primary/StreamPrimary.cpp
+++ b/audio/aidl/default/primary/StreamPrimary.cpp
@@ -15,7 +15,11 @@
*/
#define LOG_TAG "AHAL_StreamPrimary"
+
+#include <cstdio>
+
#include <android-base/logging.h>
+#include <android-base/parseint.h>
#include <android-base/properties.h>
#include <audio_utils/clock.h>
#include <error/Result.h>
@@ -28,6 +32,7 @@
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
+using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioDeviceDescription;
using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioOffloadInfo;
@@ -36,9 +41,15 @@
namespace aidl::android::hardware::audio::core {
-StreamPrimary::StreamPrimary(StreamContext* context, const Metadata& metadata)
+const static constexpr std::pair<int, int> kDefaultCardAndDeviceId = {
+ primary::PrimaryMixer::kAlsaCard, primary::PrimaryMixer::kAlsaDevice};
+
+StreamPrimary::StreamPrimary(
+ StreamContext* context, const Metadata& metadata,
+ const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
: StreamAlsa(context, metadata, 3 /*readWriteRetries*/),
- mIsAsynchronous(!!getContext().getAsyncCallback()) {
+ mIsAsynchronous(!!getContext().getAsyncCallback()),
+ mCardAndDeviceId(getCardAndDeviceId(devices)) {
context->startStreamDataProcessor();
}
@@ -92,17 +103,27 @@
}
std::vector<alsa::DeviceProfile> StreamPrimary::getDeviceProfiles() {
- static const std::vector<alsa::DeviceProfile> kBuiltInSource{
- alsa::DeviceProfile{.card = primary::PrimaryMixer::kAlsaCard,
- .device = primary::PrimaryMixer::kAlsaDevice,
- .direction = PCM_IN,
+ return {alsa::DeviceProfile{.card = mCardAndDeviceId.first,
+ .device = mCardAndDeviceId.second,
+ .direction = mIsInput ? PCM_IN : PCM_OUT,
.isExternal = false}};
- static const std::vector<alsa::DeviceProfile> kBuiltInSink{
- alsa::DeviceProfile{.card = primary::PrimaryMixer::kAlsaCard,
- .device = primary::PrimaryMixer::kAlsaDevice,
- .direction = PCM_OUT,
- .isExternal = false}};
- return mIsInput ? kBuiltInSource : kBuiltInSink;
+}
+
+std::pair<int, int> StreamPrimary::getCardAndDeviceId(const std::vector<AudioDevice>& devices) {
+ if (devices.empty() || devices[0].address.getTag() != AudioDeviceAddress::id) {
+ return kDefaultCardAndDeviceId;
+ }
+ std::string deviceAddress = devices[0].address.get<AudioDeviceAddress::id>();
+ std::pair<int, int> cardAndDeviceId;
+ if (const size_t suffixPos = deviceAddress.rfind("CARD_");
+ suffixPos == std::string::npos ||
+ sscanf(deviceAddress.c_str() + suffixPos, "CARD_%d_DEV_%d", &cardAndDeviceId.first,
+ &cardAndDeviceId.second) != 2) {
+ return kDefaultCardAndDeviceId;
+ }
+ LOG(DEBUG) << __func__ << ": parsed with card id " << cardAndDeviceId.first << ", device id "
+ << cardAndDeviceId.second;
+ return cardAndDeviceId;
}
StreamInPrimary::StreamInPrimary(StreamContext&& context, const SinkMetadata& sinkMetadata,
@@ -144,7 +165,7 @@
new InnerStreamWrapper<StreamStub>(context, metadata));
}
return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamPrimary>(context, metadata));
+ new InnerStreamWrapper<StreamPrimary>(context, metadata, devices));
}
ndk::ScopedAStatus StreamInPrimary::getHwGain(std::vector<float>* _aidl_return) {
@@ -215,7 +236,7 @@
new InnerStreamWrapper<StreamStub>(context, metadata));
}
return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamPrimary>(context, metadata));
+ new InnerStreamWrapper<StreamPrimary>(context, metadata, devices));
}
ndk::ScopedAStatus StreamOutPrimary::getHwVolume(std::vector<float>* _aidl_return) {
diff --git a/audio/aidl/vts/Android.bp b/audio/aidl/vts/Android.bp
index cbd42c0..85d400e 100644
--- a/audio/aidl/vts/Android.bp
+++ b/audio/aidl/vts/Android.bp
@@ -136,6 +136,9 @@
name: "VtsHalHapticGeneratorTargetTest",
defaults: ["VtsHalAudioEffectTargetTestDefaults"],
srcs: ["VtsHalHapticGeneratorTargetTest.cpp"],
+ shared_libs: [
+ "libaudioutils",
+ ],
}
cc_test {
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 0fa170f..93589e2 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -454,6 +454,17 @@
mOutputSamples = common.output.frameCount * mOutputFrameSize / sizeof(float);
}
+ void generateInput(std::vector<float>& input, float inputFrequency, float samplingFrequency,
+ size_t inputSize = 0) {
+ if (inputSize == 0 || inputSize > input.size()) {
+ inputSize = input.size();
+ }
+
+ for (size_t i = 0; i < inputSize; i++) {
+ input[i] = sin(2 * M_PI * inputFrequency * i / samplingFrequency);
+ }
+ }
+
bool mIsSpatializer;
Descriptor mDescriptor;
size_t mInputFrameSize, mOutputFrameSize;
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index bbc4caf..2bf70c7 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -2975,15 +2975,15 @@
// The five methods below is intended to be called after the worker
// thread has joined, thus no extra synchronization is needed.
- bool hasObservablePositionIncrease() const { return mObservablePositionIncrease; }
- bool hasObservableRetrogradePosition() const { return mRetrogradeObservablePosition; }
+ bool hasObservablePositionIncrease() const { return mObservable.hasPositionIncrease; }
+ bool hasObservableRetrogradePosition() const { return mObservable.hasRetrogradePosition; }
bool hasHardwarePositionIncrease() const {
// For non-MMap, always return true to pass the validation.
- return mIsMmap ? mHardwarePositionIncrease : true;
+ return mIsMmap ? mHardware.hasPositionIncrease : true;
}
bool hasHardwareRetrogradePosition() const {
// For non-MMap, always return false to pass the validation.
- return mIsMmap ? mRetrogradeHardwarePosition : false;
+ return mIsMmap ? mHardware.hasRetrogradePosition : false;
}
std::string getUnexpectedStateTransition() const { return mUnexpectedTransition; }
@@ -3011,25 +3011,9 @@
}
bool interceptRawReply(const StreamDescriptor::Reply&) override { return false; }
bool processValidReply(const StreamDescriptor::Reply& reply) override {
- if (reply.observable.frames != StreamDescriptor::Position::UNKNOWN) {
- if (mPreviousObservableFrames.has_value()) {
- if (reply.observable.frames > mPreviousObservableFrames.value()) {
- mObservablePositionIncrease = true;
- } else if (reply.observable.frames < mPreviousObservableFrames.value()) {
- mRetrogradeObservablePosition = true;
- }
- }
- mPreviousObservableFrames = reply.observable.frames;
- }
+ mObservable.update(reply.observable.frames);
if (mIsMmap) {
- if (mPreviousHardwareFrames.has_value()) {
- if (reply.hardware.frames > mPreviousHardwareFrames.value()) {
- mHardwarePositionIncrease = true;
- } else if (reply.hardware.frames < mPreviousHardwareFrames.value()) {
- mRetrogradeHardwarePosition = true;
- }
- }
- mPreviousHardwareFrames = reply.hardware.frames;
+ mHardware.update(reply.hardware.frames);
}
auto expected = mCommands->getExpectedStates();
@@ -3054,16 +3038,30 @@
}
protected:
+ struct FramesCounter {
+ std::optional<int64_t> previous;
+ bool hasPositionIncrease = false;
+ bool hasRetrogradePosition = false;
+
+ void update(int64_t position) {
+ if (position == StreamDescriptor::Position::UNKNOWN) return;
+ if (previous.has_value()) {
+ if (position > previous.value()) {
+ hasPositionIncrease = true;
+ } else if (position < previous.value()) {
+ hasRetrogradePosition = true;
+ }
+ }
+ previous = position;
+ }
+ };
+
std::shared_ptr<StateSequence> mCommands;
const size_t mFrameSizeBytes;
const bool mIsMmap;
std::optional<StreamDescriptor::State> mPreviousState;
- std::optional<int64_t> mPreviousObservableFrames;
- bool mObservablePositionIncrease = false;
- bool mRetrogradeObservablePosition = false;
- std::optional<int64_t> mPreviousHardwareFrames;
- bool mHardwarePositionIncrease = false;
- bool mRetrogradeHardwarePosition = false;
+ FramesCounter mObservable;
+ FramesCounter mHardware;
std::string mUnexpectedTransition;
};
@@ -3074,8 +3072,8 @@
static bool skipStreamIoTestForMixPortConfig(const AudioPortConfig& portConfig) {
return (portConfig.flags.value().getTag() == AudioIoFlags::input &&
isAnyBitPositionFlagSet(portConfig.flags.value().template get<AudioIoFlags::input>(),
- {AudioInputFlags::VOIP_TX, AudioInputFlags::HW_HOTWORD,
- AudioInputFlags::HOTWORD_TAP})) ||
+ {AudioInputFlags::MMAP_NOIRQ, AudioInputFlags::VOIP_TX,
+ AudioInputFlags::HW_HOTWORD, AudioInputFlags::HOTWORD_TAP})) ||
(portConfig.flags.value().getTag() == AudioIoFlags::output &&
isAnyBitPositionFlagSet(
portConfig.flags.value().template get<AudioIoFlags::output>(),
@@ -3133,11 +3131,8 @@
EXPECT_FALSE(mWorker->hasError()) << mWorker->getError();
EXPECT_EQ("", mWorkerDriver->getUnexpectedStateTransition());
if (validatePosition) {
- if (IOTraits<Stream>::is_input &&
- !mStream->getStreamContext()->isMmapped() /*TODO(b/274456992) remove*/) {
- EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease());
- EXPECT_TRUE(mWorkerDriver->hasHardwarePositionIncrease());
- }
+ EXPECT_TRUE(mWorkerDriver->hasObservablePositionIncrease());
+ EXPECT_TRUE(mWorkerDriver->hasHardwarePositionIncrease());
EXPECT_FALSE(mWorkerDriver->hasObservableRetrogradePosition());
EXPECT_FALSE(mWorkerDriver->hasHardwareRetrogradePosition());
}
@@ -4099,8 +4094,7 @@
EXPECT_FALSE(worker.hasError()) << worker.getError();
EXPECT_EQ("", driver.getUnexpectedStateTransition());
if (ValidatePosition(stream.getDevice())) {
- if (validatePositionIncrease &&
- !stream.getStreamContext()->isMmapped() /*TODO(b/274456992) remove*/) {
+ if (validatePositionIncrease) {
EXPECT_TRUE(driver.hasObservablePositionIncrease());
EXPECT_TRUE(driver.hasHardwarePositionIncrease());
}
@@ -4134,8 +4128,7 @@
EXPECT_FALSE(worker.hasError()) << worker.getError();
EXPECT_EQ("", driver.getUnexpectedStateTransition());
if (ValidatePosition(stream.getDevice())) {
- if (validatePositionIncrease &&
- !stream.getStreamContext()->isMmapped() /*TODO(b/274456992) remove*/) {
+ if (validatePositionIncrease) {
EXPECT_TRUE(driver.hasObservablePositionIncrease());
EXPECT_TRUE(driver.hasHardwarePositionIncrease());
}
diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
index 154a5af..2802bf9 100644
--- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
@@ -21,11 +21,13 @@
#define LOG_TAG "VtsHalHapticGeneratorTargetTest"
#include <android-base/logging.h>
#include <android/binder_enums.h>
+#include <audio_utils/power.h>
#include "EffectHelper.h"
using namespace android;
+using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectTypeUuidHapticGenerator;
using aidl::android::hardware::audio::effect::HapticGenerator;
@@ -34,41 +36,15 @@
using aidl::android::hardware::audio::effect::Parameter;
using android::hardware::audio::common::testing::detail::TestExecutionTracer;
-/**
- * Here we focus on specific parameter checking, general IEffect interfaces testing performed in
- * VtsAudioEffectTargetTest.
- */
-enum ParamName {
- PARAM_INSTANCE_NAME,
- PARAM_HAPTIC_SCALE_ID,
- PARAM_HAPTIC_SCALE_VIBRATOR_SCALE,
- PARAM_HAPTIC_SCALE_SCALE_FACTOR,
- PARAM_HAPTIC_SCALE_ADAPTIVE_SCALE_FACTOR,
- PARAM_VIBRATION_INFORMATION_RESONANT_FREQUENCY,
- PARAM_VIBRATION_INFORMATION_Q_FACTOR,
- PARAM_VIBRATION_INFORMATION_MAX_AMPLITUDE,
-};
-using HapticGeneratorParamTestParam =
- std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int,
- HapticGenerator::VibratorScale, float, float, float, float, float>;
-
-/*
- * Testing parameter range, assuming the parameter supported by effect is in this range.
- * Parameter should be within the valid range defined in the documentation,
- * for any supported value test expects EX_NONE from IEffect.setParameter(),
- * otherwise expect EX_ILLEGAL_ARGUMENT.
- */
-
-// TODO : Update the test values once range/capability is updated by implementation
const int MIN_ID = std::numeric_limits<int>::min();
const int MAX_ID = std::numeric_limits<int>::max();
const float MIN_FLOAT = std::numeric_limits<float>::min();
const float MAX_FLOAT = std::numeric_limits<float>::max();
-const std::vector<int> kHapticScaleIdValues = {MIN_ID, 0, MAX_ID};
-const std::vector<HapticGenerator::VibratorScale> kVibratorScaleValues = {
+std::vector<HapticGenerator::VibratorScale> kScaleValues = {
ndk::enum_range<HapticGenerator::VibratorScale>().begin(),
ndk::enum_range<HapticGenerator::VibratorScale>().end()};
+
const std::vector<float> kScaleFactorValues = {HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR,
0.0f, 0.5f, 1.0f, MAX_FLOAT};
const std::vector<float> kAdaptiveScaleFactorValues = {
@@ -80,396 +56,392 @@
constexpr int HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION = 3;
-class HapticGeneratorParamTest : public ::testing::TestWithParam<HapticGeneratorParamTestParam>,
- public EffectHelper {
+static const std::vector<int32_t> kHapticOutputLayouts = {
+ AudioChannelLayout::LAYOUT_MONO_HAPTIC_A, AudioChannelLayout::LAYOUT_MONO_HAPTIC_AB,
+ AudioChannelLayout::LAYOUT_STEREO_HAPTIC_A, AudioChannelLayout::LAYOUT_STEREO_HAPTIC_AB};
+
+class HapticGeneratorHelper : public EffectHelper {
public:
- HapticGeneratorParamTest()
- : mParamHapticScaleId(std::get<PARAM_HAPTIC_SCALE_ID>(GetParam())),
- mParamVibratorScale(std::get<PARAM_HAPTIC_SCALE_VIBRATOR_SCALE>(GetParam())),
- mParamScaleFactor(std::get<PARAM_HAPTIC_SCALE_SCALE_FACTOR>(GetParam())),
- mParamAdaptiveScaleFactor(std::get<PARAM_HAPTIC_SCALE_ADAPTIVE_SCALE_FACTOR>(GetParam())),
- mParamResonantFrequency(
- std::get<PARAM_VIBRATION_INFORMATION_RESONANT_FREQUENCY>(GetParam())),
- mParamQFactor(std::get<PARAM_VIBRATION_INFORMATION_Q_FACTOR>(GetParam())),
- mParamMaxAmplitude(std::get<PARAM_VIBRATION_INFORMATION_MAX_AMPLITUDE>(GetParam())) {
- std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
- }
- void SetUp() override {
+ void SetUpHapticGenerator(int32_t chMask = AudioChannelLayout::CHANNEL_HAPTIC_A) {
ASSERT_NE(nullptr, mFactory);
ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
EXPECT_STATUS(EX_NONE, mEffect->getInterfaceVersion(&mEffectInterfaceVersion));
+ AudioChannelLayout layout =
+ AudioChannelLayout::make<AudioChannelLayout::layoutMask>(chMask);
+
Parameter::Common common = createParamCommon(
- 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
- kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */);
- IEffect::OpenEffectReturn ret;
+ 0 /* session */, 1 /* ioHandle */, kSamplingFrequency /* iSampleRate */,
+ kSamplingFrequency /* oSampleRate */, kFrameCount /* iFrameCount */,
+ kFrameCount /* oFrameCount */, layout, layout);
ASSERT_NO_FATAL_FAILURE(open(mEffect, common, std::nullopt, &ret, EX_NONE));
ASSERT_NE(nullptr, mEffect);
}
- void TearDown() override {
+ void TearDownHapticGenerator() {
ASSERT_NO_FATAL_FAILURE(close(mEffect));
ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
+ ret = IEffect::OpenEffectReturn{};
}
- static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
- std::shared_ptr<IFactory> mFactory;
- std::shared_ptr<IEffect> mEffect;
- Descriptor mDescriptor;
- int mEffectInterfaceVersion;
- int mParamHapticScaleId = 0;
- HapticGenerator::VibratorScale mParamVibratorScale = HapticGenerator::VibratorScale::MUTE;
- float mParamScaleFactor = HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR;
- float mParamAdaptiveScaleFactor = HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR;
- float mParamResonantFrequency = 0;
- float mParamQFactor = 0;
- float mParamMaxAmplitude = 0;
+ Parameter createScaleParam(const std::vector<HapticGenerator::HapticScale>& hapticScales) {
+ return Parameter::make<Parameter::specific>(
+ Parameter::Specific::make<Parameter::Specific::hapticGenerator>(
+ HapticGenerator::make<HapticGenerator::hapticScales>(hapticScales)));
+ }
- void SetAndGetHapticGeneratorParameters() {
- for (auto& it : mTags) {
- auto& tag = std::get<ParamTestEnum::PARAM_TEST_TAG>(it);
- auto& setHg = std::get<ParamTestEnum::PARAM_TEST_TARGET>(it);
+ Parameter createVibratorParam(HapticGenerator::VibratorInformation vibrationInfo) {
+ return Parameter::make<Parameter::specific>(
+ Parameter::Specific::make<Parameter::Specific::hapticGenerator>(
+ HapticGenerator::make<HapticGenerator::vibratorInfo>(vibrationInfo)));
+ }
- // set parameter
- Parameter expectParam;
- Parameter::Specific specific;
- specific.set<Parameter::Specific::hapticGenerator>(setHg);
- expectParam.set<Parameter::specific>(specific);
- EXPECT_STATUS(EX_NONE, mEffect->setParameter(expectParam)) << expectParam.toString();
-
+ void setAndVerifyParameter(Parameter hapticParameter, HapticGenerator::Tag tag,
+ binder_exception_t expected = EX_NONE) {
+ EXPECT_STATUS(expected, mEffect->setParameter(hapticParameter))
+ << hapticParameter.toString();
+ if (expected == EX_NONE) {
// get parameter
Parameter getParam;
- Parameter::Id id;
- HapticGenerator::Id hgId;
- hgId.set<HapticGenerator::Id::commonTag>(tag);
- id.set<Parameter::Id::hapticGeneratorTag>(hgId);
- EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
- EXPECT_EQ(expectParam, getParam) << expectParam.toString() << "\n"
- << getParam.toString();
+ auto second = Parameter::Id::make<Parameter::Id::hapticGeneratorTag>(
+ HapticGenerator::Id::make<HapticGenerator::Id::commonTag>(
+ HapticGenerator::Tag(tag)));
+ // If the set is successful, get param should match
+ EXPECT_STATUS(expected, mEffect->getParameter(second, &getParam));
+ EXPECT_EQ(hapticParameter, getParam) << "\nexpectedParam:" << hapticParameter.toString()
+ << "\ngetParam:" << getParam.toString();
}
}
- void addHapticScaleParam(int id, HapticGenerator::VibratorScale scale, float scaleFactor,
- float adaptiveScaleFactor) {
- HapticGenerator setHg;
- std::vector<HapticGenerator::HapticScale> hapticScales;
- if (mEffectInterfaceVersion >= HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION) {
- hapticScales = {{.id = id,
- .scale = scale,
- .scaleFactor = scaleFactor,
- .adaptiveScaleFactor = adaptiveScaleFactor}};
- } else {
- hapticScales = {{.id = id, .scale = scale}};
- }
- setHg.set<HapticGenerator::hapticScales>(hapticScales);
- mTags.push_back({HapticGenerator::hapticScales, setHg});
+ HapticGenerator::VibratorInformation createVibratorInfo(float resonantFrequency, float qFactor,
+ float amplitude) {
+ return HapticGenerator::VibratorInformation(resonantFrequency, qFactor, amplitude);
}
- void addVibratorInformationParam(float resonantFrequencyHz, float qFactor, float maxAmplitude) {
- HapticGenerator hg;
- HapticGenerator::VibratorInformation vibrationInfo = {
- .resonantFrequencyHz = resonantFrequencyHz,
- .qFactor = qFactor,
- .maxAmplitude = maxAmplitude};
- hg.set<HapticGenerator::vibratorInfo>(vibrationInfo);
- mTags.push_back({HapticGenerator::vibratorInfo, hg});
- }
-
- private:
- enum ParamTestEnum { PARAM_TEST_TAG, PARAM_TEST_TARGET };
- std::vector<std::tuple<HapticGenerator::Tag, HapticGenerator>> mTags;
-
- void CleanUp() { mTags.clear(); }
-};
-
-TEST_P(HapticGeneratorParamTest, SetAndGetHapticScale) {
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam(mParamHapticScaleId, mParamVibratorScale,
- mParamScaleFactor, mParamAdaptiveScaleFactor));
- SetAndGetHapticGeneratorParameters();
-}
-
-TEST_P(HapticGeneratorParamTest, SetAndGetMultipleHapticScales) {
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam(mParamHapticScaleId, mParamVibratorScale,
- mParamScaleFactor, mParamAdaptiveScaleFactor));
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam(mParamHapticScaleId, mParamVibratorScale,
- mParamScaleFactor, mParamAdaptiveScaleFactor));
- SetAndGetHapticGeneratorParameters();
-}
-
-TEST_P(HapticGeneratorParamTest, SetAndGetVibratorInformation) {
- EXPECT_NO_FATAL_FAILURE(addVibratorInformationParam(mParamResonantFrequency, mParamQFactor,
- mParamMaxAmplitude));
- SetAndGetHapticGeneratorParameters();
-}
-
-INSTANTIATE_TEST_SUITE_P(
- HapticGeneratorValidTest, HapticGeneratorParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
- testing::ValuesIn(kHapticScaleIdValues),
- testing::ValuesIn(kVibratorScaleValues),
- testing::ValuesIn(kScaleFactorValues),
- testing::ValuesIn(kAdaptiveScaleFactorValues),
- testing::ValuesIn(kResonantFrequencyValues),
- testing::ValuesIn(kQFactorValues), testing::ValuesIn(kMaxAmplitude)),
- [](const testing::TestParamInfo<HapticGeneratorParamTest::ParamType>& info) {
- auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
- std::string hapticScaleID = std::to_string(std::get<PARAM_HAPTIC_SCALE_ID>(info.param));
- std::string hapticScaleVibScale = std::to_string(
- static_cast<int>(std::get<PARAM_HAPTIC_SCALE_VIBRATOR_SCALE>(info.param)));
- std::string hapticScaleFactor =
- std::to_string(std::get<PARAM_HAPTIC_SCALE_SCALE_FACTOR>(info.param));
- std::string hapticAdaptiveScaleFactor =
- std::to_string(std::get<PARAM_HAPTIC_SCALE_ADAPTIVE_SCALE_FACTOR>(info.param));
- std::string resonantFrequency = std::to_string(
- std::get<PARAM_VIBRATION_INFORMATION_RESONANT_FREQUENCY>(info.param));
- std::string qFactor =
- std::to_string(std::get<PARAM_VIBRATION_INFORMATION_Q_FACTOR>(info.param));
- std::string maxAmplitude =
- std::to_string(std::get<PARAM_VIBRATION_INFORMATION_MAX_AMPLITUDE>(info.param));
- std::string name = getPrefix(descriptor) + "_hapticScaleId" + hapticScaleID +
- "_hapticScaleVibScale" + hapticScaleVibScale + "_hapticScaleFactor" +
- hapticScaleFactor + "_hapticAdaptiveScaleFactor" +
- hapticAdaptiveScaleFactor + "_resonantFrequency" +
- resonantFrequency + "_qFactor" + qFactor + "_maxAmplitude" +
- maxAmplitude;
- std::replace_if(
- name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
- return name;
- });
-
-INSTANTIATE_TEST_SUITE_P(
- HapticGeneratorInvalidTest, HapticGeneratorParamTest,
- ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
- testing::Values(MIN_ID),
- testing::Values(HapticGenerator::VibratorScale::NONE),
- testing::Values(HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR),
- testing::Values(HapticGenerator::HapticScale::UNDEFINED_SCALE_FACTOR),
- testing::Values(MIN_FLOAT), testing::Values(MIN_FLOAT),
- testing::Values(MIN_FLOAT)),
- [](const testing::TestParamInfo<HapticGeneratorParamTest::ParamType>& info) {
- auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
- std::string hapticScaleID = std::to_string(std::get<PARAM_HAPTIC_SCALE_ID>(info.param));
- std::string hapticScaleVibScale = std::to_string(
- static_cast<int>(std::get<PARAM_HAPTIC_SCALE_VIBRATOR_SCALE>(info.param)));
- std::string hapticScaleFactor =
- std::to_string(std::get<PARAM_HAPTIC_SCALE_SCALE_FACTOR>(info.param));
- std::string hapticAdaptiveScaleFactor =
- std::to_string(std::get<PARAM_HAPTIC_SCALE_ADAPTIVE_SCALE_FACTOR>(info.param));
- std::string resonantFrequency = std::to_string(
- std::get<PARAM_VIBRATION_INFORMATION_RESONANT_FREQUENCY>(info.param));
- std::string qFactor =
- std::to_string(std::get<PARAM_VIBRATION_INFORMATION_Q_FACTOR>(info.param));
- std::string maxAmplitude =
- std::to_string(std::get<PARAM_VIBRATION_INFORMATION_MAX_AMPLITUDE>(info.param));
- std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
- descriptor.common.name + "_UUID_" +
- toString(descriptor.common.id.uuid) + "_hapticScaleId" +
- hapticScaleID + "_hapticScaleVibScale" + hapticScaleVibScale +
- "_hapticScaleFactor" + hapticScaleFactor +
- "_hapticAdaptiveScaleFactor" + hapticAdaptiveScaleFactor +
- "_resonantFrequency" + resonantFrequency + "_qFactor" + qFactor +
- "_maxAmplitude" + maxAmplitude;
- std::replace_if(
- name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
- return name;
- });
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HapticGeneratorParamTest);
-
-// Test HapticScale[] hapticScales parameter
-using HapticGeneratorScalesTestParam = std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>>;
-class HapticGeneratorScalesTest : public ::testing::TestWithParam<HapticGeneratorScalesTestParam>,
- public EffectHelper {
- public:
- HapticGeneratorScalesTest() {
- std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
- }
-
- void SetUp() override {
- ASSERT_NE(nullptr, mFactory);
- ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
-
- Parameter::Common common = 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, &ret, EX_NONE));
- ASSERT_NE(nullptr, mEffect);
- }
-
- void TearDown() override {
- ASSERT_NO_FATAL_FAILURE(close(mEffect));
- ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
- CleanUp();
- }
-
- static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100;
+ static const long kFrameCount = 10000;
+ static constexpr int kSamplingFrequency = 44100;
+ static constexpr int kDefaultScaleID = 0;
+ static constexpr float kDefaultMaxAmp = 1;
+ static constexpr float kDefaultResonantFrequency = 150;
+ static constexpr float kDefaultQfactor = 8;
+ static constexpr HapticGenerator::VibratorScale kDefaultScale =
+ HapticGenerator::VibratorScale::NONE;
std::shared_ptr<IFactory> mFactory;
std::shared_ptr<IEffect> mEffect;
- Descriptor mDescriptor;
-
- void addHapticScaleParam(std::vector<HapticGenerator::HapticScale> scales) {
- mHapticScales.push_back(HapticGenerator::make<HapticGenerator::hapticScales>(scales));
- for (const auto& scale : scales) {
- expectMap.insert_or_assign(scale.id, scale.scale);
- }
- }
-
- void SetHapticScaleParameters() {
- // std::unordered_set<HapticGenerator::HapticScale> target;
- for (auto& it : mHapticScales) {
- Parameter::Specific specific =
- Parameter::Specific::make<Parameter::Specific::hapticGenerator>(it);
- Parameter param = Parameter::make<Parameter::specific>(specific);
- EXPECT_STATUS(EX_NONE, mEffect->setParameter(param)) << param.toString();
- }
- }
-
- void checkHapticScaleParameter() {
- // get parameter
- Parameter targetParam;
- HapticGenerator::Id hgId = HapticGenerator::Id::make<HapticGenerator::Id::commonTag>(
- HapticGenerator::hapticScales);
- Parameter::Id id = Parameter::Id::make<Parameter::Id::hapticGeneratorTag>(hgId);
- EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &targetParam));
- ASSERT_EQ(Parameter::specific, targetParam.getTag());
- Parameter::Specific specific = targetParam.get<Parameter::specific>();
- ASSERT_EQ(Parameter::Specific::hapticGenerator, specific.getTag());
- HapticGenerator hg = specific.get<Parameter::Specific::hapticGenerator>();
- ASSERT_EQ(HapticGenerator::hapticScales, hg.getTag());
- std::vector<HapticGenerator::HapticScale> scales = hg.get<HapticGenerator::hapticScales>();
- ASSERT_EQ(scales.size(), expectMap.size());
- for (const auto& scale : scales) {
- auto itor = expectMap.find(scale.id);
- ASSERT_NE(expectMap.end(), itor);
- ASSERT_EQ(scale.scale, itor->second);
- expectMap.erase(scale.id);
- }
- ASSERT_EQ(0ul, expectMap.size());
- }
-
- const static HapticGenerator::HapticScale kHapticScaleWithMinId;
- const static HapticGenerator::HapticScale kHapticScaleWithMinIdNew;
- const static HapticGenerator::HapticScale kHapticScale;
- const static HapticGenerator::HapticScale kHapticScaleNew;
- const static HapticGenerator::HapticScale kHapticScaleWithMaxId;
- const static HapticGenerator::HapticScale kHapticScaleWithMaxIdNew;
-
- std::vector<HapticGenerator> mHapticScales;
-
- void CleanUp() {
- mHapticScales.clear();
- expectMap.clear();
- }
-
- private:
- std::map<int /* trackID */, HapticGenerator::VibratorScale> expectMap;
+ IEffect::OpenEffectReturn ret;
+ Parameter mHapticSpecificParameter;
+ Parameter::Id mHapticIdParameter;
+ int mEffectInterfaceVersion;
};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScaleWithMinId = {
- .id = MIN_ID, .scale = HapticGenerator::VibratorScale::MUTE};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScaleWithMinIdNew = {
- .id = MIN_ID, .scale = HapticGenerator::VibratorScale::VERY_LOW};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScale = {
- .id = 1, .scale = HapticGenerator::VibratorScale::LOW};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScaleNew = {
- .id = 1, .scale = HapticGenerator::VibratorScale::NONE};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScaleWithMaxId = {
- .id = MAX_ID, .scale = HapticGenerator::VibratorScale::VERY_HIGH};
-const HapticGenerator::HapticScale HapticGeneratorScalesTest::kHapticScaleWithMaxIdNew = {
- .id = MAX_ID, .scale = HapticGenerator::VibratorScale::MUTE};
+/**
+ *Tests do the following:
+ * -Testing parameter range supported by the effect.
+ * -For any supported value test expects EX_NONE from IEffect.setParameter(),
+ * otherwise expect EX_ILLEGAL_ARGUMENT.
+ * -Validating the effect by comparing the output energies of the supported parameters.
+ **/
-TEST_P(HapticGeneratorScalesTest, SetAndUpdateOne) {
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScale}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleNew}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
+using EffectInstance = std::pair<std::shared_ptr<IFactory>, Descriptor>;
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMinIdNew}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
+class HapticGeneratorScaleParamTest : public ::testing::TestWithParam<EffectInstance>,
+ public HapticGeneratorHelper {
+ public:
+ HapticGeneratorScaleParamTest() { std::tie(mFactory, mDescriptor) = GetParam(); }
+ void SetUp() override { ASSERT_NO_FATAL_FAILURE(SetUpHapticGenerator()); }
+ void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownHapticGenerator()); }
+};
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMaxId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMaxIdNew}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
-
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
+TEST_P(HapticGeneratorScaleParamTest, SetAndGetScales) {
+ std::vector<HapticGenerator::HapticScale> hapticScales;
+ for (int i = 0; i < static_cast<int>(kScaleValues.size()); i++) {
+ hapticScales.push_back({.id = i, .scale = kScaleValues[i]});
+ }
+ ASSERT_NO_FATAL_FAILURE(
+ setAndVerifyParameter(createScaleParam(hapticScales), HapticGenerator::hapticScales));
}
-TEST_P(HapticGeneratorScalesTest, SetAndUpdateVector) {
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScale, kHapticScaleWithMaxId, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam(
- {kHapticScaleNew, kHapticScaleWithMaxIdNew, kHapticScaleWithMinIdNew}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
+TEST_P(HapticGeneratorScaleParamTest, SetAndGetScaleFactors) {
+ if (mEffectInterfaceVersion < HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION) {
+ GTEST_SKIP() << "Skipping HapticGenerator ScaleFactors test for effect version "
+ << std::to_string(mEffectInterfaceVersion);
+ }
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
+ std::vector<HapticGenerator::HapticScale> hapticScales;
+ for (int i = 0; i < static_cast<int>(kScaleFactorValues.size()); i++) {
+ hapticScales.push_back(
+ {.id = i, .scale = kScaleValues[0], .scaleFactor = kScaleFactorValues[i]});
+ }
+ ASSERT_NO_FATAL_FAILURE(
+ setAndVerifyParameter(createScaleParam(hapticScales), HapticGenerator::hapticScales));
}
-TEST_P(HapticGeneratorScalesTest, SetAndUpdateMultipleVector) {
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScale, kHapticScaleWithMaxId, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam(
- {kHapticScaleNew, kHapticScaleWithMaxIdNew, kHapticScaleWithMinIdNew}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScale, kHapticScaleWithMaxId, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
+TEST_P(HapticGeneratorScaleParamTest, SetAndGetAdaptiveScaleFactors) {
+ if (mEffectInterfaceVersion < HAPTIC_SCALE_FACTORS_EFFECT_MIN_VERSION) {
+ GTEST_SKIP() << "Skipping HapticGenerator AdaptiveScaleFactors test for effect version "
+ << std::to_string(mEffectInterfaceVersion);
+ }
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
-}
-
-TEST_P(HapticGeneratorScalesTest, SetOneAndAddMoreVector) {
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScale}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMaxId, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
-
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
-}
-
-TEST_P(HapticGeneratorScalesTest, SetMultipleAndAddOneVector) {
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScaleWithMaxId, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(addHapticScaleParam({kHapticScale}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
-
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
-}
-
-TEST_P(HapticGeneratorScalesTest, SetMultipleVectorRepeat) {
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScaleWithMaxId, kHapticScale, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScaleWithMaxId, kHapticScale, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
- EXPECT_NO_FATAL_FAILURE(
- addHapticScaleParam({kHapticScaleWithMaxId, kHapticScale, kHapticScaleWithMinId}));
- EXPECT_NO_FATAL_FAILURE(SetHapticScaleParameters());
-
- EXPECT_NO_FATAL_FAILURE(checkHapticScaleParameter());
+ std::vector<HapticGenerator::HapticScale> hapticScales;
+ for (int i = 0; i < static_cast<int>(kAdaptiveScaleFactorValues.size()); i++) {
+ hapticScales.push_back({.id = i,
+ .scale = kScaleValues[0],
+ .scaleFactor = kScaleFactorValues[3],
+ .adaptiveScaleFactor = kAdaptiveScaleFactorValues[i]});
+ }
+ ASSERT_NO_FATAL_FAILURE(
+ setAndVerifyParameter(createScaleParam(hapticScales), HapticGenerator::hapticScales));
}
INSTANTIATE_TEST_SUITE_P(
- HapticGeneratorScalesTest, HapticGeneratorScalesTest,
+ HapticGeneratorValidTest, HapticGeneratorScaleParamTest,
+ testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
+ [](const testing::TestParamInfo<HapticGeneratorScaleParamTest::ParamType>& info) {
+ auto descriptor = info.param;
+ return getPrefix(descriptor.second);
+ });
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HapticGeneratorScaleParamTest);
+
+enum VibratorParamName {
+ VIBRATOR_PARAM_INSTANCE,
+ VIBRATOR_PARAM_RESONANT_FREQUENCY,
+ VIBRATOR_PARAM_Q_FACTOR,
+ VIBRATOR_PARAM_MAX_AMPLITUDE,
+};
+
+using HapticGeneratorVibratorInfoTestParam = std::tuple<EffectInstance, float, float, float>;
+
+class HapticGeneratorVibratorInfoParamTest
+ : public ::testing::TestWithParam<HapticGeneratorVibratorInfoTestParam>,
+ public HapticGeneratorHelper {
+ public:
+ HapticGeneratorVibratorInfoParamTest()
+ : mParamResonantFrequency(std::get<VIBRATOR_PARAM_RESONANT_FREQUENCY>(GetParam())),
+ mParamQFactor(std::get<VIBRATOR_PARAM_Q_FACTOR>(GetParam())),
+ mParamMaxAmplitude(std::get<VIBRATOR_PARAM_MAX_AMPLITUDE>(GetParam())) {
+ std::tie(mFactory, mDescriptor) = std::get<VIBRATOR_PARAM_INSTANCE>(GetParam());
+ }
+ void SetUp() override { ASSERT_NO_FATAL_FAILURE(SetUpHapticGenerator()); }
+ void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownHapticGenerator()); }
+
+ float mParamResonantFrequency = kDefaultResonantFrequency;
+ float mParamQFactor = kDefaultQfactor;
+ float mParamMaxAmplitude = kDefaultMaxAmp;
+};
+
+TEST_P(HapticGeneratorVibratorInfoParamTest, SetAndGetVibratorInformation) {
+ auto vibratorInfo =
+ createVibratorInfo(mParamResonantFrequency, mParamQFactor, mParamMaxAmplitude);
+ if (isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo, mDescriptor)) {
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(createVibratorParam(vibratorInfo),
+ HapticGenerator::vibratorInfo));
+ } else {
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(createVibratorParam(vibratorInfo),
+ HapticGenerator::vibratorInfo,
+ EX_ILLEGAL_ARGUMENT));
+ }
+}
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HapticGeneratorVibratorInfoParamTest);
+
+INSTANTIATE_TEST_SUITE_P(
+ HapticGeneratorValidTest, HapticGeneratorVibratorInfoParamTest,
::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
- IFactory::descriptor, getEffectTypeUuidHapticGenerator()))),
- [](const testing::TestParamInfo<HapticGeneratorScalesTest::ParamType>& info) {
- auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
- std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
- descriptor.common.name + "_UUID_" +
- toString(descriptor.common.id.uuid);
+ IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
+ testing::ValuesIn(kResonantFrequencyValues),
+ testing::ValuesIn(kQFactorValues), testing::ValuesIn(kMaxAmplitude)),
+ [](const testing::TestParamInfo<HapticGeneratorVibratorInfoParamTest::ParamType>& info) {
+ auto descriptor = std::get<VIBRATOR_PARAM_INSTANCE>(info.param).second;
+ std::string resonantFrequency =
+ std::to_string(std::get<VIBRATOR_PARAM_RESONANT_FREQUENCY>(info.param));
+ std::string qFactor = std::to_string(std::get<VIBRATOR_PARAM_Q_FACTOR>(info.param));
+ std::string maxAmplitude =
+ std::to_string(std::get<VIBRATOR_PARAM_MAX_AMPLITUDE>(info.param));
+ std::string name = getPrefix(descriptor) + "_resonantFrequency" + resonantFrequency +
+ "_qFactor" + qFactor + "_maxAmplitude" + maxAmplitude;
std::replace_if(
name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
return name;
});
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HapticGeneratorScalesTest);
+
+/**
+ * The data tests do the following
+ * -Generate test input.
+ * -Check if the parameters are supported. Skip the unsupported parameter values.
+ * -Validate increase in haptic output energy energy.
+ **/
+
+enum DataTestParam { EFFECT_INSTANCE, LAYOUT };
+using HapticGeneratorDataTestParam = std::tuple<EffectInstance, int32_t>;
+
+class HapticGeneratorDataTest : public ::testing::TestWithParam<HapticGeneratorDataTestParam>,
+ public HapticGeneratorHelper {
+ public:
+ HapticGeneratorDataTest() : mChMask(std::get<LAYOUT>(GetParam())) {
+ std::tie(mFactory, mDescriptor) = std::get<EFFECT_INSTANCE>(GetParam());
+ mAudioChannelCount =
+ getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>(mChMask),
+ ~AudioChannelLayout::LAYOUT_HAPTIC_AB);
+ mHapticChannelCount =
+ getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>(mChMask),
+ AudioChannelLayout::LAYOUT_HAPTIC_AB);
+
+ mAudioSamples = kFrameCount * mAudioChannelCount;
+ mHapticSamples = kFrameCount * mHapticChannelCount;
+ mInput.resize(mHapticSamples + mAudioSamples, 0);
+ mOutput.resize(mHapticSamples + mAudioSamples, 0);
+ }
+
+ void SetUp() override { ASSERT_NO_FATAL_FAILURE(SetUpHapticGenerator(mChMask)); }
+ void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownHapticGenerator()); }
+
+ void generateSinePeriod() {
+ size_t cycleSize = kSamplingFrequency / kInputFrequency;
+ size_t startSize = 0;
+ while (startSize < mAudioSamples) {
+ for (size_t i = 0; i < cycleSize; i++) {
+ mInput[i + startSize] = sin(2 * M_PI * kInputFrequency * i / kSamplingFrequency);
+ }
+ startSize += mAudioSamples / 4;
+ }
+ }
+
+ void setBaseVibratorParam() {
+ auto vibratorInfo =
+ createVibratorInfo(kDefaultResonantFrequency, kDefaultQfactor, kDefaultMaxAmp);
+ if (isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo, mDescriptor)) {
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(createVibratorParam(vibratorInfo),
+ HapticGenerator::vibratorInfo));
+ } else {
+ GTEST_SKIP() << "Invalid base vibrator values, skipping the test\n";
+ }
+ }
+
+ void setBaseScaleParam() {
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(
+ createScaleParam({HapticGenerator::HapticScale(kDefaultScaleID, kDefaultScale)}),
+ HapticGenerator::hapticScales));
+ }
+
+ void validateIncreasingEnergy(HapticGenerator::Tag tag) {
+ float baseEnergy = -1;
+ for (auto param : mHapticParam) {
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(param, tag));
+ SCOPED_TRACE("Param: " + param.toString());
+ ASSERT_NO_FATAL_FAILURE(processAndWriteToOutput(mInput, mOutput, mEffect, &ret));
+ float hapticOutputEnergy = audio_utils_compute_energy_mono(
+ mOutput.data() + mAudioSamples, AUDIO_FORMAT_PCM_FLOAT, mHapticSamples);
+ EXPECT_GT(hapticOutputEnergy, baseEnergy);
+ baseEnergy = hapticOutputEnergy;
+ }
+ }
+
+ float findAbsMax(auto begin, auto end) {
+ return *std::max_element(begin, end,
+ [](float a, float b) { return std::abs(a) < std::abs(b); });
+ }
+
+ void findMaxAmplitude() {
+ for (float amp = 0.1; amp <= 1; amp += 0.1) {
+ auto vibratorInfo = createVibratorInfo(kDefaultResonantFrequency, kDefaultQfactor, amp);
+ if (!isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo,
+ mDescriptor)) {
+ continue;
+ }
+ ASSERT_NO_FATAL_FAILURE(setAndVerifyParameter(createVibratorParam(vibratorInfo),
+ HapticGenerator::vibratorInfo));
+ ASSERT_NO_FATAL_FAILURE(processAndWriteToOutput(mInput, mOutput, mEffect, &ret));
+ float outAmplitude = findAbsMax(mOutput.begin() + mAudioSamples, mOutput.end());
+ if (outAmplitude > mMaxAmplitude) {
+ mMaxAmplitude = outAmplitude;
+ } else {
+ break;
+ }
+ }
+ }
+
+ const int kInputFrequency = 1000;
+ float mMaxAmplitude = 0;
+ size_t mHapticSamples;
+ int32_t mChMask;
+ int32_t mAudioChannelCount;
+ int32_t mHapticChannelCount;
+ size_t mAudioSamples;
+ float mBaseHapticOutputEnergy;
+ std::vector<Parameter> mHapticParam;
+ // both input and output buffer includes audio and haptic samples
+ std::vector<float> mInput;
+ std::vector<float> mOutput;
+};
+
+TEST_P(HapticGeneratorDataTest, IncreasingVibratorScaleTest) {
+ generateInput(mInput, kInputFrequency, kSamplingFrequency, mAudioSamples);
+ ASSERT_NO_FATAL_FAILURE(setBaseVibratorParam());
+ for (HapticGenerator::VibratorScale scale : kScaleValues) {
+ mHapticParam.push_back(
+ createScaleParam({HapticGenerator::HapticScale(kDefaultScaleID, scale)}));
+ }
+ ASSERT_NO_FATAL_FAILURE(validateIncreasingEnergy(HapticGenerator::hapticScales));
+}
+
+TEST_P(HapticGeneratorDataTest, IncreasingMaxAmplitudeTest) {
+ generateInput(mInput, kInputFrequency, kSamplingFrequency, mAudioSamples);
+ ASSERT_NO_FATAL_FAILURE(setBaseScaleParam());
+ findMaxAmplitude();
+ std::vector<float> increasingAmplitudeValues = {0.25f * mMaxAmplitude, 0.5f * mMaxAmplitude,
+ 0.75f * mMaxAmplitude, mMaxAmplitude};
+ for (float amplitude : increasingAmplitudeValues) {
+ auto vibratorInfo =
+ createVibratorInfo(kDefaultResonantFrequency, kDefaultQfactor, amplitude);
+ if (!isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo, mDescriptor)) {
+ continue;
+ }
+ mHapticParam.push_back(createVibratorParam(vibratorInfo));
+ }
+ ASSERT_NO_FATAL_FAILURE(validateIncreasingEnergy(HapticGenerator::vibratorInfo));
+}
+
+TEST_P(HapticGeneratorDataTest, DescreasingResonantFrequencyTest) {
+ std::vector<float> descreasingResonantFrequency = {800, 600, 400, 200};
+ generateInput(mInput, kInputFrequency, kSamplingFrequency, mAudioSamples);
+ ASSERT_NO_FATAL_FAILURE(setBaseScaleParam());
+ for (float resonantFrequency : descreasingResonantFrequency) {
+ auto vibratorInfo = createVibratorInfo(resonantFrequency, kDefaultQfactor, kDefaultMaxAmp);
+ if (!isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo, mDescriptor)) {
+ continue;
+ }
+ mHapticParam.push_back(createVibratorParam(vibratorInfo));
+ }
+ ASSERT_NO_FATAL_FAILURE(validateIncreasingEnergy(HapticGenerator::vibratorInfo));
+}
+
+TEST_P(HapticGeneratorDataTest, IncreasingQfactorTest) {
+ std::vector<float> increasingQfactor = {16, 24, 32, 40};
+ generateSinePeriod();
+ ASSERT_NO_FATAL_FAILURE(setBaseScaleParam());
+ for (float qFactor : increasingQfactor) {
+ auto vibratorInfo = createVibratorInfo(kDefaultResonantFrequency, qFactor, kDefaultMaxAmp);
+ if (!isParameterValid<HapticGenerator, Range::hapticGenerator>(vibratorInfo, mDescriptor)) {
+ continue;
+ }
+ mHapticParam.push_back(createVibratorParam(vibratorInfo));
+ }
+ ASSERT_NO_FATAL_FAILURE(validateIncreasingEnergy(HapticGenerator::vibratorInfo));
+}
+
+INSTANTIATE_TEST_SUITE_P(
+ DataTest, HapticGeneratorDataTest,
+ ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
+ IFactory::descriptor, getEffectTypeUuidHapticGenerator())),
+ testing::ValuesIn(kHapticOutputLayouts)),
+ [](const testing::TestParamInfo<HapticGeneratorDataTest::ParamType>& info) {
+ auto descriptor = std::get<EFFECT_INSTANCE>(info.param).second;
+ std::string layout = "0x" + std::format("{:x}", std::get<LAYOUT>(info.param));
+ std::string name = getPrefix(descriptor) + "_layout_" + layout;
+ return name;
+ });
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(HapticGeneratorDataTest);
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
index ec69894..ad14a9b 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -49,6 +49,11 @@
class FakeVehicleHardware : public IVehicleHardware {
public:
+ // Supports Suspend_to_ram.
+ static constexpr int32_t SUPPORT_S2R = 0x1;
+ // Supports Suspend_to_disk.
+ static constexpr int32_t SUPPORT_S2D = 0x4;
+
using ValueResultType = VhalResult<VehiclePropValuePool::RecyclableType>;
FakeVehicleHardware();
@@ -117,6 +122,12 @@
bool UseOverrideConfigDir();
+ // Gets the config whether S2R or S2D is supported, must returns a bit flag made up of
+ // SUPPORT_S2R and SUPPORT_S2D, for example, 0x0 means no support, 0x5 means support both.
+ // The default implementation is reading this from system property:
+ // "ro.vendor.fake_vhal.ap_power_state_req.config".
+ int32_t getS2rS2dConfig();
+
private:
// Expose private methods to unit test.
friend class FakeVehicleHardwareTestHelper;
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
index e182f1c..80c9620 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -396,8 +396,7 @@
VehiclePropertyStore::TokenFunction tokenFunction = nullptr;
if (cfg.prop == toInt(VehicleProperty::AP_POWER_STATE_REQ)) {
- int config = GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0);
- cfg.configArray[0] = config;
+ cfg.configArray[0] = getS2rS2dConfig();
} else if (cfg.prop == OBD2_FREEZE_FRAME) {
tokenFunction = [](const VehiclePropValue& propValue) { return propValue.timestamp; };
}
@@ -426,6 +425,10 @@
});
}
+int32_t FakeVehicleHardware::getS2rS2dConfig() {
+ return GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0);
+}
+
std::vector<VehiclePropConfig> FakeVehicleHardware::getAllPropertyConfigs() const {
std::vector<VehiclePropConfig> allConfigs = mServerSidePropStore->getAllConfigs();
if (mAddExtraTestVendorConfigs) {
diff --git a/biometrics/common/aidl/Android.bp b/biometrics/common/aidl/Android.bp
index 246bcf2..8c9a357 100644
--- a/biometrics/common/aidl/Android.bp
+++ b/biometrics/common/aidl/Android.bp
@@ -22,6 +22,15 @@
cpp: {
enabled: false,
},
+ ndk: {
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
+ },
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
diff --git a/biometrics/common/config/Android.bp b/biometrics/common/config/Android.bp
index d38ffe8..b86aafa 100644
--- a/biometrics/common/config/Android.bp
+++ b/biometrics/common/config/Android.bp
@@ -22,7 +22,7 @@
// SPDX-license-identifier-Apache-2.0
name: "android.hardware.biometrics.common.config",
export_include_dirs: ["include"],
- vendor: true,
+ vendor_available: true,
srcs: [
"Config.cpp",
],
@@ -30,6 +30,10 @@
"libbase",
"libbinder_ndk",
],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
cc_test_host {
diff --git a/biometrics/common/thread/Android.bp b/biometrics/common/thread/Android.bp
index e7a7e4c..c1ebe3b 100644
--- a/biometrics/common/thread/Android.bp
+++ b/biometrics/common/thread/Android.bp
@@ -10,10 +10,14 @@
// SPDX-license-identifier-Apache-2.0
name: "android.hardware.biometrics.common.thread",
export_include_dirs: ["include"],
- vendor: true,
+ vendor_available: true,
srcs: [
"WorkerThread.cpp",
],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
cc_test_host {
diff --git a/biometrics/common/util/Android.bp b/biometrics/common/util/Android.bp
index 599c491..a0bd211 100644
--- a/biometrics/common/util/Android.bp
+++ b/biometrics/common/util/Android.bp
@@ -6,7 +6,7 @@
// SPDX-license-identifier-Apache-2.0
name: "android.hardware.biometrics.common.util",
export_include_dirs: ["include"],
- vendor: true,
+ vendor_available: true,
srcs: [
"CancellationSignal.cpp",
],
@@ -15,4 +15,8 @@
"libbinder_ndk",
"android.hardware.biometrics.common-V4-ndk",
],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
diff --git a/biometrics/fingerprint/aidl/Android.bp b/biometrics/fingerprint/aidl/Android.bp
index a395c01..9f9e723 100644
--- a/biometrics/fingerprint/aidl/Android.bp
+++ b/biometrics/fingerprint/aidl/Android.bp
@@ -11,7 +11,7 @@
name: "android.hardware.biometrics.fingerprint",
vendor_available: true,
srcs: [
- "android/hardware/biometrics/fingerprint/**/*.aidl",
+ "android/hardware/biometrics/fingerprint/*.aidl",
],
imports: [
"android.hardware.biometrics.common-V4",
@@ -25,6 +25,15 @@
cpp: {
enabled: false,
},
+ ndk: {
+ apex_available: [
+ "//apex_available:platform",
+ "//apex_available:anyapex",
+ ],
+ },
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
@@ -57,5 +66,34 @@
},
],
+ frozen: true,
+}
+
+aidl_interface {
+ name: "android.hardware.biometrics.fingerprint.virtualhal",
+ srcs: [
+ "android/hardware/biometrics/fingerprint/virtualhal/*.aidl",
+ ],
+ imports: [
+ "android.hardware.biometrics.common-V4",
+ "android.hardware.keymaster-V4",
+ "android.hardware.biometrics.fingerprint-V4",
+ ],
+ vendor_available: true,
+ unstable: true,
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ cpp: {
+ enabled: false,
+ },
+ ndk: {
+ apex_available: [
+ "com.android.hardware.biometrics.fingerprint.virtual",
+ "//apex_available:platform",
+ ],
+ },
+ },
frozen: false,
}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl
deleted file mode 100644
index c1dc51c..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-/* @hide */
-@VintfStability
-union AcquiredInfoAndVendorCode {
- android.hardware.biometrics.fingerprint.AcquiredInfo acquiredInfo = android.hardware.biometrics.fingerprint.AcquiredInfo.UNKNOWN;
- int vendorCode;
-}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl
deleted file mode 100644
index 173ac17..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-/* @hide */
-@VintfStability
-parcelable EnrollmentProgressStep {
- int durationMs;
- android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquiredInfoAndVendorCodes;
-}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl
deleted file mode 100644
index 33ae83c..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/IVirtualHal.aidl
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-/* @hide */
-@VintfStability
-interface IVirtualHal {
- oneway void setEnrollments(in int[] id);
- oneway void setEnrollmentHit(in int hit_id);
- oneway void setNextEnrollment(in android.hardware.biometrics.fingerprint.NextEnrollment next_enrollment);
- oneway void setAuthenticatorId(in long id);
- oneway void setChallenge(in long challenge);
- oneway void setOperationAuthenticateFails(in boolean fail);
- oneway void setOperationAuthenticateLatency(in int[] latencyMs);
- oneway void setOperationAuthenticateDuration(in int durationMs);
- oneway void setOperationAuthenticateError(in int error);
- oneway void setOperationAuthenticateAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired);
- oneway void setOperationEnrollError(in int error);
- oneway void setOperationEnrollLatency(in int[] latencyMs);
- oneway void setOperationDetectInteractionLatency(in int[] latencyMs);
- oneway void setOperationDetectInteractionError(in int error);
- oneway void setOperationDetectInteractionDuration(in int durationMs);
- oneway void setOperationDetectInteractionAcquired(in android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode[] acquired);
- oneway void setLockout(in boolean lockout);
- oneway void setLockoutEnable(in boolean enable);
- oneway void setLockoutTimedThreshold(in int threshold);
- oneway void setLockoutTimedDuration(in int durationMs);
- oneway void setLockoutPermanentThreshold(in int threshold);
- oneway void resetConfigurations();
- oneway void setType(in android.hardware.biometrics.fingerprint.FingerprintSensorType type);
- oneway void setSensorId(in int id);
- oneway void setSensorStrength(in android.hardware.biometrics.common.SensorStrength strength);
- oneway void setMaxEnrollmentPerUser(in int max);
- oneway void setSensorLocation(in android.hardware.biometrics.fingerprint.SensorLocation loc);
- oneway void setNavigationGuesture(in boolean v);
- oneway void setDetectInteraction(in boolean v);
- oneway void setDisplayTouch(in boolean v);
- oneway void setControlIllumination(in boolean v);
- const int STATUS_INVALID_PARAMETER = 1;
-}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl
deleted file mode 100644
index 75ed070..0000000
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/NextEnrollment.aidl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-// the interface (from the latest frozen version), the build system will
-// prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package android.hardware.biometrics.fingerprint;
-/* @hide */
-@VintfStability
-parcelable NextEnrollment {
- int id;
- android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps;
- boolean result = true;
-}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl
similarity index 93%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl
rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl
index c7be950..1fc7221 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfoAndVendorCode.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/AcquiredInfoAndVendorCode.aidl
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.fingerprint.virtualhal;
import android.hardware.biometrics.fingerprint.AcquiredInfo;
/**
* @hide
*/
-@VintfStability
union AcquiredInfoAndVendorCode {
/**
* Acquired info as specified in AcqauiredInfo.aidl
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl
similarity index 87%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl
rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl
index bf038f6..b0b2926 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/EnrollmentProgressStep.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/EnrollmentProgressStep.aidl
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.fingerprint.virtualhal;
-import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode;
+import android.hardware.biometrics.fingerprint.virtualhal.AcquiredInfoAndVendorCode;
/**
* @hide
*/
-@VintfStability
parcelable EnrollmentProgressStep {
/**
* The duration of the enrollment step in milli-seconds
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl
similarity index 96%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl
rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl
index cb9135e..5af84ed 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/IVirtualHal.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/IVirtualHal.aidl
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.fingerprint.virtualhal;
import android.hardware.biometrics.common.SensorStrength;
-import android.hardware.biometrics.fingerprint.AcquiredInfoAndVendorCode;
import android.hardware.biometrics.fingerprint.FingerprintSensorType;
-import android.hardware.biometrics.fingerprint.NextEnrollment;
+import android.hardware.biometrics.fingerprint.IFingerprint;
import android.hardware.biometrics.fingerprint.SensorLocation;
+import android.hardware.biometrics.fingerprint.virtualhal.AcquiredInfoAndVendorCode;
+import android.hardware.biometrics.fingerprint.virtualhal.NextEnrollment;
/**
* @hide
*/
-@VintfStability
-oneway interface IVirtualHal {
+interface IVirtualHal {
/**
* The operation failed due to invalid input parameters, the error messages should
* gives more details
@@ -315,4 +315,5 @@
void setDetectInteraction(in boolean v);
void setDisplayTouch(in boolean v);
void setControlIllumination(in boolean v);
+ IFingerprint getFingerprintHal();
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl
similarity index 85%
rename from biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl
rename to biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl
index 4b50850..2d704f1 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/NextEnrollment.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/NextEnrollment.aidl
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-package android.hardware.biometrics.fingerprint;
+package android.hardware.biometrics.fingerprint.virtualhal;
+
+import android.hardware.biometrics.fingerprint.virtualhal.EnrollmentProgressStep;
/**
* @hide
*/
-@VintfStability
parcelable NextEnrollment {
/**
* Identifier of the next enrollment if successful
@@ -31,7 +32,7 @@
* and sequence of acquired info codes to be generated by HAL.
* See EnrollmentProgressStep.aidl for more details
*/
- android.hardware.biometrics.fingerprint.EnrollmentProgressStep[] progressSteps;
+ EnrollmentProgressStep[] progressSteps;
/**
* Success or failure of the next enrollment
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md
new file mode 100644
index 0000000..eaf2336
--- /dev/null
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/virtualhal/README.md
@@ -0,0 +1,2 @@
+The aidl files in this directory are used only by fingerprint virtual hal
+which is controlled/configured via IVirtualHal interface
diff --git a/biometrics/fingerprint/aidl/default/Android.bp b/biometrics/fingerprint/aidl/default/Android.bp
index 9b72c87..faaa9c6 100644
--- a/biometrics/fingerprint/aidl/default/Android.bp
+++ b/biometrics/fingerprint/aidl/default/Android.bp
@@ -8,10 +8,9 @@
default_applicable_licenses: ["hardware_interfaces_license"],
}
-cc_binary {
- name: "android.hardware.biometrics.fingerprint-service.example",
- vendor: true,
- relative_install_path: "hw",
+cc_library_static {
+ name: "android.hardware.biometrics.fingerprint-service.lib",
+ vendor_available: true,
local_include_dirs: ["include"],
srcs: [
"FakeLockoutTracker.cpp",
@@ -30,22 +29,80 @@
"libbinder_ndk",
"liblog",
],
- static_libs: [
+ whole_static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
"libbase",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint.virtualhal-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.util",
"android.hardware.biometrics.common.config",
"android.hardware.keymaster-V4-ndk",
],
+ product_variables: {
+ debuggable: {
+ cflags: ["-DFPS_DEBUGGABLE"],
+ },
+ },
+ apex_available: [
+ "com.android.hardware.biometrics.fingerprint.virtual",
+ "//apex_available:platform",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.biometrics.fingerprint-service.example",
+ system_ext_specific: true,
+ relative_install_path: "hw",
+ local_include_dirs: ["include"],
+ srcs: [
+ ],
+ stl: "c++_static",
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ ],
+ whole_static_libs: [
+ "android.hardware.biometrics.fingerprint-service.lib",
+ ],
installable: false, // install APEX instead
product_variables: {
debuggable: {
cflags: ["-DFPS_DEBUGGABLE"],
},
},
+ apex_available: [
+ "com.android.hardware.biometrics.fingerprint.virtual",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.biometrics.fingerprint-service.default",
+ //system_ext_specific: true,
+ vendor: true,
+ relative_install_path: "hw",
+ init_rc: ["fingerprint-default.rc"],
+ vintf_fragments: ["fingerprint-default.xml"],
+ local_include_dirs: ["include"],
+ srcs: [
+ ],
+ stl: "c++_static",
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ ],
+ whole_static_libs: [
+ "android.hardware.biometrics.fingerprint-service.lib",
+ ],
+ product_variables: {
+ debuggable: {
+ cflags: ["-DFPS_DEBUGGABLE"],
+ },
+ },
+ apex_available: [
+ "//apex_available:platform",
+ ],
}
cc_test {
@@ -63,14 +120,13 @@
],
static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
"android.hardware.biometrics.common.config",
"android.hardware.biometrics.common.thread",
],
- vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
@@ -91,14 +147,13 @@
],
static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
"android.hardware.biometrics.common.config",
"android.hardware.biometrics.common.thread",
],
- vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
@@ -117,14 +172,13 @@
],
static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.config",
],
- vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
@@ -145,14 +199,13 @@
],
static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.config",
],
- vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
@@ -178,7 +231,8 @@
],
static_libs: [
"libandroid.hardware.biometrics.fingerprint.VirtualProps",
- "android.hardware.biometrics.fingerprint-V5-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
+ "android.hardware.biometrics.fingerprint.virtualhal-ndk",
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
@@ -190,7 +244,6 @@
cflags: ["-DFPS_DEBUGGABLE"],
},
},
- vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
@@ -198,39 +251,34 @@
sysprop_library {
name: "android.hardware.biometrics.fingerprint.VirtualProps",
srcs: ["fingerprint.sysprop"],
- property_owner: "Vendor",
- vendor: true,
+ property_owner: "Platform",
+ vendor_available: true,
+ apex_available: [
+ "com.android.hardware.biometrics.fingerprint.virtual",
+ "//apex_available:platform",
+ ],
}
prebuilt_etc {
- name: "fingerprint-example.rc",
- src: "fingerprint-example.rc",
- installable: false,
-}
-
-prebuilt_etc {
- name: "fingerprint-example.xml",
- src: "fingerprint-example.xml",
- sub_dir: "vintf",
+ name: "fingerprint-virtual.rc",
+ src: "fingerprint-virtual.rc",
installable: false,
}
apex {
name: "com.android.hardware.biometrics.fingerprint.virtual",
manifest: "apex_manifest.json",
- file_contexts: "apex_file_contexts",
+ file_contexts: ":com.android.biometrics.virtual.fingerprint-file_contexts",
key: "com.android.hardware.key",
certificate: ":com.android.hardware.certificate",
updatable: false,
- vendor: true,
+ system_ext_specific: true,
binaries: [
"android.hardware.biometrics.fingerprint-service.example",
],
prebuilts: [
// init_rc
- "fingerprint-example.rc",
- // vintf_fragment
- "fingerprint-example.xml",
+ "fingerprint-virtual.rc",
],
}
diff --git a/biometrics/fingerprint/aidl/default/VirtualHal.cpp b/biometrics/fingerprint/aidl/default/VirtualHal.cpp
index e107d2f..d161765 100644
--- a/biometrics/fingerprint/aidl/default/VirtualHal.cpp
+++ b/biometrics/fingerprint/aidl/default/VirtualHal.cpp
@@ -26,7 +26,7 @@
#define LOG_TAG "FingerprintVirtualHalAidl"
namespace aidl::android::hardware::biometrics::fingerprint {
-
+using AcquiredInfoAndVendorCode = virtualhal::AcquiredInfoAndVendorCode;
using Tag = AcquiredInfoAndVendorCode::Tag;
::ndk::ScopedAStatus VirtualHal::setEnrollments(const std::vector<int32_t>& enrollments) {
@@ -41,8 +41,7 @@
return ndk::ScopedAStatus::ok();
}
-::ndk::ScopedAStatus VirtualHal::setNextEnrollment(
- const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment& next_enrollment) {
+::ndk::ScopedAStatus VirtualHal::setNextEnrollment(const NextEnrollment& next_enrollment) {
Fingerprint::cfg().sourcedFromAidl();
std::ostringstream os;
os << next_enrollment.id << ":";
@@ -333,4 +332,10 @@
return ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus VirtualHal::getFingerprintHal(
+ std::shared_ptr<::aidl::android::hardware::biometrics::fingerprint::IFingerprint>* pFp) {
+ LOG(INFO) << " calling getFingerprintHal in VirtualHal.cpp";
+ *pFp = mFp;
+ return ndk::ScopedAStatus::ok();
+}
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt
index e69de29..8c02a68 100644
--- a/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt
+++ b/biometrics/fingerprint/aidl/default/api/android.hardware.biometrics.fingerprint.VirtualProps-current.txt
@@ -0,0 +1,178 @@
+props {
+ owner: Vendor
+ module: "android.fingerprint.virt.FingerprintHalProperties"
+ prop {
+ api_name: "authenticator_id"
+ type: Long
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.authenticator_id"
+ }
+ prop {
+ api_name: "challenge"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.challenge"
+ }
+ prop {
+ api_name: "control_illumination"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination"
+ }
+ prop {
+ api_name: "detect_interaction"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.detect_interaction"
+ }
+ prop {
+ api_name: "display_touch"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch"
+ }
+ prop {
+ api_name: "enrollment_hit"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.enrollment_hit"
+ }
+ prop {
+ api_name: "enrollments"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.enrollments"
+ }
+ prop {
+ api_name: "lockout"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout"
+ }
+ prop {
+ api_name: "lockout_enable"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout_enable"
+ }
+ prop {
+ api_name: "lockout_permanent_threshold"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout_permanent_threshold"
+ }
+ prop {
+ api_name: "lockout_timed_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_duration"
+ }
+ prop {
+ api_name: "lockout_timed_threshold"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_threshold"
+ }
+ prop {
+ api_name: "max_enrollments"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.max_enrollments"
+ }
+ prop {
+ api_name: "navigation_guesture"
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture"
+ }
+ prop {
+ api_name: "next_enrollment"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.next_enrollment"
+ }
+ prop {
+ api_name: "operation_authenticate_acquired"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired"
+ }
+ prop {
+ api_name: "operation_authenticate_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration"
+ }
+ prop {
+ api_name: "operation_authenticate_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_error"
+ }
+ prop {
+ api_name: "operation_authenticate_fails"
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails"
+ }
+ prop {
+ api_name: "operation_authenticate_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency"
+ }
+ prop {
+ api_name: "operation_detect_interaction_acquired"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired"
+ }
+ prop {
+ api_name: "operation_detect_interaction_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration"
+ }
+ prop {
+ api_name: "operation_detect_interaction_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error"
+ }
+ prop {
+ api_name: "operation_detect_interaction_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency"
+ }
+ prop {
+ api_name: "operation_enroll_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_error"
+ }
+ prop {
+ api_name: "operation_enroll_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.fingerprint.virtual.operation_enroll_latency"
+ }
+ prop {
+ api_name: "sensor_id"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_id"
+ }
+ prop {
+ api_name: "sensor_location"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_location"
+ }
+ prop {
+ api_name: "sensor_strength"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.sensor_strength"
+ }
+ prop {
+ api_name: "type"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.fingerprint.virtual.type"
+ enum_values: "default|rear|udfps|side"
+ }
+}
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.rc b/biometrics/fingerprint/aidl/default/fingerprint-default.rc
new file mode 100644
index 0000000..7e46bc1
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/fingerprint-default.rc
@@ -0,0 +1,7 @@
+service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.default default
+ class hal
+ user nobody
+ group nobody
+ interface aidl android.hardware.biometrics.fingerprint.IFingerprint/default
+ oneshot
+ disabled
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-default.xml b/biometrics/fingerprint/aidl/default/fingerprint-default.xml
new file mode 100644
index 0000000..d140459
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/fingerprint-default.xml
@@ -0,0 +1,10 @@
+<manifest version="1.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.biometrics.fingerprint</name>
+ <version>4</version>
+ <interface>
+ <name>IFingerprint</name>
+ <instance>default</instance>
+ </interface>
+ </hal>
+</manifest>
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.rc b/biometrics/fingerprint/aidl/default/fingerprint-example.rc
deleted file mode 100644
index da4ea45..0000000
--- a/biometrics/fingerprint/aidl/default/fingerprint-example.rc
+++ /dev/null
@@ -1,7 +0,0 @@
-service vendor.fingerprint-example /apex/com.android.hardware.biometrics.fingerprint.virtual/bin/hw/android.hardware.biometrics.fingerprint-service.example
- class hal
- user nobody
- group nobody
- interface aidl android.hardware.biometrics.fingerprint.IFingerprint/virtual
- oneshot
- disabled
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-example.xml b/biometrics/fingerprint/aidl/default/fingerprint-example.xml
deleted file mode 100644
index ee529e9..0000000
--- a/biometrics/fingerprint/aidl/default/fingerprint-example.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="aidl">
- <name>android.hardware.biometrics.fingerprint</name>
- <version>5</version>
- <fqname>IFingerprint/virtual</fqname>
- </hal>
-</manifest>
diff --git a/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc b/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc
new file mode 100644
index 0000000..5d1506c
--- /dev/null
+++ b/biometrics/fingerprint/aidl/default/fingerprint-virtual.rc
@@ -0,0 +1,7 @@
+service fingerprint-virtual /apex/com.android.hardware.biometrics.fingerprint.virtual/bin/hw/android.hardware.biometrics.fingerprint-service.example virtual
+ class hal
+ user nobody
+ group nobody
+ interface aidl android.hardware.biometrics.fingerprint.virtualhal.IVirtualHal/virtual
+ oneshot
+ disabled
diff --git a/biometrics/fingerprint/aidl/default/fingerprint.sysprop b/biometrics/fingerprint/aidl/default/fingerprint.sysprop
index 6a6c297..eb33432 100644
--- a/biometrics/fingerprint/aidl/default/fingerprint.sysprop
+++ b/biometrics/fingerprint/aidl/default/fingerprint.sysprop
@@ -7,7 +7,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.type"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
enum_values: "default|rear|udfps|side"
api_name: "type"
@@ -17,7 +17,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.enrollments"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "enrollments"
}
@@ -27,7 +27,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.enrollment_hit"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "enrollment_hit"
}
@@ -42,7 +42,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.next_enrollment"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "next_enrollment"
}
@@ -51,7 +51,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.authenticator_id"
type: Long
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "authenticator_id"
}
@@ -60,7 +60,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.challenge"
type: Long
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "challenge"
}
@@ -69,7 +69,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_authenticate_fails"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_fails"
}
@@ -82,7 +82,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_error"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_error"
}
@@ -91,7 +91,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_enroll_error"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_enroll_error"
}
@@ -104,7 +104,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_authenticate_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_latency"
}
@@ -114,7 +114,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_latency"
}
@@ -124,7 +124,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_enroll_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_enroll_latency"
}
@@ -134,7 +134,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_authenticate_duration"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_duration"
}
@@ -143,7 +143,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_authenticate_error"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_error"
}
@@ -153,7 +153,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.sensor_location"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "sensor_location"
}
@@ -162,7 +162,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_authenticate_acquired"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_acquired"
}
@@ -172,7 +172,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_duration"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_duration"
}
@@ -184,7 +184,7 @@
prop {
prop_name: "vendor.fingerprint.virtual.operation_detect_interaction_acquired"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_acquired"
}
@@ -193,7 +193,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.sensor_id"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "sensor_id"
}
@@ -203,7 +203,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.sensor_strength"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "sensor_strength"
}
@@ -213,7 +213,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.max_enrollments"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "max_enrollments"
}
@@ -222,7 +222,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.navigation_guesture"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "navigation_guesture"
}
@@ -231,7 +231,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.detect_interaction"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "detect_interaction"
}
@@ -240,7 +240,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.udfps.display_touch"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "display_touch"
}
@@ -249,7 +249,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.udfps.control_illumination"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "control_illumination"
}
@@ -258,7 +258,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.lockout"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout"
}
@@ -267,7 +267,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.lockout_enable"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_enable"
}
@@ -276,7 +276,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_threshold"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_timed_threshold"
}
@@ -285,7 +285,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.lockout_timed_duration"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_timed_duration"
}
@@ -294,7 +294,7 @@
prop {
prop_name: "persist.vendor.fingerprint.virtual.lockout_permanent_threshold"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_permanent_threshold"
}
diff --git a/biometrics/fingerprint/aidl/default/include/VirtualHal.h b/biometrics/fingerprint/aidl/default/include/VirtualHal.h
index e5f62fc..5488383 100644
--- a/biometrics/fingerprint/aidl/default/include/VirtualHal.h
+++ b/biometrics/fingerprint/aidl/default/include/VirtualHal.h
@@ -16,21 +16,21 @@
#pragma once
-#include <aidl/android/hardware/biometrics/fingerprint/BnVirtualHal.h>
+#include <aidl/android/hardware/biometrics/fingerprint/virtualhal/BnVirtualHal.h>
#include "Fingerprint.h"
namespace aidl::android::hardware::biometrics::fingerprint {
+using namespace virtualhal;
+
class VirtualHal : public BnVirtualHal {
public:
- VirtualHal(Fingerprint* fp) : mFp(fp) {}
+ VirtualHal(std::shared_ptr<Fingerprint> fp) : mFp(fp) {}
::ndk::ScopedAStatus setEnrollments(const std::vector<int32_t>& in_id) override;
::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override;
- ::ndk::ScopedAStatus setNextEnrollment(
- const ::aidl::android::hardware::biometrics::fingerprint::NextEnrollment&
- in_next_enrollment) override;
+ ::ndk::ScopedAStatus setNextEnrollment(const NextEnrollment& in_next_enrollment) override;
::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override;
::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override;
::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override;
@@ -67,12 +67,15 @@
::ndk::ScopedAStatus setDetectInteraction(bool in_v) override;
::ndk::ScopedAStatus setDisplayTouch(bool in_v) override;
::ndk::ScopedAStatus setControlIllumination(bool in_v) override;
+ ::ndk::ScopedAStatus getFingerprintHal(
+ std::shared_ptr<::aidl::android::hardware::biometrics::fingerprint::IFingerprint>*
+ _aidl_return);
private:
OptIntVec intVec2OptIntVec(const std::vector<int32_t>& intVec);
OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec);
::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency);
- Fingerprint* mFp;
+ std::shared_ptr<Fingerprint> mFp;
};
} // namespace aidl::android::hardware::biometrics::fingerprint
diff --git a/biometrics/fingerprint/aidl/default/main.cpp b/biometrics/fingerprint/aidl/default/main.cpp
index ba0c8ec..8ca44d6 100644
--- a/biometrics/fingerprint/aidl/default/main.cpp
+++ b/biometrics/fingerprint/aidl/default/main.cpp
@@ -24,21 +24,38 @@
using aidl::android::hardware::biometrics::fingerprint::Fingerprint;
using aidl::android::hardware::biometrics::fingerprint::VirtualHal;
-int main() {
- LOG(INFO) << "Fingerprint HAL started";
+int main(int argc, char** argv) {
+ if (argc < 2) {
+ LOG(ERROR) << "Missing argument -> exiting";
+ return EXIT_FAILURE;
+ }
+
+ LOG(INFO) << "Fingerprint HAL started: " << argv[1];
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Fingerprint> hal = ndk::SharedRefBase::make<Fingerprint>();
- auto binder = hal->asBinder();
-
- std::shared_ptr<VirtualHal> hal_ext = ndk::SharedRefBase::make<VirtualHal>(hal.get());
- auto binder_ext = hal_ext->asBinder();
+ std::shared_ptr<VirtualHal> hal_vhal = ndk::SharedRefBase::make<VirtualHal>(hal);
if (hal->connected()) {
- CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get()));
- const std::string instance = std::string(Fingerprint::descriptor) + "/virtual";
- binder_status_t status =
- AServiceManager_registerLazyService(binder.get(), instance.c_str());
- CHECK_EQ(status, STATUS_OK);
+ if (strcmp(argv[1], "default") == 0) {
+ const std::string instance = std::string(Fingerprint::descriptor) + "/default";
+ auto binder = hal->asBinder();
+ auto binder_ext = hal_vhal->asBinder();
+ CHECK(STATUS_OK == AIBinder_setExtension(binder.get(), binder_ext.get()));
+ binder_status_t status =
+ AServiceManager_registerLazyService(binder.get(), instance.c_str());
+ CHECK_EQ(status, STATUS_OK);
+ LOG(INFO) << "started IFingerprint/default";
+ } else if (strcmp(argv[1], "virtual") == 0) {
+ const std::string instance = std::string(VirtualHal::descriptor) + "/virtual";
+ auto binder = hal_vhal->asBinder();
+ binder_status_t status =
+ AServiceManager_registerLazyService(binder.get(), instance.c_str());
+ CHECK_EQ(status, STATUS_OK);
+ LOG(INFO) << "started IVirtualHal/virtual";
+ } else {
+ LOG(ERROR) << "Unexpected argument: " << argv[1];
+ return EXIT_FAILURE;
+ }
AServiceManager_forceLazyServicesPersist(true);
} else {
LOG(ERROR) << "Fingerprint HAL is not connected";
diff --git a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp
index 3fe0b2a..8ffc96b 100644
--- a/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp
+++ b/biometrics/fingerprint/aidl/default/tests/VirtualHalTest.cpp
@@ -35,7 +35,7 @@
protected:
void SetUp() override {
mHal = ndk::SharedRefBase::make<Fingerprint>();
- mVhal = ndk::SharedRefBase::make<VirtualHal>(mHal.get());
+ mVhal = ndk::SharedRefBase::make<VirtualHal>(mHal);
ASSERT_TRUE(mVhal != nullptr);
mHal->resetConfigToDefault();
}
diff --git a/biometrics/fingerprint/aidl/vts/Android.bp b/biometrics/fingerprint/aidl/vts/Android.bp
index fc32fe6..628f03f 100644
--- a/biometrics/fingerprint/aidl/vts/Android.bp
+++ b/biometrics/fingerprint/aidl/vts/Android.bp
@@ -16,8 +16,8 @@
],
srcs: ["VtsHalBiometricsFingerprintTargetTest.cpp"],
static_libs: [
- "android.hardware.biometrics.common-V3-ndk",
- "android.hardware.biometrics.fingerprint-V3-ndk",
+ "android.hardware.biometrics.common-V4-ndk",
+ "android.hardware.biometrics.fingerprint-V4-ndk",
"android.hardware.keymaster-V4-ndk",
],
shared_libs: [
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index ad8d4c8..e0e3a0e 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -288,77 +288,70 @@
}
TEST_P(CameraAidlTest, getSessionCharacteristics) {
- if (flags::feature_combination_query()) {
- std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+ std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
- for (const auto& name : cameraDeviceNames) {
- std::shared_ptr<ICameraDevice> device;
- ALOGI("getSessionCharacteristics: Testing camera device %s", name.c_str());
- ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device);
- ALOGI("getCameraDeviceInterface returns: %d:%d", ret.getExceptionCode(),
- ret.getServiceSpecificError());
- ASSERT_TRUE(ret.isOk());
- ASSERT_NE(device, nullptr);
+ for (const auto& name : cameraDeviceNames) {
+ std::shared_ptr<ICameraDevice> device;
+ ALOGI("getSessionCharacteristics: Testing camera device %s", name.c_str());
+ ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device);
+ ALOGI("getCameraDeviceInterface returns: %d:%d", ret.getExceptionCode(),
+ ret.getServiceSpecificError());
+ ASSERT_TRUE(ret.isOk());
+ ASSERT_NE(device, nullptr);
- int32_t interfaceVersion = -1;
- ret = device->getInterfaceVersion(&interfaceVersion);
- ASSERT_TRUE(ret.isOk());
- bool supportSessionCharacteristics =
- (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3);
- if (!supportSessionCharacteristics) {
- continue;
- }
-
- CameraMetadata meta;
- openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/,
- &device /*out*/);
-
- std::vector<AvailableStream> outputStreams;
- camera_metadata_t* staticMeta =
- reinterpret_cast<camera_metadata_t*>(meta.metadata.data());
- outputStreams.clear();
- ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
- ASSERT_NE(0u, outputStreams.size());
-
- AvailableStream sampleStream = outputStreams[0];
-
- int32_t streamId = 0;
- Stream stream = {streamId,
- StreamType::OUTPUT,
- sampleStream.width,
- sampleStream.height,
- static_cast<PixelFormat>(sampleStream.format),
- static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
- GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER),
- Dataspace::UNKNOWN,
- StreamRotation::ROTATION_0,
- std::string(),
- /*bufferSize*/ 0,
- /*groupId*/ -1,
- {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
- RequestAvailableDynamicRangeProfilesMap::
- ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
-
- std::vector<Stream> streams = {stream};
- StreamConfiguration config;
- createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config);
-
- CameraMetadata camera_chars;
- ret = device->getCameraCharacteristics(&camera_chars);
- ASSERT_TRUE(ret.isOk());
-
- CameraMetadata session_chars;
- ret = device->getSessionCharacteristics(config, &session_chars);
- ASSERT_TRUE(ret.isOk());
- verifySessionCharacteristics(session_chars, camera_chars);
-
- ret = mSession->close();
- mSession = nullptr;
- ASSERT_TRUE(ret.isOk());
+ int32_t interfaceVersion = -1;
+ ret = device->getInterfaceVersion(&interfaceVersion);
+ ASSERT_TRUE(ret.isOk());
+ bool supportSessionCharacteristics =
+ (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3);
+ if (!supportSessionCharacteristics) {
+ continue;
}
- } else {
- ALOGI("getSessionCharacteristics: Test skipped.\n");
- GTEST_SKIP();
+
+ CameraMetadata meta;
+ openEmptyDeviceSession(name, mProvider, &mSession /*out*/, &meta /*out*/, &device /*out*/);
+
+ std::vector<AvailableStream> outputStreams;
+ camera_metadata_t* staticMeta = reinterpret_cast<camera_metadata_t*>(meta.metadata.data());
+ outputStreams.clear();
+ ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputStreams));
+ ASSERT_NE(0u, outputStreams.size());
+
+ AvailableStream sampleStream = outputStreams[0];
+
+ int32_t streamId = 0;
+ Stream stream = {streamId,
+ StreamType::OUTPUT,
+ sampleStream.width,
+ sampleStream.height,
+ static_cast<PixelFormat>(sampleStream.format),
+ static_cast<aidl::android::hardware::graphics::common::BufferUsage>(
+ GRALLOC1_CONSUMER_USAGE_VIDEO_ENCODER),
+ Dataspace::UNKNOWN,
+ StreamRotation::ROTATION_0,
+ std::string(),
+ /*bufferSize*/ 0,
+ /*groupId*/ -1,
+ {SensorPixelMode::ANDROID_SENSOR_PIXEL_MODE_DEFAULT},
+ RequestAvailableDynamicRangeProfilesMap::
+ ANDROID_REQUEST_AVAILABLE_DYNAMIC_RANGE_PROFILES_MAP_STANDARD};
+
+ std::vector<Stream> streams = {stream};
+ StreamConfiguration config;
+ createStreamConfiguration(streams, StreamConfigurationMode::NORMAL_MODE, &config);
+
+ CameraMetadata camera_chars;
+ ret = device->getCameraCharacteristics(&camera_chars);
+ ASSERT_TRUE(ret.isOk());
+
+ CameraMetadata session_chars;
+ ret = device->getSessionCharacteristics(config, &session_chars);
+ ASSERT_TRUE(ret.isOk());
+ verifySessionCharacteristics(session_chars, camera_chars);
+
+ ret = mSession->close();
+ mSession = nullptr;
+ ASSERT_TRUE(ret.isOk());
}
}
@@ -615,19 +608,17 @@
ASSERT_EQ(0u, rawMetadata.metadata.size());
}
- if (flags::feature_combination_query()) {
- if (supportFeatureCombinationQuery) {
- CameraMetadata rawMetadata2;
- ndk::ScopedAStatus ret2 =
- device->constructDefaultRequestSettings(reqTemplate, &rawMetadata2);
+ if (supportFeatureCombinationQuery) {
+ CameraMetadata rawMetadata2;
+ ndk::ScopedAStatus ret2 =
+ device->constructDefaultRequestSettings(reqTemplate, &rawMetadata2);
- ASSERT_EQ(ret.isOk(), ret2.isOk());
- ASSERT_EQ(ret.getStatus(), ret2.getStatus());
+ ASSERT_EQ(ret.isOk(), ret2.isOk());
+ ASSERT_EQ(ret.getStatus(), ret2.getStatus());
- ASSERT_EQ(rawMetadata.metadata.size(), rawMetadata2.metadata.size());
- if (ret2.isOk()) {
- validateDefaultRequestMetadata(reqTemplate, rawMetadata2);
- }
+ ASSERT_EQ(rawMetadata.metadata.size(), rawMetadata2.metadata.size());
+ if (ret2.isOk()) {
+ validateDefaultRequestMetadata(reqTemplate, rawMetadata2);
}
}
}
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index f905011..6ecd451 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -1920,28 +1920,22 @@
ASSERT_TRUE(ret.isOk());
ASSERT_EQ(expectedStatus, streamCombinationSupported);
- if (flags::feature_combination_query()) {
- int32_t interfaceVersion;
- ret = device->getInterfaceVersion(&interfaceVersion);
+ int32_t interfaceVersion;
+ ret = device->getInterfaceVersion(&interfaceVersion);
+ ASSERT_TRUE(ret.isOk());
+ bool supportFeatureCombinationQuery =
+ (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3);
+ if (supportFeatureCombinationQuery) {
+ ret = device->isStreamCombinationWithSettingsSupported(config,
+ &streamCombinationSupported);
ASSERT_TRUE(ret.isOk());
- bool supportFeatureCombinationQuery =
- (interfaceVersion >= CAMERA_DEVICE_API_MINOR_VERSION_3);
- if (supportFeatureCombinationQuery) {
- ret = device->isStreamCombinationWithSettingsSupported(config,
- &streamCombinationSupported);
- ASSERT_TRUE(ret.isOk());
- ASSERT_EQ(expectedStatus, streamCombinationSupported);
- }
+ ASSERT_EQ(expectedStatus, streamCombinationSupported);
}
}
}
void CameraAidlTest::verifySessionCharacteristics(const CameraMetadata& session_chars,
const CameraMetadata& camera_chars) {
- if (!flags::feature_combination_query()) {
- return;
- }
-
const camera_metadata_t* session_metadata =
reinterpret_cast<const camera_metadata_t*>(session_chars.metadata.data());
diff --git a/compatibility_matrices/bump.py b/compatibility_matrices/bump.py
index 35633c1..4e3ceaa 100755
--- a/compatibility_matrices/bump.py
+++ b/compatibility_matrices/bump.py
@@ -111,6 +111,25 @@
"kernel_configs", "-a", " ".join(next_kernel_configs), android_bp
])
+ # update the SYSTEM_MATRIX_DEPS variable and the phony module's
+ # product_variables entry.
+ lines = []
+ with open(android_bp) as f:
+ for line in f:
+ if f" \"{self.device_module_name}\",\n" in line:
+ lines.append(f" \"{self.current_module_name}\",\n")
+
+ if f" \"{self.current_module_name}\",\n" in line:
+ lines.append(f" \"{self.next_module_name}\",\n")
+ else:
+ lines.append(line)
+
+ with open(android_bp, "w") as f:
+ f.write("".join(lines))
+
+
+ # This Android.mk file may be deprecated soon and the functionality is
+ # replaced by the soong phony module system_compatibility_matrix.xml.
def edit_android_mk(self):
android_mk = self.interfaces_dir / "compatibility_matrices/Android.mk"
lines = []
diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml
index 9b7866c..ed45c1b 100644
--- a/compatibility_matrices/compatibility_matrix.202504.xml
+++ b/compatibility_matrices/compatibility_matrix.202504.xml
@@ -662,7 +662,7 @@
</hal>
<hal format="aidl">
<name>android.hardware.wifi.hostapd</name>
- <version>1-2</version>
+ <version>2-3</version>
<interface>
<name>IHostapd</name>
<instance>default</instance>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index b86f399..e7a31e6 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -149,6 +149,7 @@
"android.hardware.radio@",
"android.hardware.uwb.fira_android@",
"android.hardware.wifi.common@",
+ "android.hardware.biometrics.fingerprint.virtualhal@",
// Test packages are exempted.
"android.hardware.tests.",
diff --git a/drm/common/aidl/Android.bp b/drm/common/aidl/Android.bp
index 1e4b8e0..c5cb441 100644
--- a/drm/common/aidl/Android.bp
+++ b/drm/common/aidl/Android.bp
@@ -9,6 +9,7 @@
aidl_interface {
name: "android.hardware.drm.common",
+ host_supported: true,
vendor_available: true,
srcs: ["android/hardware/drm/*.aidl"],
stability: "vintf",
@@ -22,6 +23,9 @@
ndk: {
min_sdk_version: "34",
},
+ rust: {
+ enabled: true,
+ },
},
double_loadable: true,
versions_with_info: [
diff --git a/gnss/aidl/vts/gnss_hal_test.cpp b/gnss/aidl/vts/gnss_hal_test.cpp
index 5e2cbe3..0dd8b32 100644
--- a/gnss/aidl/vts/gnss_hal_test.cpp
+++ b/gnss/aidl/vts/gnss_hal_test.cpp
@@ -276,29 +276,35 @@
}
/*
- * FindStrongFrequentNonGpsSource:
+ * FindStrongFrequentBlockableSource:
*
- * Search through a GnssSvStatus list for the strongest non-GPS satellite observed enough times
+ * Search through a GnssSvStatus list for the strongest blockable satellite observed enough times
*
* returns the strongest source,
* or a source with constellation == UNKNOWN if none are found sufficient times
*/
-BlocklistedSource GnssHalTest::FindStrongFrequentNonGpsSource(
+BlocklistedSource GnssHalTest::FindStrongFrequentBlockableSource(
const std::list<hidl_vec<IGnssCallback_2_1::GnssSvInfo>> sv_info_list,
const int min_observations) {
- return FindStrongFrequentNonGpsSource(convertToAidl(sv_info_list), min_observations);
+ return FindStrongFrequentBlockableSource(convertToAidl(sv_info_list), min_observations);
}
-BlocklistedSource GnssHalTest::FindStrongFrequentNonGpsSource(
+BlocklistedSource GnssHalTest::FindStrongFrequentBlockableSource(
const std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_list,
const int min_observations) {
std::map<ComparableBlocklistedSource, SignalCounts> mapSignals;
+ bool isCnBuild = Utils::isCnBuild();
+ ALOGD("isCnBuild: %s", isCnBuild ? "true" : "false");
for (const auto& sv_info_vec : sv_info_list) {
for (uint32_t iSv = 0; iSv < sv_info_vec.size(); iSv++) {
const auto& gnss_sv = sv_info_vec[iSv];
if ((gnss_sv.svFlag & (int)IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
(gnss_sv.constellation != GnssConstellationType::GPS)) {
+ if (isCnBuild && (gnss_sv.constellation == GnssConstellationType::BEIDOU)) {
+ // Do not blocklist BDS on CN builds
+ continue;
+ }
ComparableBlocklistedSource source;
source.id.svid = gnss_sv.svid;
source.id.constellation = gnss_sv.constellation;
@@ -343,7 +349,7 @@
return source_to_blocklist.id;
}
-GnssConstellationType GnssHalTest::startLocationAndGetNonGpsConstellation(
+GnssConstellationType GnssHalTest::startLocationAndGetBlockableConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout) {
if (aidl_gnss_hal_->getInterfaceVersion() <= 1) {
return static_cast<GnssConstellationType>(
@@ -360,7 +366,9 @@
ALOGD("Observed %d GnssSvInfo, while awaiting %d Locations (%d received)",
sv_info_list_cbq_size, locations_to_await, location_called_count);
- // Find first non-GPS constellation to blocklist
+ bool isCnBuild = Utils::isCnBuild();
+ ALOGD("isCnBuild: %s", isCnBuild ? "true" : "false");
+ // Find first blockable constellation to blocklist
GnssConstellationType constellation_to_blocklist = GnssConstellationType::UNKNOWN;
for (int i = 0; i < sv_info_list_cbq_size; ++i) {
std::vector<IGnssCallback::GnssSvInfo> sv_info_vec;
@@ -370,7 +378,11 @@
if ((gnss_sv.svFlag & (uint32_t)IGnssCallback::GnssSvFlags::USED_IN_FIX) &&
(gnss_sv.constellation != GnssConstellationType::UNKNOWN) &&
(gnss_sv.constellation != GnssConstellationType::GPS)) {
- // found a non-GPS constellation
+ if (isCnBuild && (gnss_sv.constellation == GnssConstellationType::BEIDOU)) {
+ // Do not blocklist BDS on CN builds
+ continue;
+ }
+ // found a blockable constellation
constellation_to_blocklist = gnss_sv.constellation;
break;
}
@@ -381,11 +393,11 @@
}
if (constellation_to_blocklist == GnssConstellationType::UNKNOWN) {
- ALOGI("No non-GPS constellations found, constellation blocklist test less effective.");
+ ALOGI("No blockable constellations found, constellation blocklist test less effective.");
// Proceed functionally to blocklist something.
constellation_to_blocklist = GnssConstellationType::GLONASS;
}
-
+ ALOGD("Constellation to blocklist: %d", constellation_to_blocklist);
return constellation_to_blocklist;
}
@@ -462,6 +474,10 @@
GnssData lastGnssData;
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, timeoutSeconds));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ if (i <= 2 && lastGnssData.measurements.size() == 0) {
+ // Allow 3 seconds tolerance for empty measurement
+ continue;
+ }
ASSERT_TRUE(lastGnssData.measurements.size() > 0);
// Validity check GnssData fields
@@ -507,6 +523,10 @@
GnssData lastGnssData;
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, timeoutSeconds));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ if (i <= 2 && lastGnssData.measurements.size() == 0) {
+ // Allow 3 seconds tolerance to report empty measurement
+ continue;
+ }
ASSERT_TRUE(lastGnssData.measurements.size() > 0);
// Validity check GnssData fields
diff --git a/gnss/aidl/vts/gnss_hal_test.h b/gnss/aidl/vts/gnss_hal_test.h
index 88d01c1..dec5856 100644
--- a/gnss/aidl/vts/gnss_hal_test.h
+++ b/gnss/aidl/vts/gnss_hal_test.h
@@ -76,16 +76,16 @@
void StartAndCheckLocations(const int count);
void StartAndCheckLocations(const int count, const bool start_sv_status, const bool start_nmea);
- android::hardware::gnss::GnssConstellationType startLocationAndGetNonGpsConstellation(
+ android::hardware::gnss::GnssConstellationType startLocationAndGetBlockableConstellation(
const int locations_to_await, const int gnss_sv_info_list_timeout);
std::list<std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>> convertToAidl(
const std::list<hidl_vec<android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>>&
sv_info_list);
- android::hardware::gnss::BlocklistedSource FindStrongFrequentNonGpsSource(
+ android::hardware::gnss::BlocklistedSource FindStrongFrequentBlockableSource(
const std::list<hidl_vec<android::hardware::gnss::V2_1::IGnssCallback::GnssSvInfo>>
sv_info_list,
const int min_observations);
- android::hardware::gnss::BlocklistedSource FindStrongFrequentNonGpsSource(
+ android::hardware::gnss::BlocklistedSource FindStrongFrequentBlockableSource(
const std::list<std::vector<android::hardware::gnss::IGnssCallback::GnssSvInfo>>
sv_info_list,
const int min_observations);
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index f7408d8..e4890a7 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -419,6 +419,10 @@
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
kFirstGnssMeasurementTimeoutSeconds));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ if (i <= 2 && lastMeasurement.measurements.size() == 0) {
+ // Allow 3 seconds tolerance for empty measurement
+ continue;
+ }
ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
// Validity check GnssData fields
@@ -479,6 +483,10 @@
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
kFirstGnssMeasurementTimeoutSeconds));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ if (i <= 2 && lastMeasurement.measurements.size() == 0) {
+ // Allow 3 seconds tolerance for empty measurement
+ continue;
+ }
ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
// Validity check GnssData fields
@@ -657,19 +665,19 @@
kGnssSvInfoListTimeout);
ASSERT_EQ(count, sv_info_list_cbq_size);
source_to_blocklist =
- FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1);
+ FindStrongFrequentBlockableSource(sv_info_vec_list, kLocationsToAwait - 1);
} else {
std::list<std::vector<IGnssCallback::GnssSvInfo>> sv_info_vec_list;
int count = aidl_gnss_cb_->sv_info_list_cbq_.retrieve(
sv_info_vec_list, sv_info_list_cbq_size, kGnssSvInfoListTimeout);
ASSERT_EQ(count, sv_info_list_cbq_size);
source_to_blocklist =
- FindStrongFrequentNonGpsSource(sv_info_vec_list, kLocationsToAwait - 1);
+ FindStrongFrequentBlockableSource(sv_info_vec_list, kLocationsToAwait - 1);
}
if (source_to_blocklist.constellation == GnssConstellationType::UNKNOWN) {
- // Cannot find a non-GPS satellite. Let the test pass.
- ALOGD("Cannot find a non-GPS satellite. Letting the test pass.");
+ // Cannot find a blockable satellite. Let the test pass.
+ ALOGD("Cannot find a blockable satellite. Letting the test pass.");
return;
}
@@ -816,8 +824,8 @@
* BlocklistConstellationLocationOff:
*
* 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
- * GnssStatus for any non-GPS constellations.
- * 2a & b) Turns off location, and blocklist first non-GPS constellations.
+ * GnssStatus for any blockable constellations.
+ * 2a & b) Turns off location, and blocklist first blockable constellations.
* 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does not use any constellation but GPS.
* 4a & b) Clean up by turning off location, and send in empty blocklist.
@@ -833,9 +841,9 @@
const int kLocationsToAwait = 3;
const int kGnssSvInfoListTimeout = 2;
- // Find first non-GPS constellation to blocklist
+ // Find first blockable constellation to blocklist
GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
- startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
+ startLocationAndGetBlockableConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
// Turns off location
StopAndClearLocations();
@@ -919,8 +927,8 @@
* BlocklistConstellationLocationOn:
*
* 1) Turns on location, waits for 3 locations, ensuring they are valid, and checks corresponding
- * GnssStatus for any non-GPS constellations.
- * 2a & b) Blocklist first non-GPS constellation, and turn off location.
+ * GnssStatus for any blockable constellations.
+ * 2a & b) Blocklist first blockable constellation, and turn off location.
* 3) Restart location, wait for 3 locations, ensuring they are valid, and checks corresponding
* GnssStatus does not use any constellation but GPS.
* 4a & b) Clean up by turning off location, and send in empty blocklist.
@@ -936,9 +944,9 @@
const int kLocationsToAwait = 3;
const int kGnssSvInfoListTimeout = 2;
- // Find first non-GPS constellation to blocklist
+ // Find first blockable constellation to blocklist
GnssConstellationType constellation_to_blocklist = static_cast<GnssConstellationType>(
- startLocationAndGetNonGpsConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
+ startLocationAndGetBlockableConstellation(kLocationsToAwait, kGnssSvInfoListTimeout));
BlocklistedSource source_to_blocklist_1;
source_to_blocklist_1.constellation = constellation_to_blocklist;
@@ -1335,7 +1343,10 @@
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastMeasurement,
kFirstGnssMeasurementTimeoutSeconds));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
- ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
+ if (i > 2) {
+ // Allow 3 seconds tolerance for empty measurement
+ ASSERT_TRUE(lastMeasurement.measurements.size() > 0);
+ }
// Validity check GnssData fields
checkGnssMeasurementClockFields(lastMeasurement);
@@ -1790,6 +1801,10 @@
GnssData lastGnssData;
ASSERT_TRUE(callback->gnss_data_cbq_.retrieve(lastGnssData, 10));
EXPECT_EQ(callback->gnss_data_cbq_.calledCount(), i + 1);
+ if (i <= 2 && lastGnssData.measurements.size() == 0) {
+ // Allow 3 seconds tolerance to report empty measurement
+ continue;
+ }
ASSERT_TRUE(lastGnssData.measurements.size() > 0);
// Validity check GnssData fields
diff --git a/gnss/common/utils/vts/Utils.cpp b/gnss/common/utils/vts/Utils.cpp
index e3ff0f3..38afaf3 100644
--- a/gnss/common/utils/vts/Utils.cpp
+++ b/gnss/common/utils/vts/Utils.cpp
@@ -319,6 +319,24 @@
return d * 1000; // meters
}
+// Returns true iff the device has the specified feature.
+bool Utils::deviceSupportsFeature(const char* feature) {
+ bool device_supports_feature = false;
+ FILE* p = popen("/system/bin/pm list features", "re");
+ if (p) {
+ char* line = NULL;
+ size_t len = 0;
+ while (getline(&line, &len, p) > 0) {
+ if (strstr(line, feature)) {
+ device_supports_feature = true;
+ break;
+ }
+ }
+ pclose(p);
+ }
+ return device_supports_feature;
+}
+
} // namespace common
} // namespace gnss
} // namespace hardware
diff --git a/gnss/common/utils/vts/include/Utils.h b/gnss/common/utils/vts/include/Utils.h
index 62d409a..09b99c4 100644
--- a/gnss/common/utils/vts/include/Utils.h
+++ b/gnss/common/utils/vts/include/Utils.h
@@ -60,6 +60,11 @@
static bool isAutomotiveDevice();
static double distanceMeters(double lat1, double lon1, double lat2, double lon2);
+ // Returns true iff the device has the specified feature.
+ static bool deviceSupportsFeature(const char* feature);
+
+ static bool isCnBuild() { return deviceSupportsFeature("cn.google.services"); }
+
private:
template <class T>
static int64_t getLocationTimestampMillis(const T&);
diff --git a/graphics/Android.bp b/graphics/Android.bp
index 352f3bd..c33f7ff 100644
--- a/graphics/Android.bp
+++ b/graphics/Android.bp
@@ -53,6 +53,7 @@
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_static",
static_libs: [
+ "android.hardware.drm.common-V1-ndk",
"android.hardware.graphics.composer3-V4-ndk",
],
}
@@ -60,6 +61,7 @@
cc_defaults {
name: "android.hardware.graphics.composer3-ndk_shared",
shared_libs: [
+ "android.hardware.drm.common-V1-ndk",
"android.hardware.graphics.composer3-V4-ndk",
],
}
diff --git a/graphics/composer/aidl/Android.bp b/graphics/composer/aidl/Android.bp
index 3b60f68..1728f78 100644
--- a/graphics/composer/aidl/Android.bp
+++ b/graphics/composer/aidl/Android.bp
@@ -37,6 +37,7 @@
imports: [
"android.hardware.graphics.common-V5",
"android.hardware.common-V2",
+ "android.hardware.drm.common-V1",
],
backend: {
cpp: {
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
index e64bd52..cd27360 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -45,4 +45,5 @@
oneway void onVsyncIdle(long display);
oneway void onRefreshRateChangedDebug(in android.hardware.graphics.composer3.RefreshRateChangedDebugData data);
void onHotplugEvent(long display, android.hardware.graphics.common.DisplayHotplugEvent event);
+ oneway void onHdcpLevelsChanged(long display, in android.hardware.drm.HdcpLevels levels);
}
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
index 96eccd7..a1d61fd 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/IComposerCallback.aidl
@@ -16,6 +16,7 @@
package android.hardware.graphics.composer3;
+import android.hardware.drm.HdcpLevels;
import android.hardware.graphics.common.DisplayHotplugEvent;
import android.hardware.graphics.composer3.RefreshRateChangedDebugData;
import android.hardware.graphics.composer3.VsyncPeriodChangeTimeline;
@@ -139,4 +140,12 @@
* @param event is the type of event that occurred.
*/
void onHotplugEvent(long display, DisplayHotplugEvent event);
+
+ /**
+ * Notify the client the HDCP levels of the display changed.
+ *
+ * @param display is the display whose HDCP levels have changed.
+ * @param levels is the new HDCP levels.
+ */
+ oneway void onHdcpLevelsChanged(long display, in HdcpLevels levels);
}
diff --git a/graphics/composer/aidl/vts/Android.bp b/graphics/composer/aidl/vts/Android.bp
index a2ab3d6..894ca52 100644
--- a/graphics/composer/aidl/vts/Android.bp
+++ b/graphics/composer/aidl/vts/Android.bp
@@ -66,6 +66,7 @@
"android.hardware.graphics.common@1.2",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
+ "android.hardware.drm.common-V1-ndk",
"libaidlcommonsupport",
"libarect",
"libbase",
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
index 544f692..1f7972c 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
@@ -208,4 +208,15 @@
}
}
+::ndk::ScopedAStatus GraphicsComposerCallback::onHdcpLevelsChanged(
+ int64_t in_display, const ::aidl::android::hardware::drm::HdcpLevels&) {
+ std::scoped_lock lock(mMutex);
+
+ const auto it = std::find(mDisplays.begin(), mDisplays.end(), in_display);
+ if (it != mDisplays.end()) {
+ mHdcpLevelChangedCount++;
+ }
+ return ::ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
index 7a8d4a3..97f8e2b 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
@@ -65,6 +65,8 @@
const RefreshRateChangedDebugData&) override;
virtual ::ndk::ScopedAStatus onHotplugEvent(int64_t in_display,
common::DisplayHotplugEvent) override;
+ virtual ::ndk::ScopedAStatus onHdcpLevelsChanged(
+ int64_t in_display, const ::aidl::android::hardware::drm::HdcpLevels&) override;
mutable std::mutex mMutex;
// the set of all currently connected displays
@@ -88,6 +90,7 @@
int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidRefreshRateDebugEnabledCallbackCount GUARDED_BY(mMutex) = 0;
+ int32_t mHdcpLevelChangedCount GUARDED_BY(mMutex) = 0;
};
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp
index 0f2debd..d416d2d 100644
--- a/keymaster/aidl/Android.bp
+++ b/keymaster/aidl/Android.bp
@@ -18,6 +18,15 @@
java: {
platform_apis: true,
},
+ ndk: {
+ apex_available: [
+ "com.android.hardware.biometrics.fingerprint.virtual",
+ "//apex_available:platform",
+ ],
+ },
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
diff --git a/radio/aidl/compat/libradiocompat/sim/structs.cpp b/radio/aidl/compat/libradiocompat/sim/structs.cpp
index 00db2b8..27aca60 100644
--- a/radio/aidl/compat/libradiocompat/sim/structs.cpp
+++ b/radio/aidl/compat/libradiocompat/sim/structs.cpp
@@ -70,26 +70,60 @@
};
}
-aidl::CarrierRestrictions toAidl(const V1_0::CarrierRestrictions& cr) {
+static aidl::CarrierInfo toCarrierInfo(const aidl::Carrier& carrier) {
return {
- .allowedCarriers = toAidl(cr.allowedCarriers),
- .excludedCarriers = toAidl(cr.excludedCarriers),
+ .mcc = carrier.mcc,
+ .mnc = carrier.mnc,
+ };
+}
+
+static std::vector<aidl::CarrierInfo> toCarrierInfos(const std::vector<aidl::Carrier>& carriers) {
+ std::vector<aidl::CarrierInfo> infos(carriers.size());
+ for (size_t i = 0; i < carriers.size(); i++) {
+ infos[i] = toCarrierInfo(carriers[i]);
+ }
+ return infos;
+}
+
+V1_0::Carrier toHidl(const aidl::CarrierInfo& carrierInfo) {
+ return {
+ .mcc = carrierInfo.mcc,
+ .mnc = carrierInfo.mnc,
+ };
+}
+
+aidl::CarrierRestrictions toAidl(const V1_0::CarrierRestrictions& cr) {
+ auto allowedCarriers = toAidl(cr.allowedCarriers);
+ auto excludedCarriers = toAidl(cr.excludedCarriers);
+ return {
+ .allowedCarriers = allowedCarriers,
+ .excludedCarriers = excludedCarriers,
.allowedCarriersPrioritized = true,
+ .allowedCarrierInfoList = toCarrierInfos(allowedCarriers),
+ .excludedCarrierInfoList = toCarrierInfos(excludedCarriers),
};
}
aidl::CarrierRestrictions toAidl(const V1_4::CarrierRestrictionsWithPriority& cr) {
+ auto allowedCarriers = toAidl(cr.allowedCarriers);
+ auto excludedCarriers = toAidl(cr.excludedCarriers);
return {
- .allowedCarriers = toAidl(cr.allowedCarriers),
- .excludedCarriers = toAidl(cr.excludedCarriers),
+ .allowedCarriers = allowedCarriers,
+ .excludedCarriers = excludedCarriers,
.allowedCarriersPrioritized = cr.allowedCarriersPrioritized,
+ .allowedCarrierInfoList = toCarrierInfos(allowedCarriers),
+ .excludedCarrierInfoList = toCarrierInfos(excludedCarriers),
};
}
V1_4::CarrierRestrictionsWithPriority toHidl(const aidl::CarrierRestrictions& cr) {
return {
- .allowedCarriers = toHidl(cr.allowedCarriers),
- .excludedCarriers = toHidl(cr.excludedCarriers),
+ .allowedCarriers = (cr.allowedCarriers.size() > cr.allowedCarrierInfoList.size())
+ ? toHidl(cr.allowedCarriers)
+ : toHidl(cr.allowedCarrierInfoList),
+ .excludedCarriers = (cr.excludedCarriers.size() > cr.excludedCarrierInfoList.size())
+ ? toHidl(cr.excludedCarriers)
+ : toHidl(cr.excludedCarrierInfoList),
.allowedCarriersPrioritized = cr.allowedCarriersPrioritized,
};
}
diff --git a/radio/aidl/compat/libradiocompat/sim/structs.h b/radio/aidl/compat/libradiocompat/sim/structs.h
index 54099b7..7774bee 100644
--- a/radio/aidl/compat/libradiocompat/sim/structs.h
+++ b/radio/aidl/compat/libradiocompat/sim/structs.h
@@ -37,6 +37,7 @@
::aidl::android::hardware::radio::sim::Carrier toAidl(const V1_0::Carrier& carrier);
V1_0::Carrier toHidl(const ::aidl::android::hardware::radio::sim::Carrier& carrier);
+V1_0::Carrier toHidl(const ::aidl::android::hardware::radio::sim::CarrierInfo& carrierInfo);
::aidl::android::hardware::radio::sim::CarrierRestrictions //
toAidl(const V1_0::CarrierRestrictions& cr);
diff --git a/radio/aidl/vts/radio_sim_test.cpp b/radio/aidl/vts/radio_sim_test.cpp
index 6ffe2c5..2823977 100644
--- a/radio/aidl/vts/radio_sim_test.cpp
+++ b/radio/aidl/vts/radio_sim_test.cpp
@@ -485,8 +485,10 @@
} else {
carrierRestrictions.allowedCarrierInfoList.resize(1);
carrierRestrictions.excludedCarrierInfoList.resize(0);
- carrierRestrictions.allowedCarrierInfoList[0].mcc = std::string("321");
- carrierRestrictions.allowedCarrierInfoList[0].mnc = std::string("654");
+ // TODO(b/365568518): change mcc/mnc to something else once CF fully supports
+ // setAllowedCarriers
+ carrierRestrictions.allowedCarrierInfoList[0].mcc = std::string("123");
+ carrierRestrictions.allowedCarrierInfoList[0].mnc = std::string("456");
carrierRestrictions.allowedCarrierInfoList[0].spn = std::string("TestNetwork");
carrierRestrictions.allowedCarrierInfoList[0].gid1 = std::string("BAE000000000000");
carrierRestrictions.allowedCarrierInfoList[0].gid2 = std::string("AE0000000000000");
@@ -517,7 +519,7 @@
sleep(2);
updateSimCardStatus();
}
- // TODO: uncomment once CF fully supports setAllowedCarriers
+ // TODO(b/365568518): uncomment once CF fully supports setAllowedCarriers
// EXPECT_EQ(CardStatus::STATE_RESTRICTED, cardStatus.cardState);
}
@@ -545,19 +547,21 @@
} else {
ASSERT_EQ(1, radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList.size());
EXPECT_EQ(0, radioRsp_sim->carrierRestrictionsResp.excludedCarrierInfoList.size());
- ASSERT_TRUE(std::string("321") ==
- radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].mcc);
- ASSERT_TRUE(std::string("654") ==
- radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].mnc);
- ASSERT_TRUE(std::string("BAE000000000000") ==
+ ASSERT_EQ(std::string("123"),
+ radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].mcc);
+ ASSERT_EQ(std::string("456"),
+ radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].mnc);
+#if 0 // TODO(b/365568518): enable once CF fully supports setAllowedCarriers
+ ASSERT_EQ(std::string("BAE000000000000"),
radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].gid1);
- ASSERT_TRUE(std::string("AE0000000000000") ==
+ ASSERT_EQ(std::string("AE0000000000000"),
radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].gid2);
- ASSERT_TRUE(std::string("9987") ==
+ ASSERT_EQ(std::string("9987"),
radioRsp_sim->carrierRestrictionsResp.allowedCarrierInfoList[0].imsiPrefix);
- ASSERT_TRUE(radioRsp_sim->carrierRestrictionsResp.allowedCarriersPrioritized);
EXPECT_EQ(CarrierRestrictions::CarrierRestrictionStatus::RESTRICTED,
radioRsp_sim->carrierRestrictionsResp.status);
+#endif
+ ASSERT_TRUE(radioRsp_sim->carrierRestrictionsResp.allowedCarriersPrioritized);
EXPECT_EQ(SimLockMultiSimPolicy::NO_MULTISIM_POLICY, radioRsp_sim->multiSimPolicyResp);
}
sleep(10);
diff --git a/secure_element/aidl/default/Android.bp b/secure_element/aidl/default/Android.bp
index b382822..6f5e5f7 100644
--- a/secure_element/aidl/default/Android.bp
+++ b/secure_element/aidl/default/Android.bp
@@ -55,6 +55,7 @@
prebuilts: [
"secure_element.rc",
"secure_element.xml",
- "android.hardware.se.omapi.ese.prebuilt.xml", // <feature>
+ // TODO (b/289193458): Add this back when access control is implemented for cuttlefish.
+ // "android.hardware.se.omapi.ese.prebuilt.xml", // <feature>
],
}
diff --git a/security/keymint/support/include/remote_prov/remote_prov_utils.h b/security/keymint/support/include/remote_prov/remote_prov_utils.h
index b7c32ca..141f243 100644
--- a/security/keymint/support/include/remote_prov/remote_prov_utils.h
+++ b/security/keymint/support/include/remote_prov/remote_prov_utils.h
@@ -21,6 +21,7 @@
#include <vector>
#include "aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.h"
+#include <hwtrust/hwtrust.h>
#include <keymaster/cppcose/cppcose.h>
namespace aidl::android::hardware::security::keymint::remote_prov {
@@ -176,7 +177,8 @@
*/
ErrMsgOr<std::unique_ptr<cppbor::Array>> verifyFactoryCsr(
const cppbor::Array& keysToSign, const std::vector<uint8_t>& csr,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge);
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowDegenerate = true);
/**
* Verify the CSR as if the device is a final production sample.
*/
@@ -188,4 +190,9 @@
/** Checks whether the CSR has a proper DICE chain. */
ErrMsgOr<bool> isCsrWithProperDiceChain(const std::vector<uint8_t>& csr);
+/** Verify the DICE chain. */
+ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc,
+ hwtrust::DiceChain::Kind kind, bool allowAnyMode,
+ bool allowDegenerate);
+
} // namespace aidl::android::hardware::security::keymint::remote_prov
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 646037c..a679340 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -26,7 +26,6 @@
#include <android-base/macros.h>
#include <android-base/properties.h>
#include <cppbor.h>
-#include <hwtrust/hwtrust.h>
#include <json/json.h>
#include <keymaster/km_openssl/ec_key.h>
#include <keymaster/km_openssl/ecdsa_operation.h>
@@ -325,7 +324,8 @@
}
ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc,
- hwtrust::DiceChain::Kind kind, bool allowAnyMode) {
+ hwtrust::DiceChain::Kind kind, bool allowAnyMode,
+ bool allowDegenerate) {
auto encodedBcc = bcc->encode();
// Use ro.build.type instead of ro.debuggable because ro.debuggable=1 for VTS testing
@@ -336,6 +336,11 @@
auto chain = hwtrust::DiceChain::Verify(encodedBcc, kind, allowAnyMode);
if (!chain.ok()) return chain.error().message();
+
+ if (!allowDegenerate && !chain->IsProper()) {
+ return "DICE chain is degenerate";
+ }
+
auto keys = chain->CosePublicKeys();
if (!keys.ok()) return keys.error().message();
std::vector<BccEntryData> result;
@@ -701,7 +706,8 @@
}
// BCC is [ pubkey, + BccEntry]
- auto bccContents = validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr13, allowAnyMode);
+ auto bccContents = validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr13, allowAnyMode,
+ /*allowDegenerate=*/true);
if (!bccContents) {
return bccContents.message() + "\n" + prettyPrint(bcc.get());
}
@@ -997,7 +1003,8 @@
ErrMsgOr<bytevec> parseAndValidateAuthenticatedRequest(const std::vector<uint8_t>& request,
const std::vector<uint8_t>& challenge,
- bool allowAnyMode = false) {
+ bool allowAnyMode = false,
+ bool allowDegenerate = true) {
auto [parsedRequest, _, csrErrMsg] = cppbor::parse(request);
if (!parsedRequest) {
return csrErrMsg;
@@ -1035,19 +1042,20 @@
return diceChainKind.message();
}
- auto diceContents = validateBcc(diceCertChain, *diceChainKind, allowAnyMode);
+ auto diceContents = validateBcc(diceCertChain, *diceChainKind, allowAnyMode, allowDegenerate);
if (!diceContents) {
return diceContents.message() + "\n" + prettyPrint(diceCertChain);
}
- auto& udsPub = diceContents->back().pubKey;
+ auto udsPub = diceCertChain->get(0)->asMap()->encode();
+ auto& kmDiceKey = diceContents->back().pubKey;
auto error = validateUdsCerts(*udsCerts, udsPub);
if (!error.empty()) {
return error;
}
- auto signedPayload = verifyAndParseCoseSign1(signedData, udsPub, {} /* aad */);
+ auto signedPayload = verifyAndParseCoseSign1(signedData, kmDiceKey, {} /* aad */);
if (!signedPayload) {
return signedPayload.message();
}
@@ -1064,7 +1072,8 @@
const std::vector<uint8_t>& csr,
IRemotelyProvisionedComponent* provisionable,
const std::vector<uint8_t>& challenge,
- bool isFactory, bool allowAnyMode = false) {
+ bool isFactory, bool allowAnyMode = false,
+ bool allowDegenerate = true) {
RpcHardwareInfo info;
provisionable->getHardwareInfo(&info);
if (info.versionNumber != 3) {
@@ -1072,7 +1081,8 @@
") does not match expected version (3).";
}
- auto csrPayload = parseAndValidateAuthenticatedRequest(csr, challenge, allowAnyMode);
+ auto csrPayload =
+ parseAndValidateAuthenticatedRequest(csr, challenge, allowAnyMode, allowDegenerate);
if (!csrPayload) {
return csrPayload.message();
}
@@ -1082,8 +1092,10 @@
ErrMsgOr<std::unique_ptr<cppbor::Array>> verifyFactoryCsr(
const cppbor::Array& keysToSign, const std::vector<uint8_t>& csr,
- IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge) {
- return verifyCsr(keysToSign, csr, provisionable, challenge, /*isFactory=*/true);
+ IRemotelyProvisionedComponent* provisionable, const std::vector<uint8_t>& challenge,
+ bool allowDegenerate) {
+ return verifyCsr(keysToSign, csr, provisionable, challenge, /*isFactory=*/true,
+ /*allowAnyMode=*/false, allowDegenerate);
}
ErrMsgOr<std::unique_ptr<cppbor::Array>> verifyProductionCsr(
diff --git a/security/keymint/support/remote_prov_utils_test.cpp b/security/keymint/support/remote_prov_utils_test.cpp
index 89469f1..82121cb 100644
--- a/security/keymint/support/remote_prov_utils_test.cpp
+++ b/security/keymint/support/remote_prov_utils_test.cpp
@@ -41,6 +41,41 @@
using ::testing::ElementsAreArray;
using byte_view = std::span<const uint8_t>;
+inline const std::vector<uint8_t> kDegenerateBcc{
+ 0x82, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0xf5,
+ 0x5a, 0xfb, 0x28, 0x06, 0x48, 0x68, 0xea, 0x49, 0x3e, 0x47, 0x80, 0x1d, 0xfe, 0x1f, 0xfc,
+ 0xa8, 0x84, 0xb3, 0x4d, 0xdb, 0x99, 0xc7, 0xbf, 0x23, 0x53, 0xe5, 0x71, 0x92, 0x41, 0x9b,
+ 0x46, 0x84, 0x43, 0xa1, 0x01, 0x27, 0xa0, 0x59, 0x01, 0x75, 0xa9, 0x01, 0x78, 0x28, 0x31,
+ 0x64, 0x34, 0x35, 0x65, 0x33, 0x35, 0x63, 0x34, 0x35, 0x37, 0x33, 0x31, 0x61, 0x32, 0x62,
+ 0x34, 0x35, 0x36, 0x37, 0x63, 0x33, 0x63, 0x65, 0x35, 0x31, 0x36, 0x66, 0x35, 0x63, 0x31,
+ 0x66, 0x34, 0x33, 0x61, 0x62, 0x64, 0x36, 0x30, 0x62, 0x02, 0x78, 0x28, 0x31, 0x64, 0x34,
+ 0x35, 0x65, 0x33, 0x35, 0x63, 0x34, 0x35, 0x37, 0x33, 0x31, 0x61, 0x32, 0x62, 0x34, 0x35,
+ 0x36, 0x37, 0x63, 0x33, 0x63, 0x65, 0x35, 0x31, 0x36, 0x66, 0x35, 0x63, 0x31, 0x66, 0x34,
+ 0x33, 0x61, 0x62, 0x64, 0x36, 0x30, 0x62, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x40, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x41, 0xa0, 0x3a, 0x00, 0x47, 0x44, 0x52,
+ 0x58, 0x40, 0x71, 0xd7, 0x47, 0x9e, 0x61, 0xb5, 0x30, 0xa3, 0xda, 0xe6, 0xac, 0xb2, 0x91,
+ 0xa4, 0xf9, 0xcf, 0x7f, 0xba, 0x6b, 0x5f, 0xf9, 0xa3, 0x7f, 0xba, 0xab, 0xac, 0x69, 0xdd,
+ 0x0b, 0x04, 0xd6, 0x34, 0xd2, 0x3f, 0x8f, 0x84, 0x96, 0xd7, 0x58, 0x51, 0x1d, 0x68, 0x25,
+ 0xea, 0xbe, 0x11, 0x11, 0x1e, 0xd8, 0xdf, 0x4b, 0x62, 0x78, 0x5c, 0xa8, 0xfa, 0xb7, 0x66,
+ 0x4e, 0x8d, 0xac, 0x3b, 0x00, 0x4c, 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, 0x40, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x3a, 0x00, 0x47, 0x44, 0x56, 0x41, 0x00, 0x3a, 0x00, 0x47, 0x44, 0x57, 0x58,
+ 0x2d, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0xf5,
+ 0x5a, 0xfb, 0x28, 0x06, 0x48, 0x68, 0xea, 0x49, 0x3e, 0x47, 0x80, 0x1d, 0xfe, 0x1f, 0xfc,
+ 0xa8, 0x84, 0xb3, 0x4d, 0xdb, 0x99, 0xc7, 0xbf, 0x23, 0x53, 0xe5, 0x71, 0x92, 0x41, 0x9b,
+ 0x46, 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, 0x20, 0x58, 0x40, 0x31, 0x5c, 0x43, 0x87, 0xf9,
+ 0xbb, 0xb9, 0x45, 0x09, 0xa8, 0xe8, 0x08, 0x70, 0xc4, 0xd9, 0xdc, 0x4e, 0x5a, 0x19, 0x10,
+ 0x4f, 0xa3, 0x21, 0x20, 0x34, 0x05, 0x5b, 0x2e, 0x78, 0x91, 0xd1, 0xe2, 0x39, 0x43, 0x8b,
+ 0x50, 0x12, 0x82, 0x37, 0xfe, 0xa4, 0x07, 0xc3, 0xd5, 0xc3, 0x78, 0xcc, 0xf9, 0xef, 0xe1,
+ 0x95, 0x38, 0x9f, 0xb0, 0x79, 0x16, 0x4c, 0x4a, 0x23, 0xc4, 0xdc, 0x35, 0x4e, 0x0f};
+
inline bool equal_byte_views(const byte_view& view1, const byte_view& view2) {
return std::equal(view1.begin(), view1.end(), view2.begin(), view2.end());
}
@@ -258,5 +293,14 @@
EXPECT_THAT(eekPubY, ElementsAreArray(geek->getBstrValue(CoseKey::PUBKEY_Y).value_or(empty)));
}
+TEST(RemoteProvUtilsTest, validateBccDegenerate) {
+ auto [bcc, _, errMsg] = cppbor::parse(kDegenerateBcc);
+ ASSERT_TRUE(bcc) << "Error: " << errMsg;
+
+ EXPECT_TRUE(validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr16,
+ /*allowAnyMode=*/false, /*allowDegenerate=*/true));
+ EXPECT_FALSE(validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kVsr16,
+ /*allowAnyMode=*/false, /*allowDegenerate=*/false));
+}
} // namespace
} // namespace aidl::android::hardware::security::keymint::remote_prov
diff --git a/security/rkp/OWNERS b/security/rkp/OWNERS
index d25977f..8f854b4 100644
--- a/security/rkp/OWNERS
+++ b/security/rkp/OWNERS
@@ -2,4 +2,3 @@
jbires@google.com
sethmo@google.com
-trong@google.com
diff --git a/threadnetwork/aidl/default/Android.bp b/threadnetwork/aidl/default/Android.bp
index 51e5c25..a840fa3 100644
--- a/threadnetwork/aidl/default/Android.bp
+++ b/threadnetwork/aidl/default/Android.bp
@@ -14,6 +14,8 @@
vendor: true,
relative_install_path: "hw",
+ defaults: ["android.hardware.threadnetwork-service.defaults"],
+
shared_libs: [
"libbinder_ndk",
"liblog",
@@ -43,6 +45,17 @@
],
}
+cc_defaults {
+ name: "android.hardware.threadnetwork-service.defaults",
+ product_variables: {
+ debuggable: {
+ cppflags: [
+ "-DDEV_BUILD",
+ ],
+ },
+ },
+}
+
cc_fuzz {
name: "android.hardware.threadnetwork-service.fuzzer",
diff --git a/threadnetwork/aidl/default/utils.cpp b/threadnetwork/aidl/default/utils.cpp
index 3552b3a..740f331 100644
--- a/threadnetwork/aidl/default/utils.cpp
+++ b/threadnetwork/aidl/default/utils.cpp
@@ -43,6 +43,7 @@
}
void otDumpDebgPlat(const char* aText, const void* aData, uint16_t aDataLength) {
+#ifdef DEV_BUILD
constexpr uint16_t kBufSize = 512;
char buf[kBufSize];
@@ -55,6 +56,11 @@
__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "%s: %s", aText, buf);
}
+#else
+ OT_UNUSED_VARIABLE(aText);
+ OT_UNUSED_VARIABLE(aData);
+ OT_UNUSED_VARIABLE(aDataLength);
+#endif
}
OT_TOOL_WEAK void otPlatAlarmMilliFired(otInstance* aInstance) {
diff --git a/uwb/aidl/default/Android.bp b/uwb/aidl/default/Android.bp
index eba18cf..037eac3 100644
--- a/uwb/aidl/default/Android.bp
+++ b/uwb/aidl/default/Android.bp
@@ -16,17 +16,13 @@
prefer_rlib: true,
rustlibs: [
"android.hardware.uwb-V1-rust",
- "liblibc",
"liblogger",
"liblog_rust",
"libbinder_rs",
"libbinder_tokio_rs",
"libtokio",
- "libtokio_util",
"libnix",
"libanyhow",
- "libpdl_runtime",
- "libuwb_uci_packets",
],
proc_macros: [
"libasync_trait",
diff --git a/uwb/aidl/default/src/service.rs b/uwb/aidl/default/src/service.rs
index e97b291..80fa8af 100644
--- a/uwb/aidl/default/src/service.rs
+++ b/uwb/aidl/default/src/service.rs
@@ -1,8 +1,6 @@
use android_hardware_uwb::aidl::android::hardware::uwb::IUwb::{self, IUwb as _};
use android_hardware_uwb::binder;
-use tokio::runtime::Runtime;
-
use std::env;
use std::panic;
@@ -25,13 +23,12 @@
log::info!("UWB HAL starting up");
- // Create the tokio runtime
- let rt = Runtime::new()?;
+ let rt = tokio::runtime::Runtime::new()?;
let chips = env::args()
.skip(1) // Skip binary name
.enumerate()
- .map(|(i, arg)| uwb_chip::UwbChip::new(i.to_string(), arg));
+ .map(|(i, arg)| rt.block_on(uwb_chip::UwbChip::new(i.to_string(), arg)));
binder::add_service(
&format!("{}/default", IUwb::BpUwb::get_descriptor()),
diff --git a/uwb/aidl/default/src/uwb_chip.rs b/uwb/aidl/default/src/uwb_chip.rs
index 956cf6c..0ed05d8 100644
--- a/uwb/aidl/default/src/uwb_chip.rs
+++ b/uwb/aidl/default/src/uwb_chip.rs
@@ -7,126 +7,113 @@
use binder::{DeathRecipient, IBinder, Result, Strong};
use std::sync::Arc;
-use tokio::io::unix::AsyncFd;
-use tokio::select;
+use tokio::fs;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::sync::Mutex;
-use tokio_util::sync::CancellationToken;
-use std::fs::{File, OpenOptions};
-use std::io::{self, Read, Write};
-use std::os::unix::fs::OpenOptionsExt;
-
-use pdl_runtime::Packet;
-use uwb_uci_packets::{DeviceResetCmdBuilder, ResetConfig, UciControlPacket, UciControlPacketHal};
-
-enum State {
+enum ClientState {
Closed,
Opened {
callbacks: Strong<dyn IUwbClientCallback>,
- handle: tokio::task::JoinHandle<()>,
- serial: File,
- death_recipient: DeathRecipient,
- token: CancellationToken,
+ _death_recipient: DeathRecipient,
},
}
+struct ServiceState {
+ client_state: ClientState,
+ writer: fs::File,
+}
+
pub struct UwbChip {
name: String,
- path: String,
- state: Arc<Mutex<State>>,
+ _handle: tokio::task::JoinHandle<()>,
+ service_state: Arc<Mutex<ServiceState>>,
}
-impl UwbChip {
- pub fn new(name: String, path: String) -> Self {
- Self {
- name,
- path,
- state: Arc::new(Mutex::new(State::Closed)),
- }
- }
-}
-
-impl State {
- /// Terminate the reader task.
- async fn close(&mut self) -> Result<()> {
- if let State::Opened {
- ref mut token,
- ref callbacks,
- ref mut death_recipient,
- ref mut handle,
- ref mut serial,
- } = *self
- {
- log::info!("waiting for task cancellation");
- callbacks.as_binder().unlink_to_death(death_recipient)?;
- token.cancel();
- handle.await.unwrap();
- let packet: UciControlPacket = DeviceResetCmdBuilder {
- reset_config: ResetConfig::UwbsReset,
- }
- .build()
- .into();
- // DeviceResetCmd need to be send to reset the device to stop all running
- // activities on UWBS.
- let packet_vec: Vec<UciControlPacketHal> = packet.into();
- for hal_packet in packet_vec.into_iter() {
- serial
- .write(&hal_packet.encode_to_vec().unwrap())
- .map(|written| written as i32)
- .map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?;
- }
- consume_device_reset_rsp_and_ntf(
- &mut serial
- .try_clone()
- .map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?,
- );
- log::info!("task successfully cancelled");
- callbacks.onHalEvent(UwbEvent::CLOSE_CPLT, UwbStatus::OK)?;
- *self = State::Closed;
- }
- Ok(())
- }
-}
-
-fn consume_device_reset_rsp_and_ntf(reader: &mut File) {
- // Poll the DeviceResetRsp and DeviceStatusNtf before hal is closed to prevent
- // the host from getting response and notifications from a 'powered down' UWBS.
- // Do nothing when these packets are received.
- const DEVICE_RESET_RSP: [u8; 5] = [64, 0, 0, 1, 0];
- const DEVICE_STATUS_NTF: [u8; 5] = [96, 1, 0, 1, 1];
- let mut buffer = vec![0; DEVICE_RESET_RSP.len() + DEVICE_STATUS_NTF.len()];
- read_exact(reader, &mut buffer).unwrap();
-
- // Make sure received packets are the expected ones.
- assert_eq!(&buffer[0..DEVICE_RESET_RSP.len()], &DEVICE_RESET_RSP);
- assert_eq!(&buffer[DEVICE_RESET_RSP.len()..], &DEVICE_STATUS_NTF);
-}
-
-pub fn makeraw(file: File) -> io::Result<File> {
- // Configure the file descriptor as raw fd.
+/// Configure a file descriptor as raw fd.
+pub fn makeraw(file: fs::File) -> std::io::Result<fs::File> {
use nix::sys::termios::*;
let mut attrs = tcgetattr(&file)?;
cfmakeraw(&mut attrs);
tcsetattr(&file, SetArg::TCSANOW, &attrs)?;
-
Ok(file)
}
-/// Wrapper around Read::read to handle EWOULDBLOCK.
-/// /!\ will actively wait for more data, make sure to call
-/// this method only when data is immediately expected.
-fn read_exact(file: &mut File, mut buf: &mut [u8]) -> io::Result<()> {
- while buf.len() > 0 {
- match file.read(buf) {
- Ok(0) => panic!("unexpectedly reached end of file"),
- Ok(read_len) => buf = &mut buf[read_len..],
- Err(err) if err.kind() == io::ErrorKind::WouldBlock => continue,
- Err(err) => return Err(err),
+impl UwbChip {
+ pub async fn new(name: String, path: String) -> Self {
+ // Open the serial file and configure it as raw file
+ // descriptor.
+ let mut reader = fs::OpenOptions::new()
+ .read(true)
+ .write(true)
+ .create(false)
+ .open(&path)
+ .await
+ .and_then(makeraw)
+ .expect("failed to open the serial device");
+ let writer = reader
+ .try_clone()
+ .await
+ .expect("failed to clone serial for writing");
+
+ // Create the chip
+ let service_state = Arc::new(Mutex::new(ServiceState {
+ writer,
+ client_state: ClientState::Closed,
+ }));
+
+ // Spawn the task that will run the polling loop.
+ let handle = {
+ let service_state = service_state.clone();
+
+ tokio::task::spawn(async move {
+ log::info!("UCI reader task started");
+
+ const MESSAGE_TYPE_MASK: u8 = 0b11100000;
+ const DATA_MESSAGE_TYPE: u8 = 0b000;
+ const UCI_HEADER_SIZE: usize = 4;
+ const UCI_BUFFER_SIZE: usize = 1024;
+
+ let mut buffer = [0; UCI_BUFFER_SIZE];
+
+ loop {
+ reader
+ .read_exact(&mut buffer[0..UCI_HEADER_SIZE])
+ .await
+ .expect("failed to read uci header bytes");
+ let common_header = buffer[0];
+ let mt = (common_header & MESSAGE_TYPE_MASK) >> 5;
+ let payload_length = if mt == DATA_MESSAGE_TYPE {
+ u16::from_le_bytes([buffer[2], buffer[3]]) as usize
+ } else {
+ buffer[3] as usize
+ };
+
+ let total_packet_length = payload_length + UCI_HEADER_SIZE;
+ reader
+ .read_exact(&mut buffer[UCI_HEADER_SIZE..total_packet_length])
+ .await
+ .expect("failed to read uci payload bytes");
+
+ log::debug!(" <-- {:?}", &buffer[0..total_packet_length]);
+
+ let service_state = service_state.lock().await;
+ if let ClientState::Opened { ref callbacks, .. } = service_state.client_state {
+ callbacks
+ .onUciMessage(&buffer[0..total_packet_length])
+ .unwrap();
+ }
+ }
+ })
+ };
+
+ Self {
+ name,
+ _handle: handle,
+ service_state,
}
}
- Ok(())
}
-
impl binder::Interface for UwbChip {}
#[async_trait]
@@ -136,124 +123,30 @@
}
async fn open(&self, callbacks: &Strong<dyn IUwbClientCallback>) -> Result<()> {
- log::debug!("open: {:?}", &self.path);
+ log::debug!("open");
- let mut state = self.state.lock().await;
+ let mut service_state = self.service_state.lock().await;
- if matches!(*state, State::Opened { .. }) {
+ if matches!(service_state.client_state, ClientState::Opened { .. }) {
log::error!("the state is already opened");
return Err(binder::ExceptionCode::ILLEGAL_STATE.into());
}
- let serial = OpenOptions::new()
- .read(true)
- .write(true)
- .create(false)
- .custom_flags(libc::O_NONBLOCK)
- .open(&self.path)
- .and_then(makeraw)
- .map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?;
-
- let state_death_recipient = self.state.clone();
- let mut death_recipient = DeathRecipient::new(move || {
- let mut state = state_death_recipient.blocking_lock();
- log::info!("Uwb service has died");
- if let State::Opened { ref mut token, .. } = *state {
- token.cancel();
- *state = State::Closed;
- }
- });
+ let mut death_recipient = {
+ let service_state = self.service_state.clone();
+ DeathRecipient::new(move || {
+ log::info!("Uwb service has died");
+ let mut service_state = service_state.blocking_lock();
+ service_state.client_state = ClientState::Closed;
+ })
+ };
callbacks.as_binder().link_to_death(&mut death_recipient)?;
-
- let token = CancellationToken::new();
- let cloned_token = token.clone();
-
- let client_callbacks = callbacks.clone();
-
- let reader = serial
- .try_clone()
- .map_err(|_| binder::StatusCode::UNKNOWN_ERROR)?;
-
- let join_handle = tokio::task::spawn(async move {
- log::info!("UCI reader task started");
- let mut reader = AsyncFd::new(reader).unwrap();
-
- loop {
- const MESSAGE_TYPE_MASK: u8 = 0b11100000;
- const DATA_MESSAGE_TYPE: u8 = 0b000;
- const UWB_HEADER_SIZE: usize = 4;
- let mut buffer = vec![0; UWB_HEADER_SIZE];
-
- // The only time where the task can be safely
- // cancelled is when no packet bytes have been read.
- //
- // - read_exact() cannot be used here since it is not
- // cancellation safe.
- // - read() cannot be used because it cannot be cancelled:
- // the syscall is executed blocking on the threadpool
- // and completes after termination of the task when
- // the pipe receives more data.
- let read_len = loop {
- // On some platforms, the readiness detecting mechanism
- // relies on edge-triggered notifications. This means that
- // the OS will only notify Tokio when the file descriptor
- // transitions from not-ready to ready. For this to work
- // you should first try to read or write and only poll for
- // readiness if that fails with an error of
- // std::io::ErrorKind::WouldBlock.
- match reader.get_mut().read(&mut buffer) {
- Ok(0) => {
- log::error!("file unexpectedly closed");
- return;
- }
- Ok(read_len) => break read_len,
- Err(err) if err.kind() == io::ErrorKind::WouldBlock => (),
- Err(_) => panic!("unexpected read failure"),
- }
-
- let mut guard = select! {
- _ = cloned_token.cancelled() => {
- log::info!("task is cancelled!");
- return;
- },
- result = reader.readable() => result.unwrap()
- };
-
- guard.clear_ready();
- };
-
- // Read the remaining header bytes, if truncated.
- read_exact(reader.get_mut(), &mut buffer[read_len..]).unwrap();
-
- let common_header = buffer[0];
- let mt = (common_header & MESSAGE_TYPE_MASK) >> 5;
- let payload_length = if mt == DATA_MESSAGE_TYPE {
- let payload_length_fields: [u8; 2] = buffer[2..=3].try_into().unwrap();
- u16::from_le_bytes(payload_length_fields) as usize
- } else {
- buffer[3] as usize
- };
-
- let length = payload_length + UWB_HEADER_SIZE;
- buffer.resize(length, 0);
-
- // Read the payload bytes.
- read_exact(reader.get_mut(), &mut buffer[UWB_HEADER_SIZE..]).unwrap();
-
- log::debug!(" <-- {:?}", buffer);
- client_callbacks.onUciMessage(&buffer).unwrap();
- }
- });
-
callbacks.onHalEvent(UwbEvent::OPEN_CPLT, UwbStatus::OK)?;
- *state = State::Opened {
+ service_state.client_state = ClientState::Opened {
callbacks: callbacks.clone(),
- handle: join_handle,
- serial,
- death_recipient,
- token,
+ _death_recipient: death_recipient,
};
Ok(())
@@ -262,19 +155,42 @@
async fn close(&self) -> Result<()> {
log::debug!("close");
- let mut state = self.state.lock().await;
+ let mut service_state = self.service_state.lock().await;
- if let State::Opened { .. } = *state {
- state.close().await
- } else {
- Err(binder::ExceptionCode::ILLEGAL_STATE.into())
+ if matches!(service_state.client_state, ClientState::Closed) {
+ log::error!("the state is already closed");
+ return Err(binder::ExceptionCode::ILLEGAL_STATE.into());
}
+
+ // Send the command Device Reset to stop all running activities
+ // on the UWBS emulator. This is necessary because the emulator
+ // is otherwise not notified of the power down (the serial stays
+ // open).
+ //
+ // The response to the command will be dropped by the polling loop,
+ // as the callbacks will have been removed then.
+ let uci_core_device_reset_cmd = [0x20, 0x00, 0x00, 0x01, 0x00];
+
+ service_state
+ .writer
+ .write_all(&uci_core_device_reset_cmd)
+ .await
+ .expect("failed to write UCI Device Reset command");
+
+ if let ClientState::Opened { ref callbacks, .. } = service_state.client_state {
+ callbacks.onHalEvent(UwbEvent::CLOSE_CPLT, UwbStatus::OK)?;
+ }
+
+ service_state.client_state = ClientState::Closed;
+ Ok(())
}
async fn coreInit(&self) -> Result<()> {
log::debug!("coreInit");
- if let State::Opened { ref callbacks, .. } = *self.state.lock().await {
+ let service_state = self.service_state.lock().await;
+
+ if let ClientState::Opened { ref callbacks, .. } = service_state.client_state {
callbacks.onHalEvent(UwbEvent::POST_INIT_CPLT, UwbStatus::OK)?;
Ok(())
} else {
@@ -289,22 +205,27 @@
}
async fn getSupportedAndroidUciVersion(&self) -> Result<i32> {
+ log::debug!("getSupportedAndroidUciVersion");
+
Ok(1)
}
async fn sendUciMessage(&self, data: &[u8]) -> Result<i32> {
log::debug!("sendUciMessage");
- if let State::Opened { ref mut serial, .. } = &mut *self.state.lock().await {
- log::debug!(" --> {:?}", data);
- let result = serial
- .write_all(data)
- .map(|_| data.len() as i32)
- .map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into());
- log::debug!(" status: {:?}", result);
- result
- } else {
- Err(binder::ExceptionCode::ILLEGAL_STATE.into())
+ let mut service_state = self.service_state.lock().await;
+
+ if matches!(service_state.client_state, ClientState::Closed) {
+ log::error!("the state is not opened");
+ return Err(binder::ExceptionCode::ILLEGAL_STATE.into());
}
+
+ log::debug!(" --> {:?}", data);
+ service_state
+ .writer
+ .write_all(data)
+ .await
+ .map(|_| data.len() as i32)
+ .map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into())
}
}
diff --git a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp
index 548cae0..2b09f7e 100644
--- a/uwb/aidl/vts/VtsHalUwbTargetTest.cpp
+++ b/uwb/aidl/vts/VtsHalUwbTargetTest.cpp
@@ -201,14 +201,15 @@
EXPECT_EQ(retrieved_chip_name, chip_name);
}
-/**
TEST_P(UwbAidl, ChipSendUciMessage_GetDeviceInfo) {
-const auto iuwb_chip = getAnyChipAndOpen(callback);
-EXPECT_TRUE(iuwb_chip->coreInit(callback).isOk());
+ const auto iuwb_chip = getAnyChipAndOpen();
+ EXPECT_TRUE(iuwb_chip->coreInit().isOk());
-const std::vector<uint8_t>
-EXPECT_TRUE(iuwb_chip->sendUciMessage().isOk());
-} */
+ std::vector<uint8_t> uciMessage = {0x20, 0x02, 0x00, 0x00}; /** CoreGetDeviceInfo */
+ int32_t* return_status = new int32_t;
+ EXPECT_TRUE(iuwb_chip->sendUciMessage(uciMessage, return_status).isOk());
+ EXPECT_EQ(*return_status, 4 /* Status Ok */);
+}
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(UwbAidl);
INSTANTIATE_TEST_SUITE_P(Uwb, UwbAidl,
diff --git a/wifi/hostapd/aidl/Android.bp b/wifi/hostapd/aidl/Android.bp
index 2e4d4d1..88f4ef2 100644
--- a/wifi/hostapd/aidl/Android.bp
+++ b/wifi/hostapd/aidl/Android.bp
@@ -65,5 +65,5 @@
},
],
- frozen: true,
+ frozen: false,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/BandMask.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/BandMask.aidl
index b1e7f66..fa9f198 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/BandMask.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/BandMask.aidl
@@ -34,8 +34,8 @@
package android.hardware.wifi.hostapd;
@Backing(type="int") @VintfStability
enum BandMask {
- BAND_2_GHZ = 1,
- BAND_5_GHZ = 2,
- BAND_6_GHZ = 4,
- BAND_60_GHZ = 8,
+ BAND_2_GHZ = (1 << 0) /* 1 */,
+ BAND_5_GHZ = (1 << 1) /* 2 */,
+ BAND_6_GHZ = (1 << 2) /* 4 */,
+ BAND_60_GHZ = (1 << 3) /* 8 */,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
index a7b20fa..840b875 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/EncryptionType.aidl
@@ -34,11 +34,11 @@
package android.hardware.wifi.hostapd;
@Backing(type="int") @VintfStability
enum EncryptionType {
- NONE = 0,
- WPA = 1,
- WPA2 = 2,
- WPA3_SAE_TRANSITION = 3,
- WPA3_SAE = 4,
- WPA3_OWE_TRANSITION = 5,
- WPA3_OWE = 6,
+ NONE,
+ WPA,
+ WPA2,
+ WPA3_SAE_TRANSITION,
+ WPA3_SAE,
+ WPA3_OWE_TRANSITION,
+ WPA3_OWE,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl
index 5bb0d32..a0c1886 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/Generation.aidl
@@ -34,7 +34,7 @@
package android.hardware.wifi.hostapd;
@Backing(type="int") @VintfStability
enum Generation {
- WIFI_STANDARD_UNKNOWN = -1,
+ WIFI_STANDARD_UNKNOWN = (-1) /* -1 */,
WIFI_STANDARD_LEGACY = 0,
WIFI_STANDARD_11N = 1,
WIFI_STANDARD_11AC = 2,
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HostapdStatusCode.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HostapdStatusCode.aidl
index 548e497..7edff15 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HostapdStatusCode.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/HostapdStatusCode.aidl
@@ -34,10 +34,10 @@
package android.hardware.wifi.hostapd;
@Backing(type="int") @VintfStability
enum HostapdStatusCode {
- SUCCESS = 0,
- FAILURE_UNKNOWN = 1,
- FAILURE_ARGS_INVALID = 2,
- FAILURE_IFACE_UNKNOWN = 3,
- FAILURE_IFACE_EXISTS = 4,
- FAILURE_CLIENT_UNKNOWN = 5,
+ SUCCESS,
+ FAILURE_UNKNOWN,
+ FAILURE_ARGS_INVALID,
+ FAILURE_IFACE_UNKNOWN,
+ FAILURE_IFACE_EXISTS,
+ FAILURE_CLIENT_UNKNOWN,
}
diff --git a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IfaceParams.aidl b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IfaceParams.aidl
index 64367bb..8da3441 100644
--- a/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IfaceParams.aidl
+++ b/wifi/hostapd/aidl/aidl_api/android.hardware.wifi.hostapd/current/android/hardware/wifi/hostapd/IfaceParams.aidl
@@ -38,4 +38,6 @@
android.hardware.wifi.hostapd.HwModeParams hwModeParams;
android.hardware.wifi.hostapd.ChannelParams[] channelParams;
@nullable android.hardware.wifi.common.OuiKeyedData[] vendorData;
+ @nullable String[] instanceIdentities;
+ boolean isMlo;
}
diff --git a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl
index 3f8ee39..bb646e3 100644
--- a/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl
+++ b/wifi/hostapd/aidl/android/hardware/wifi/hostapd/IfaceParams.aidl
@@ -41,4 +41,12 @@
* Optional vendor-specific configuration parameters.
*/
@nullable OuiKeyedData[] vendorData;
+ /**
+ * The list of the instance identities.
+ */
+ @nullable String[] instanceIdentities;
+ /**
+ * Whether the current iface is MLO.
+ */
+ boolean isMlo;
}
diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp
index f614679..bf1b0d0 100644
--- a/wifi/hostapd/aidl/vts/functional/Android.bp
+++ b/wifi/hostapd/aidl/vts/functional/Android.bp
@@ -21,7 +21,7 @@
"libvndksupport",
],
static_libs: [
- "android.hardware.wifi.hostapd-V2-ndk",
+ "android.hardware.wifi.hostapd-V3-ndk",
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiV1_5TargetTestUtil",
"VtsHalWifiV1_6TargetTestUtil",